solving a maze

There are many well-known approaches to solving a maze. For this program, you will use a method known as the right-hand rule algorithm. (An algorithm is a set of instructions for solving a problem.) As the TriBot moves through the maze, it will always follow the wall to its right, going through any opening on that side.

The right-hand rule algorithm works for mazes without tunnels or bridges and where the start and end points are at the edges of the maze (this method won’t work for a maze where the goal is to get to the center). As long as the maze fits these criteria, the robot is guaranteed to find the exit.

Figure 7-4 shows an example maze with the path followed using the right-hand rule. To help you understand how this rule works, ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.