If you are able to do
software development on your PC, you will probably be tempted to use or
write a simulator of some kind. At a basic level these are not too hard
to write. Probably, you want to be able to test search and solving algorithms.
While there are a number of examples of actual mazes about, you may want
to generate your own.

Drawing a maze on-screen is not too taxing in terms of software but rapidly
becomes a pain as you carefully draw in all those walls. I have a program
that automatically generates random mazes for me to use for testing. Before
going any further, you need to be aware that random mazes are very unlikely
to have those particular challenges that competition maze designers love.

There are several approaches to generating a maze. Perhaps the simplest
and most reliable is to start with all the walls in place. Knock down
the walls around the centre peg and place all the neighbouring cells into
a queue, having marked them as visited. Now you work your way through
the queue. All the cells in the queue are neighbours of a cell that has
already been examined. Every time you take a cell from the queue, you
remove the wall that joins it to a visited cell and add any new neighbours
to the queue. When the queue is empty you are done.

What you have now is a so-called perfect maze with a single fully connected
path. To make it more useful, you need to knock down some extra walls.
The easiest approach is to remove a fixed percentage of wall at random.
To be a little more rigourous, yu might like to consider removing a number
of dead ends. This seems to work quite well most of the time. If your
software allows it, you could display the fully connected maze and them
tweak it by hand, adding and removing walls to make it more interesting.

Make sure you save any mazes that you generate so that you can make changes
to the searching and solving code to try out again on the same maze.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.