An online trace table for your pseudocode
A trace table (a desk check, or “prueba de escritorio” in Spanish-speaking classrooms) is how you follow an algorithm by hand: one row per step and one column per variable. Codoritmo fills it in while your program runs, so you can check the table you made on paper or find the exact step where a variable gets a value you didn't expect.
Opens the same program; answer 12, 7.5, 30 and 0 to get this table.
A real trace table
This table comes from running the “Sum Until Zero” example with the answers 12, 7.5, 30 and 0. Each row shows the variables just before that line runs; highlighted cells changed since the previous row.
| Step | Line | Instruction | numero | suma | cantidad |
|---|---|---|---|---|---|
| 2 | 3 | Definir cantidad Como Entero | 0 | 0 | |
| 3 | 4 | suma <- 0 | 0 | 0 | 0 |
| 4 | 5 | cantidad <- 0 | 0 | 0 | 0 |
| 5 | 6 | Escribir "Escribe números para sumar. Escribe 0 para terminar." | 0 | 0 | 0 |
| 6 | 7 | Leer numero | 0 | 0 | 0 |
| 7 | 8 | Mientras numero <> 0 Hacer | 12 | 0 | 0 |
| 8 | 9 | suma <- suma + numero | 12 | 0 | 0 |
| 9 | 10 | cantidad <- cantidad + 1 | 12 | 12 | 0 |
| 10 | 11 | Escribir "Siguiente número (0 para terminar):" | 12 | 12 | 1 |
| 11 | 12 | Leer numero | 12 | 12 | 1 |
| 12 | 9 | suma <- suma + numero | 7.5 | 12 | 1 |
| 13 | 10 | cantidad <- cantidad + 1 | 7.5 | 19.5 | 1 |
| 14 | 11 | Escribir "Siguiente número (0 para terminar):" | 7.5 | 19.5 | 2 |
| 15 | 12 | Leer numero | 7.5 | 19.5 | 2 |
| 16 | 9 | suma <- suma + numero | 30 | 19.5 | 2 |
| 17 | 10 | cantidad <- cantidad + 1 | 30 | 49.5 | 2 |
| 18 | 11 | Escribir "Siguiente número (0 para terminar):" | 30 | 49.5 | 3 |
| 19 | 12 | Leer numero | 30 | 49.5 | 3 |
| 20 | 14 | Si cantidad > 0 Entonces | 0 | 49.5 | 3 |
| 21 | 15 | Escribir "Sumaste ", cantidad, " números." | 0 | 49.5 | 3 |
| 22 | 16 | Escribir "Total: ", suma | 0 | 49.5 | 3 |
| 23 | 17 | Escribir "Promedio: ", suma / cantidad | 0 | 49.5 | 3 |
22 rows, one for each step with variables.
- Answers typed
- 12, 7.5, 30, 0
- What the console shows
Escribe números para sumar. Escribe 0 para terminar. Siguiente número (0 para terminar): Siguiente número (0 para terminar): Siguiente número (0 para terminar): Sumaste 3 números. Total: 49.5 Promedio: 16.5
How to make a trace table in Codoritmo
Open your algorithm
Type it, paste it or open an example.
Open the Desk Check tab
In the bottom panel, choose the Desk Check tab.
Step through it
Use Step Forward: each step adds a row. If the program asks for values, answer them in the console.
Go back to any step
Click a row to return to that moment of the run: the code and the flowchart move to that line.
Opens the same program; answer 12, 7.5, 30 and 0 to get this table.
How to read the table
The Step column counts the instructions run so far and Line says which one it was. An empty cell means the variable doesn't exist yet at that step.
Notice that line 8, the Mientras, appears only once: after each pass the condition numero <> 0 is checked again without adding a row, and the run carries on at line 9. When numero is 0, the loop ends and the run jumps to the Si on line 14.
What it's for
Teachers ask for trace tables so you understand what each instruction does. Do yours on paper first and then compare it with Codoritmo's: if they don't match, the first different row shows you where the difference is.
Codoritmo and PSeInt desktop
PSeInt also has a desk check inside its step-by-step mode. Here's how they compare.
What Codoritmo adds
- The table fills itself in with every variable, with nothing to set up.
- You can step back and click any row to return to that step.
- Arrays appear as boxes in the Arrays tab.
- As in PSeInt, you can evaluate an expression at any step and add it as a column to follow, such as suma / cantidad.
What PSeInt desktop does that Codoritmo doesn't yet
- It works offline, as an installed program.
Codoritmo is an independent project, inspired by PSeInt and compatible with its syntax and school profiles. It is not PSeInt and is not affiliated with it. Official PSeInt website
Frequently asked questions
What is a trace table?
It's following an algorithm by hand, writing down each variable's value after every instruction. It helps you understand what the program does and find mistakes without running it.
Can I hand in Codoritmo's table?
Use it to check yours. If your teacher wants the trace table done by hand, do it yourself first and then use Codoritmo to verify it.
Why are some rows missing?
The table only shows steps where some variable already exists, and keeps up to the last 400. At instant speed only some steps are recorded; to see them all, use Step Forward or the slow or normal speed.
Examples to try
Solved programs, each with its code, its flowchart and a sample run.
Sum Until Zero
Adds up the numbers you type until you enter a 0.
BeginnerFactorial and Power
Functions that compute a factorial and a power.
IntermediateLinear Search
Finds a name in a list, ignoring upper and lower case.
IntermediateBubble Sort
Sorts random numbers by swapping neighbors, and stops as soon as they're in order.
Intermediate
More Codoritmo tools
- PSeInt onlineWrite and run pseudocode with PSeInt's syntax from your browser.
- PSeInt alternativeAn honest comparison of Codoritmo and PSeInt desktop.
- Online flowchart makerYour algorithm's flowchart, generated from the code and animated as it runs.
- Pseudocode to PythonYour algorithm translated into a Python program you can run.
- Pseudocode to CYour algorithm translated into a C (or C++) program ready to compile.
- Pseudocode to JavaYour algorithm translated into a Java class with a main method.
- Block-based programmingBuild your algorithm with Scratch-like blocks and see the pseudocode they write.