Idea comes from Collective map making presentation by Prof. dr hab. Krzysztof Kułakowski.
This program simulates how robots explore a maze. You have a maze with some gates. Robots come to maze through these gates and walk through the maze. Also if they meet, they merge knowledge.
For build program on Linux you could run:
$ qmake && make
Then you get binary file console/mazeExplorer
Let's generate a maze (run 'mazeExplorer gen help' for help):
$ ./mazeExplorer gen maze 10 10 2 100
Make borders ... Done
Make gates ... Done
Make walls ... Done
generation complete with 54% of walls.
$ cat maze
***** ****
*** ****
***** *
* ****** *
* *** *
* ***** **
* ** **
* ** **
* *****
**********
Then you can run robots (run 'mazeExplorer gen help' for help):
$ ./mazeExplorer run randomWalker 2 maze aaLog
Log will be printed to aaVideo.txt
Using: mazeExplorer gen fileName x_size y_size num_gates persent_of_walls
Where persent_of_walls is desired percentage of maze area.
Generator works in the following way:
- filling border walls
- make gates randomly
- take all internal points and shuffle
- repeat if we have unused nested points and current percentage of walls less than we desired
- take internal point
- put a wall on it
- check all gates accessibility from all other gates
- if false delete the wall
Usage: mazeExplorer run robotName robotCount mazeFile [aaLog]
Available robots are:
On running program write progress.csv file. File contain information about how many rooms robot visited. Colums for each robots and one row per simulation step.
'aaLog' flag enable ascii-art logging. It print movie by frames and can be scrolled by 'PageDown'.
On each step it choose random direction. No matter that it try to go in wall. Program engine checks it and holds the robot in the previous place.
This robot looks for possible ways and chooses direction randomly except the room from it came
This robot remembers how much times it has been in each room. On each step it chooses a room which was visited by fewer times.
This robot remembers rooms where it has already been. On each step it choose a room that was never visited. If it is surrounded by already visited rooms then it find nearest non visited room and go to it.