5/28: Mazes in Python

A Maze can be as simple as providing rows of 1s and 0s, where 1s are walls you can't enter. Example:

maze2 = [

[1,0,1,0],

[1,0,1,0],

[1,0,0,0],

]

Python has a special form for this, called a Matrix:

# A 2x5 Matrix: matrix = [[0, 1, 0, 0, 1], [1, 0, 0, 1, 1]]

Cory suggested using the presene of "u,d,r,l" values within cells to indicate navigability:

# A 2d matrix maze # with information about possible directions to move in each 'tile' maze =[ [ ['d','r'], ['d', 'r','l'], ['d','r'] ], [ ['d' ], ['d', 'r' ], ['u','l'] ], [ ['d' ], ['d', 'r' ], ['u','l'] ], [ ['d' ], ['d', 'r' ], ['u','l'] ], [ ['u','r'], ['u', 'r','l'], ['u','l'] ], ]