Fun Projects for your LEGO® MINDSTORMS® NXT! |
Ring Stacker |
|
Both of these programs solve the
Towers of Hanoi
puzzle using the
classic recursive algorithm.
The starting position for the robot is with the four rings stacked on the left pole, and the robot arm must be centered on the center pole (use the motor knobs to adjust the position manually before starting the program).
The recursive algorithm will probably be difficult to understand unless you have a college-level computer science background. To help understand the solution better, in the Word Blocks version, you could replace the main program start sequence and the MoveStack MyBlock below it with the main program start sequence shown in this image, which executes a series of pre-planned 15 single-ring moves. This sequence of moves is the same sequence that the recursive MoveStack block computes, but just listed directly instead of computed. |
Copyright
©
2007-2021 by Dave Parker. All rights reserved. |