Read
total += arr[i]A value is looked at. Its cell is outlined — nothing else on the row moves.
How to read a trace
Every run of your program is recorded one line at a time, then drawn. Two things are worth knowing before you open it: what a single step holds, and what each colour on the canvas means.
01Anatomy of a step
Not a sketch of the algorithm — a recording of your code. Each step keeps the line about to run, the call stack, every reachable object and the counters, so stepping backwards is exactly as cheap as stepping forwards.
Highlighted in the editor and named on every panel, so the code, the picture and the numbers always describe the same instant.
arr[j] > arr[j + 1] lights two cells, not the whole array — resolved from the line itself and the live values of j.
Typed the way your editor colours them. A value that moved on this step is flagged on this step.
One frame per call, each with its own locals — recursion reads as a column that grows and unwinds.
Comparisons, swaps, reads and writes so far, against the total for the whole run.
Loop nesting read from your source, cross-checked against how often each line really ran.
02Visual grammar
The same hue means the same thing in the editor gutter, on the canvas, in the variables list and on the timeline — learn it once. Each state also carries a glyph, so it reads in greyscale too.
total += arr[i]A value is looked at. Its cell is outlined — nothing else on the row moves.
if arr[j] > arr[j + 1]:Two values are weighed against each other. Both cells lift and are marked ↔.
dp[i] = dp[i - 1] + dp[i - 2]A position gets a new value — and the cells it was computed from are outlined too.
arr[i], arr[j] = arr[j], arr[i]Two positions trade values in one step. Both cells rise and are marked ⇄.
6if arr[j] > arr[j + 1]:The highlighter. The line about to run in the editor, the node the call stack is standing on in a tree, the vertex being visited in a graph.
Open the visualizer with your own program, or start from one that already runs.