Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 17. Solving a Maze > Programming the Solver

Programming the Solver

Obviously, the hard part in making a maze-solving robot which uses memory is the programming. Our Maze Solver uses the algorithm we briefly described in the “Applying Other Strategies” section for tracking your path. This method is called Tremaux’s algorithm. Before we get into the actual RobotC code, we will describe some concepts and assumptions needed for the program.

First, we define four “directions”—north, west, south, and east. These directions do not have to coincide with the actual four winds. Let’s call the direction of our robot at the entrance “North,” and let the other directions follow the usual convention. The current “direction” will be held in a variable called MyDir. The following code snippet declares the directions and some useful macros to find which direction is to the left/right of another direction:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial