The maze is a 2 dimensional array of atomic integers encoded as an AtomicIntegerArray.
The upper-left, or north-western corner of the maze is
given by maze.get(0). The lower-right, or south-eastern corner of the maze is
maze.get(maze.length()-1). The maze is stored in row-major order, so the element at
row n, column m is given by maze.get(n * width + m).
The entrance to the maze is at row: 0, column: width/2.
The exit is at row: height-1, column: width/2.
Individual bits of each byte in the "maze" array are used to encode
information about that cell of the maze. Only the low-order 8 bits
are used. The designated bits are:
CCSSEEse
and have the following meaning
CC
- marks two bits that are used to give a color to this cell in the maze. Each of the four
bit combinations corresponds to a different color that will be used by the MazeDisplay object
when drawing this cell. This can be used by your code to provide visual feedback on solving
progress or for debugging.
SS
- marks two bits that are used to give a color to the southern side of this cell.
EE
- marks two bits that are used to give a color to the eastern side of this cell.
s
- Set to 1 if there is a wall to the SOUTH.
e
- Set to 1 if there is a wall to the EAST.
There is always a wall to the south of cells on the southern border of the maze.
There is always a wall to the east of cells on the eastern border of the maze.
There is an implicit wall to the north of cells on the northern border
and to the west of cells on the western border.
width
int width
height
int height
maze
Maze maze
lock
java.lang.Object lock
numFound
int numFound
numDrawn
int numDrawn
cellTypes
java.util.Hashtable<K,V> cellTypes
pos
Position pos
from
Direction from