= || jump pen x |pen position| $oldx $y |@math| $x = |pen position| $x $y = || jump pen y |pen position| $x $oldy |@math| $y = |pen position| $x $y = || jump |backtrack| $row $col = |@math| multiply $col 2 |@math| multiply $row 2 || jump pen x || jump pen y |matrix position| $row $col = || jump |generate| = = || restore cells |discarded cells| $row $col = |cells| $row $col || restore cells = || restore cells = = || delete cell |location| $row $col |cells| $row $col = || restore cells = || delete cell |location| $row $col? |cells| $r $c = |discarded cells| $r $c || delete cell = || delete cell |location| $row $col = || restore cells = || prepare cells |cells| 127 |@math| 127 = |cells| 127 127 = || next column |@math| $col = |cells| 0 $col || prepare cells = || prepare cells |cells| $col |@math| 127 = |@math|add $col 1 |cells| 127 $col || next column = || prepare cells |cells| $col |@math| $row = |@math| add $row 1 |cells| $col |cells| $row $col || prepare cells = || prepare cells |cells| $row $col = |@math| add $row 1 |cells| $col |cells| $row $col || prepare cells = || compute down $col |@math| $row = |down neighbor| $row $col = || compute right $row |@math| $col = |right neighbor| $row $col = || compute up $col |@math| $row = |up neighbor| $row $col = || compute left $row |@math| $col = |left neighbor| $row $col = || find valid neighbors? |down neighbor| $row $col |cells| $row $col = |discarded cells| $row $col |valid down neighbor| $row $col = || find valid neighbors? |right neighbor| $row $col |cells| $row $col = |discarded cells| $row $col |valid right neighbor| $row $col = || find valid neighbors? |up neighbor| $row $col |cells| $row $col = |discarded cells| $row $col |valid up neighbor| $row $col = || find valid neighbors? |left neighbor| $row $col |cells| $row $col = |discarded cells| $row $col |valid left neighbor| $row $col = || find valid neighbors? |cells| $row $col = |discarded cells| $row $col = |up neighbor| $row $col = = |right neighbor| $row $col = = |down neighbor| $row $col = = |left neighbor| $row $col = = || find valid neighbors = || restore cells = || find neighbors |location| $row $col = || compute down $col |@math| add $row 1 || compute right $row |@math| add $col 1 || compute up $col |@math| add $row -1 || compute left $row |@math| add $col -1 || find valid neighbors = || go in direction |@math| 1 |valid up neighbor| $row $col = || move up || move up || delete cell |location| $row $col |matrix position| $row $col || clear navigation state = || go in direction |@math| 2 |valid right neighbor| $row $col = || move right || move right || delete cell |location| $row $col |matrix position| $row $col || clear navigation state = || go in direction |@math| 3 |valid down neighbor| $row $col = || move down || move down || delete cell |location| $row $col |matrix position| $row $col || clear navigation state = || go in direction |@math| 4 |valid left neighbor| $row $col = || move left || move left || delete cell |location| $row $col |matrix position| $row $col || clear navigation state = || go in direction? |@math| 1 |sweep|= |@math| 2 = || go in direction? |@math| 2 |sweep|= |@math| 3 = || go in direction? |@math| 3 |sweep|= |@math| 4 = || go in direction? |@math| 4 |sweep|= |@math| 1 = || go in direction |@math| $n = || clear navigation state || jump = || push location to backtrack stack |location| $row $col = |backtrack| $row $col = || push location to backtrack stack = = || clear navigation state? |valid up neighbor| $r $c = || push location to backtrack stack = || clear navigation state? |valid left neighbor| $r $c = || push location to backtrack stack = || clear navigation state? |valid down neighbor| $r $c = || push location to backtrack stack = || clear navigation state? |valid right neighbor| $r $c = || push location to backtrack stack = || clear navigation state? |sweep| = = || clear navigation state = = || pick a random direction |matrix position| $row $col = || find neighbors |location| $row $col || go in direction |location| $row $col |sweep| |sweep| |sweep| |@math| random 1 5 = || update |generate|? = || pick a random direction == |cells| 1 0 |matrix position| 0 0 |screen resolution| 256 256 || prepare cells || pen brush pencil || pen down || pen color 255 255 255 |generate|