Use the arrow keys to get the cat out of the maze and into harder and harder levels
The algorithm is here: https://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_Kruskal.27s_algorithm The maze is defined by the "walls" list, with an item per cell, containing a number between 0 and 3 0 - no walls 1 - a wall to the right 2 - a wall at the bottom 3 - both walls This means that for a value w, there's a bottom wall if w>1, and a right wall if w mod 2 is 1. The "walls" list is initialized with 3 for all cells, and the "zones" list begins with a different number for each cell. We repeat the following process rows*columns-1 times: * find a wall between 2 cells that have different zones (zone1 and zone2) * remove the wall * merge the zones (all cells with zone1 in the "zones" list get zone2) After row*colums-1 times, all cells have the same value in the "zones" list. All that's left to do is: * draw the top and left borders of the maze (since there's no cell that defines a left or a top wall for them). * remove the bottom wall of the most bottom-right cell (it has both walls, since they're not between 2 cells, so we simply set its "walls" item to 1). * place the cat at the top-left cell. Note: row and column numbering start from 0 (this makes expressions simpler). For some reason, scratch lists start from 1. This means that the "walls" or "zones" list item number corresponding to row r and column c is 1+r*columns+c (where "columns" is number of columns in the maze).