Checking and comparing .maz files
A couple of weeks ago I was sent a bunch of ‘.maz’ maze files to check. These ‘.maz’ files are used with Micromouse robots - and there are copies of maps in this format for all the main competitions.
So I wrote a Python script to do that. It uses the command line maze viewer I wrote a while back to convert the .maz file to a text file first for ease of processing.
It outputs tab-separated values that can be copy and pasted into a spreadsheet. The first few lines of it run on a folder full of maz files look like this (the formatting is easier to read when pasted into a spreadsheet although the post will have broken the tabs here).
It produces the following data:
So I wrote a Python script to do that. It uses the command line maze viewer I wrote a while back to convert the .maz file to a text file first for ease of processing.
It outputs tab-separated values that can be copy and pasted into a spreadsheet. The first few lines of it run on a folder full of maz files look like this (the formatting is easier to read when pasted into a spreadsheet although the post will have broken the tabs here).
name valid? border free posts same very similar(1-10) similar(11-30) slightly like(31-60)
100.maz Valid OK 91
111.maz Valid OK 222 empty.maz minimaze.maz 11simple.maz, iee-88.maz, jpn-2.maz, test3.maz
11simple.maz Valid OK 188 111.maz, empty.maz, minimaze.maz
It produces the following data:
- Which are the same,
- Which are very similar, similar or somewhat alike,
- Which don't have a border around the maze,
- How many posts don't have a wall connected, excluding the border wall. This should normally be 1 (because of the centre target square being open). There are sometimes some unused sections without walls (doesn't affect current mice). Some are just illegal / broken mazes.
- It doesn't detect mazes that are very similar but shifted by 1 or more rows and/or columns, or rotated by 90, 180 or 270 degrees. This is obviously possible with extra work.
- It stops totally at the first maze that fails validation. Might need to be fixed at some point.
- I've only spent a couple of passes tweaking the levels for the very similar / similar / slightly alike ... so that might require some more work. I think the 'slightly alike' level could certainly do with being pushed out.
0 Comments:
Post a Comment
<< Home