Next / Previous / Contents / TCC Help System / NM Tech homepage

9. Specification functions: cell-key and wall-key

We will need a way to specify a given cell or wall in the maze. Consequently, we define these Cleanroom specification functions that specify these key values in a form that is suitable for use as an index to a Python dictionary.

mazeratty
# - - - - -   S p e c i f i c a t i o n   f u n c t i o n s

#================================================================
# cell-key(row, col) ==
#     a tuple (row, col) where row is the row number counting
#     from 0 at the top and col is the column number counting
#     from 0 at the left
#----------------------------------------------------------------
# wall-key(row, col, isV) ==
#     if isV is True ->
#         the vertical wall to the left of cell-key(row, col)
#     else ->
#         the horizontal wall above cell-key(row, col)
#----------------------------------------------------------------

So, for example: