Queue (the frontier)
Ready. Press Step or Play โ or paint cells first.
Invariant 1 โ a cell is marked visited the moment it enters the queue, so two neighbours can never enqueue it twice.
Invariant 2 โ the queue is drained one full layer at a time, so at every pause it contains cells at one single distance = the frontier.
Shortcuts: space play/pause ยท โ step ยท R reset