Maze file format
A maze can be thought of as a grid of squares, with some walls between
squares, where there are no walls, there is a "passage" to the next
square, or location.
One way to visualize this is to imagine that the central area of each
square is open space, there are "pillars" holding up a roof at the
corners where the squares meet, and between each pillar is either a
wall (closed), or a passage (open).
So we can choose to represent a 4 by 4 grid of squares, with a 5 by 5
grid of pillars, by a 9 by 9 array of both walls and open space by
using the boolean values of 0 = false = closed (wall or pillar) and 1 =
true = open (center of square, or passage).
If we nember rows and columns from 1, position (x,y)
- with both x & y odd
are pillars, always 0,
- with both x & y even
are open space, always 1
- else either 0=wall or 1=passage
The outside of the maze will be all 0's except for the entrance and the
exits. We will use a text file, and specify the size and entrance
location on the first line as a comma separated list of integers, and
the remaining lines contain the characters '0' and '1' as in this
example, where the exits are at (2,6) and (8,6)
9,7,4,2
000100000
010101010
000100000
011111110
010000010
110101011
000000000
Data files: maze1.txt, maze2.txt,...
Back to maze problem description