The picture is a grid. The cloud sits at the top (the bolt's starting cell), the ground is the bottom edge, and the air between them is a field: a number on every cell that says how strongly it is pulled toward the ground. The bolt has zero "voltage", the ground has one, and the field in between settles into the smooth shape that the Laplace equation demands. The program re-solves that field after every single step the bolt takes.
A cell touching the bolt may become the next piece of it, with probability proportional to fieldη. At η = 0 the field is ignored and the bolt swells into a round blob. Around η = 1 you get the branching, ragged tree real lightning has (this is the dielectric breakdown model, Niemeyer–Pietronero–Wiesmann 1984). Past 3 or so the bolt goes nearly straight at the ground, because it always takes the single best step.
Tips of branches stick out into stronger field than the notches between them, so they grow faster. That feedback is what makes the tree. Walls are insulators: the field cannot pass through them and the bolt cannot grow into them. Rods are grounded conductors, so they pull the field toward themselves and the bolt prefers them.
When a branch reaches the ground (or a rod) the strike is made, and the one channel that connects it to the cloud lights up white while everything else dims. The count under the picture is how much longer that channel is than a straight drop. This is a toy model and not a weather simulation; real bolts also do things this one does not, like leaders going up from the ground.