0% found this document useful (0 votes)
141 views

Maze Solving Algorithms For Micro Mouse - Semantic Scholar

The document discusses algorithms for solving mazes with a micro mouse robot, starting with basic wall following and expanding to more sophisticated algorithms like depth first search and flood fill. It provides details on how each algorithm works and its advantages/disadvantages for solving mazes efficiently.

Uploaded by

hai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views

Maze Solving Algorithms For Micro Mouse - Semantic Scholar

The document discusses algorithms for solving mazes with a micro mouse robot, starting with basic wall following and expanding to more sophisticated algorithms like depth first search and flood fill. It provides details on how each algorithm works and its advantages/disadvantages for solving mazes efficiently.

Uploaded by

hai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Maze Solving Algorithms for Micro Mouse

Surojit Guha Sonender Kumar

[email protected] [email protected]

Abstract
The problem of micro-mouse is 30 years old tral area of the maze unaided. The mouse
but its importance in the field of robotics is will need to keep track of where it is, dis-
unparalleled, as it requires a complete analy- cover walls as it explores, map out the maze
sis & proper planning to be solved. This pa- and detect when it has reached the goal.
per covers one of the most important areas Having reached the goal, the mouse will typ-
of robot, “Decision making Algorithm” or in ically perform additional searches of the
lay-man’s language, “Robot Intelligence”. maze until it has found an optimal route
For starting in the field of micro-mouse it is from the start to the center. Once the optimal
very difficult to begin with highly sophisti- route has been found, the mouse will run
cated algorithms. This paper begins with that route in the shortest possible time.
very basic wall follower logic to solve the
maze. And gradually improves the algorithm
to accurately solve the maze in shortest time
with some more intelligence. The Algorithm
is developed up to some sophisticated level
as Flood-Fill algorithm. The paper would
help all the beginners in this fascinating
field, as they proceed towards development
of the “brain of the system”, particularly for
robots concerned with path planning and na-
vigation

1. Introduction

The Micromouse competition is an annual


contest hosted by the Institute of Electrical
and Electronics Engineers (IEEE). A small Championship-level mice can make it from
autonomous mobile robot called a micro- the start cell to the finish cell in well under
mouse, must navigate through an unknown 20 seconds with top speeds averaging 2 me-
maze and locate the center. The robot that ters/sec, now that's a fast mouse!
makes the fastest time run from the start to
the center of the maze is declared the winner 2. The Wall Follower
of the competition.
The wall following algorithm is the simplest
The maze is made up of a 16 by 16 grid of of the maze solving techniques. Basically,
cells, each 180 mm square with walls 50 the mouse follows either the left or the right
mm high. The mice are completely auto- wall as a guide around the maze.
nomous robots that must find their way from
a predetermined starting position to the cen-
Although there are wall following competi- dead end, the mouse backtracks to the inter-
tions for the younger students, this algorithm section and chooses another path. This
does not work in the IEEE maze solving forces the robot to explore every possible
competitions because those mazes are spe- path within the maze. By exploring every
cifically designed to not be solved in this cell within the maze the mouse will even-
way. Take a look at the maze. tually find the center.

Obviously, exploring the entire maze is not


an efficient way of solving it. Also, this me-
thod finds a route but it doesn't necessarily
find the quickest or shortest route to the cen-
ter. This algorithm wastes too much time
exploring the entire maze.

Also this algorithm does not work for the


mazes which do not contain any deep cor-
ner.

4. The Flood-Fill Algorithm

The flood-fill algorithm involves assigning


values to each of the cells in the maze where
these values represent the distance from any
cell on the maze to the destination cell. The
The right wall following routine:
destination cell, therefore, is assigned a val-
ue of 0. If the mouse is standing in a cell
with a value of 1, it is 1 cell away from the
goal. If the mouse is standing in a cell with a
value of 3, it is 3 cells away from the goal.
Assuming the robot cannot move diagonally,
the values for a 5X5 maze without walls
would look like this.

You can see that if the mouse follows the


left or right walls, it would only explore the
perimeter of the maze without ever ventur-
ing into the middle section.

3. Depth First Search

The depth first search is an intuitive method


of searching a maze. Basically, the mouse Of course for a full sized maze, you would
simply starts moving. When it comes to an have 16 rows by 16 columns = 256 cell val-
intersection in the maze, it randomly choos- ues. Therefore you would need 256 bytes to
es one of the paths. If that path leads to a
store the distance values for a complete Move to the neighboring cell with the low-
maze. est distance value.

When it comes time to make a move, the ro- Now the mouse has a way of getting to cen-
bot must examine all adjacent cells which ter in a maze with no walls. But real mazes
are not separated by walls and choose the have walls and these walls will affect the
one with the lowest distance value. In our distance values in the maze so we need to
example above, the mouse would ignore any keep track of them. Again, there are 256
cell to the West because there is a wall, and cells in a real maze so another 256 bytes will
it would look at the distance values of the be more than sufficient to keep track of the
cells to the North, East and South since walls. There are 8 bits in the byte for a cell.
those are not separated by walls. The cell to The first 4 bits can represent the walls leav-
the North has a value of 2, the cell to the ing you with another 4 bits for your own
East has a value of 2 and the cell to the use. A typical cell byte can look like this:
South has a value of 4. The routine sorts the
values to determine which cell has the low- Remember that every interior wall is shared
est distance value. It turns out that both the by two cells so when you update the wall
North and East cells have a distance value of value for one cell you can update the wall
2. That means that the mouse can go North value for its neighbor as well. The instruc-
or East and traverse the same number of tions for updating the wall map can look
cells on its way to the destination cell. Since something like this
turning would take time, the mouse will
choose to go forward to the North cell. So Update the wall map:
the decision process would be something
like this
Is the cell to the North separated by a wall?
Yes -> Turn on the "North" bit for the cell
Decide which neighboring cell has the low- we are standing on and
est distance value: Turn on the "South" bit for the cell to the
North
Is the cell to the North separated by a wall? No -> Do nothing
Yes -> Ignore the North cell
No -> Push the North cell onto the stack to
Is the cell to the East separated by a wall?
be examined Yes -> Turn on the "East" bit for the cell we
are standing on and
Is the cell to the East separated by a wall? Turn on the "West" bit for the cell to the
Yes -> Ignore the East cell East
No -> Push the East cell onto the stack to be No -> Do nothing
examined
Is the cell to the South separated by a wall?
Is the cell to the South separated by a wall? Yes -> Turn on the "South" bit for the cell
Yes -> Ignore the South cell we are standing on and
No -> Push the South cell onto the stack to Turn on the "North" bit for the cell to the
be examined South
No -> Do nothing
Is the cell to the West separated by a wall?
Yes -> Ignore the West cell Is the cell to the West separated by a wall?
No -> Push the West cell onto the stack to Yes -> Turn on the "West" bit for the cell we
be examined are standing on and
Turn on the "East" bit for the cell to the
Pull all of the cells from the stack (The stack West
is now empty) No -> Do nothing
Sort the cells to determine which has the
lowest distance value So now we have a way of keeping track of
the walls the mouse finds as it moves about
the maze. But as new walls are found, the
distance values of the cells are affected so
we need a way of updating those. Returning
to our example, suppose the mouse has
found a wall.

We cannot go West and we cannot go East,


we can only travel North or South.

But going North or South means going up


in distance values which we do not want to
do. So we need to update the cell values as a
result of finding this new wall. To do this we
"flood" the maze with new values

The routine would start by initializing the


array holding the distance values and assign-
ing a value of 0 to the destination cell:

The routine again finds the open neighbors


and assigns the next highest value, 2:

As an example of flooding the maze, let's


say that our mouse has wandered around and
found a few more walls.

A few more iterations:

The routine then takes any open neighbors


(that is, neighbors which are not separated
by a wall) and assigns the next highest val-
ue, 1.
Notice how the values lead the mouse from Every time the mouse arrives in a cell it will
the start cell to the destination cell through perform the following steps:
the shortest path.
(1) Update the wall map
The instructions for flooding the maze with
distance values could be: (2) Flood the maze with new distance val-
ues
Flood the maze with new distance values:
(3) Decide which neighboring cell has the
Let variable Level = 0 lowest distance value
Initialize the array DistanceValue so that all
values = 255 (4) Move to the neighboring cell with the
Place the destination cell in an array called lowest distance value
CurrentLevel
Initialize a second array called NextLevel
5. The Modified Flood-Fill Algorithm
Begin:
The modified flood-fill algorithm is similar
to the regular flood-fill algorithm in that the
Repeat the following instructions until Cur- mouse uses distance values to move about
rentLevel is empty: the maze. The distance values, which
represent how far the mouse is from the des-
{ tination cell, are followed in descending or-
Remove a cell from CurrentLevel der until the mouse reaches its goal.
If DistanceValue(cell) = 255 then

let DistanceValue(cell) = Level and


place all open neighbors of cell into NextLe-
vel

End If
}

The array CurrentLevel is now empty.

Is the array NextLevel empty?


No ->

{ As the MicroMouse finds new walls during


Level = Level +1, its exploration, the distance values need to
Let CurrentLevel = NextLevel, be updated. Instead of flooding the entire
Initialize NextLevel, maze with values, as is the case with the
Go back to "Begin:" regular flood-fill, the modified flood-fill on-
} ly changes those values which need to be
changed. Let's say our mouse moves for-
Yes -> You're done flooding the maze ward one cell and discovers a wall.

The flood-fill algorithm is a good way of


finding the shortest (if not the fastest) path The robot cannot go West and it cannot go
from the start cell to the destination cells. East, it can only travel North or South. But
You will need 512 bytes of RAM to imple- going North or South means going up in dis-
ment the routine: one 256 byte array for the tance values which we do not want to do. So
distance values and one 256 array to store the cell values need to be updated. When we
the map of walls. encounter this, we follow this rule:
So our modified flood-fill procedure for up-
dating the distance values is:

Update the distance values (if necessary)

Make sure the stack is empty

Push the current cell (the one the robot is


standing on) onto the stack

Repeat the following set of instructions un-


til the stack is empty:

{
Pull a cell from the stack
Is the distance value of this cell = 1 + the
minimum value of its open neighbors?
No -> Change the cell to 1 + the minimum
value of its open neighbors and
push all of the cell's open neighbors onto the
In the example above, the minimum value of stack to be checked
its open neighbors is 3. Adding 1 to this val- Yes -> Do nothing
ue results in 3 + 1 = 4. The maze now looks }
like this:
Most of the time, the modified flood-fill is
faster than the regular flood-fill. By updat-
ing only those values which need to be up-
dated, the mouse can make its next move
much quicker.

6. The Time Flood Algorithm

The Bellman flooding algorithm is a


popular maze solver with micro mouse
contestants and has been used by several
world championship-winning mice.

There are times when updating a cell's value


will cause its neighbors to violate the "1 +
minimum value" rule and so they must be
checked as well. We can see in our example
above that the cells to the North and to the
South have neighbors whose minimum val-
ue is 2. Adding a 1 to this value results in 2
+ 1 = 3 therefore the cells to the North and
to the South do not violate the rule and the
updating routine is done.

Now that the cell values have been updated, Bellman time flooding array
the mouse can once again follow the dis-
tance values in descending order. The standard Bellman algorithm solves the
maze for the shortest route, but this is not 7. Conclusion and Future Work
always the quickest. To find the quickest
route to the centre of the maze it is neces- This paper reports the results of a feasibility
sary to use an advanced form of the study which aims to establish that in future
Bellman flooding algorithm, which floods some military purpose vehicles or we say the
with time instead of distance. There might unmanned vehicles which can searches its
be two paths in first path robot has to make own path in the battlefield avoiding the ob-
more turns than the other path in which the stacles. Currently this project is undertaken
number of steps are few more. by the government of U.S to design auto-
nomous vehicles for military purpose by the
For this Time Flooding Array first of all we year 2020.
have to create a Direction Array in which
the direction of robot is stored. It can be implemented in making the ve-
hicles autonomous, DARPA Challenge in
US challenges engineers to make autonom-
ous vehicles which can cross through the
hurdles placed in their way. The basic mo-
tive behind this is to make unmanned ve-
hicles for US Army till 2020.

The algorithm applied to search the shortest


path i.e. Bellman Flood-Fill may be used by
the telecom industry in future to search for
the shortest route even when some interme-
diate MSC’s are fully congested.

Direction Array
Finally, we aim to combine Artificial Intelli-
In the above direction array the current di- gence and some other sophisticated algo-
rection of the robot is stored. Now the flood- rithms on our robots to make them more in-
ing array is filled in taking direction array as telligent and smart slaves which reduces our
reference. work efficiently.

You might also like