Winmaze – Another Maze Editor

By | August 16, 2008

It seems that all micromouse builders get around to writing their own software for displaying and editing mazes in the end. This is mine. It is a Windows only application but should run on pretty well any version of Windows. I have not tested it on Vista. It can open maze files of several types including the ‘standard’ binary mazes and some types of text maze. Changes to a maze will always be saved as a binary maze file. (note: revision now will not ask for libraries)

No special installation is required. The downloaded archive can be unpacked anywhere and includes a folder with a number of binary format mazes. I have cleaned up my maze archive and there should be no duplicates in the collection. There are many such collections out there and they often use a variety of different names for the same maze. Some time, I will put a ‘definitive’ list up for on-line viewing. Perhaps this will work in conjunction with Jim Chidley’s results archive that he is building.

Download the zip file here: winmaze080724.zip.

Once unpacked, just run the enclosed executable. You can edit a maze by clicking in the left window to add and remove walls. As you do so, the optimal route is calculated and displayed as a path in the same window. The right-hand view shows the flooding values with the optimal route highlighted in green. The number in the start cell is the path length, in cells. This is not the path cost. A control in the toolbar will allow you to assign different costs to corners. Some mice favour straights, some prefer diagonals. By changing the cost of a single 90 degree turn, you can look for different paths depending on this preference. Interestingly, some mazes can be run with radically different paths for small changes in the corner weighting while some really only have one practical path regardless of the weighting. The solver here makes no attempt to identify alternatives that are identical in cost or length – it just picks the simplest. Equally, you should be aware that the optimal path from the start to the centre may not be the optimal path back. However, since you are only times on the path to the centre, I have not worried about it. Mazes can be opened in the usual way. The file extension is assumed to be .maz. Binary mazes are stored as 256 bytes in column order. That is, the first byte is the start cell, the second is the one to the North – ahead for the mouse. The 17th byte is the cell to the East of the start cell. Each byte uses the four least significant bits to indicate walls. Thus, bit zero is North, bit 1 is East, bit 2 is South and bit 3 is West. Each wall is effectively stored twice, once for each cell. Editing the maze on-screen will update the appropriate adjacent cells. Mazes stored as text files can also be opened. Posts are represented as ‘+’ characters or ‘o’ characters’. Walls are one of ‘|-=’. To get better formatting on a printer, two dashes may be used for horizontal walls. Here is an example of the style that the editor can manage:

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                                               |  
+  +--+--+--+--+--+--+--+--+--+--+--+  +--+  +--+  
|     |                          |              |  
+  +  +  +--+--+--+--+--+--+--+  +--+--+--+  +  +  
|  |  |                                   |  |  |  
+  +  +  +--+--+--+--+--+--+--+--+--+--+  +  +  +  
|  |  |     |  |                       |  |  |  |  
+  +  +  +  +  +  +--+--+--+--+--+  +  +  +  +  +  
|  |  |  |  |  |  |              |  |  |  |     |  
+  +  +  +  +  +  +  +  +--+--+  +  +  +  +  +  +  
|     |        |  |  |                 |     |  |  
+  +--+  +  +  +  +  +  +--+--+  +--+--+  +--+  +  
|  |  |  |  |  |  |  |           |        |  |  |  
+  +  +  +  +  +  +  +--+--+  +  +  +--+--+  +  +  
|  |  |  |  |  |  |  |     |  |  |     |  |  |  |  
+  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  
|  |  |           |  |     |     |  |     |  |  |  
+  +  +  +--+--+--+  +--+  +--+--+  +  +  +  +--+  
|  |  |  |        |              |  |  |     |  |  
+  +  +--+  +--+  +  +--+--+--+  +  +  +--+  +  +  
|  |  |  |  |     |              |        |     |  
+  +  +  +  +  +  +--+  +--+  +--+--+--+  +  +  +  
|  |     |     |  |           |              |  |  
+  +  +  +  +--+  +--+--+  +--+  +--+--+--+--+  +  
|     |     |     |        |                 |  |  
+--+--+--+--+  +--+--+  +--+--+--+--+--+  +--+  +  
|                 |                 |           |  
+  +--+--+  +--+  +--+--+  +--+--+  +--+--+  +  +  
|  |                    |                    |  |  
+  +  +--+--+--+--+--+  +  +--+--+--+--+--+--+  +  
|  |                    |                       |  
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

The program will save mazes in this format if you want, with a TXT extension. This can be handy for printing as there is currently no option within the software for printing a maze directly. To save a bit of time for programmers, the maze can also be saved as a C declaration like this:

unsigned char maze[256] ={
0x0e,0x0a,0x09,0x0c,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x08,0x0a,0x0a,0x0a,0x08,0x09,
0x0c,0x09,0x05,0x06,0x08,0x0a,0x0a,0x0a,0x0a,0x0b,0x06,0x0a,0x0a,0x0a,0x03,0x05,
0x05,0x05,0x05,0x0c,0x02,0x0b,0x0e,0x08,0x0a,0x0a,0x08,0x0a,0x08,0x08,0x09,0x05,
0x05,0x04,0x01,0x06,0x08,0x0a,0x09,0x04,0x0a,0x0a,0x00,0x0a,0x03,0x05,0x05,0x05,
0x05,0x05,0x04,0x09,0x06,0x09,0x05,0x04,0x0a,0x0a,0x02,0x0a,0x0b,0x05,0x05,0x05,
0x05,0x04,0x03,0x06,0x0a,0x02,0x03,0x06,0x0a,0x0a,0x0a,0x0a,0x09,0x05,0x05,0x05,
0x05,0x05,0x0d,0x0d,0x0d,0x0c,0x08,0x0a,0x0a,0x0a,0x0a,0x09,0x05,0x05,0x05,0x05,
0x06,0x03,0x04,0x01,0x04,0x01,0x05,0x0c,0x09,0x0c,0x08,0x01,0x05,0x05,0x05,0x05,
0x0c,0x08,0x01,0x06,0x01,0x05,0x04,0x02,0x03,0x05,0x05,0x05,0x05,0x05,0x05,0x05,
0x05,0x05,0x05,0x0d,0x06,0x01,0x05,0x0c,0x0a,0x01,0x05,0x05,0x05,0x05,0x05,0x05,
0x05,0x05,0x05,0x04,0x09,0x06,0x03,0x06,0x0a,0x02,0x00,0x03,0x05,0x04,0x03,0x05,
0x05,0x04,0x03,0x05,0x05,0x0c,0x0a,0x0a,0x08,0x09,0x04,0x0a,0x01,0x05,0x0d,0x05,
0x05,0x05,0x0d,0x05,0x05,0x04,0x0a,0x08,0x03,0x05,0x06,0x0a,0x03,0x05,0x04,0x01,
0x05,0x05,0x04,0x01,0x04,0x03,0x0c,0x02,0x0b,0x06,0x08,0x0a,0x0a,0x03,0x05,0x05,
0x05,0x06,0x01,0x07,0x06,0x08,0x02,0x0a,0x0a,0x0b,0x06,0x08,0x0a,0x0a,0x00,0x01,
0x06,0x0a,0x02,0x0a,0x0a,0x02,0x0b,0x0e,0x0a,0x0a,0x0a,0x02,0x0a,0x0a,0x03,0x07};

I expect those of you who insist on assembly language can still do something with this though. If you have any difficulties please leave me a note.


5 thoughts on “Winmaze – Another Maze Editor

  1. Alan

    Nice program. It could use a little help file to describe what the 1-7 selector means.

    I’m also curious about the flood fill. Doesn’t the flood start from the middle?

    Alan KM6VV

  2. peteh

    It could indeed.

    The numbers refer to the weighting given to turns. Choosing 1 means that moving straight ahead is no more costly than turning lefto or right. Larger numbers increase the cost of turning. As the cost is increased, the route chosen favours runs with fewer turns. Mice can alter the weighting to suit their characteristics and to determine whether it might be worth continuing to search for a more optimal route.

    In this program flooding begins at the start cell and floods the entire maze. In a practical mouse the same algorithm would flood from the current mouse position until the destination is reached or no changes are detected. In this way the mouse will be able to calculate a route from its current location to any given cell.

  3. amrit

    IT’S AWESOME. THANX DUDE.ACTUALLY I WAS SEARCHING BADLY FOR THIS……

  4. Mr. Thezeus

    Is winmaze080724.zip the current version?

  5. peteh

    Yes it is. I have done nothing with it since then I am afraid.

    Bear in mind that I think it uses a different format to your maze files.

Leave a Reply

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