The Towers of Hanoi
- One really well known problem is the towers of Hanoi.
- There are three pegs (123), and several differently sized discs (e.g.
ABCD).
- You can only move one disc at a time, and a bigger disc can never
sit on a smaller one.
- Initially, ABCD are on peg one. The goal is to move them to
another.
- How do you break that down to subgoals?
- How do you fulfill the subgoals?
- At this point, you need a goal stack.
- That is you build the subgoals until you can resolve one with
an atomic action.
- You then manage the stack.
- The tower of Hanoi is also used to describe recursion.
- However, stack management doesn't always work.
- One of the problems is protecting your already fulfilled
goals.