Tower of Hanoi

Tower of Hanoi
Loading the math board and drawing, please wait…
2019-08-16 06:14
This example demonstrates the Tower of Hanoi game. It involves concepts of recursion and sequences. Using GeoGebra commands like Sequence, users can simulate the game process, understand recursive relations, and observe sequence growth. Suitable for middle school and above students to learn recursion and sequences.

GeoGebra Commands & Parameters

  1. Sequence(Polygon[(2 - (2 * Element[seqA, i] / num), (4 * (Length[seqA] - i) / num)), (2 + (2 * Element[seqA, i] / num), (4 * (Length[seqA] - i) / num)), (2 + (2 * Element[seqA, i] / num), (4 * (Length[seqA] - i + 1) / num)), (2 - (2 * Element[seqA, i] / num), (4 * (Length[seqA] - i + 1) / num))], i, 1, Length[seqA]) → discA
  2. Sequence(Polygon[(12 - (2 * Element[seqC, i] / num), (4 * (Length[seqC] - i) / num)), (12 + (2 * Element[seqC, i] / num), (4 * (Length[seqC] - i) / num)), (12 + (2 * Element[seqC, i] / num), (4 * (Length[seqC] - i + 1) / num)), (12 - (2 * Element[seqC, i] / num), (4 * (Length[seqC] - i + 1) / num))], i, 1, Length[seqC]) → discC
  3. Sequence(Polygon[(7 - (2 * Element[seqB, i] / num), (4 * (Length[seqB] - i) / num)), (7 + (2 * Element[seqB, i] / num), (4 * (Length[seqB] - i) / num)), (7 + (2 * Element[seqB, i] / num), (4 * (Length[seqB] - i + 1) / num)), (7 - (2 * Element[seqB, i] / num), (4 * (Length[seqB] - i + 1) / num))], i, 1, Length[seqB]) → discB
  4. Sequence(Polygon[(2 - (2 * Element[tmpA, i] / num), 5), (2 + (2 * Element[tmpA, i] / num), 5), (2 + (2 * Element[tmpA, i] / num), 5 + 4 / num), (2 - (2 * Element[tmpA, i] / num), 5 + 4 / num)], i, 1, Length[tmpA]) → discTA
  5. Sequence(Polygon[(7 - (2 * Element[tmpB, i] / num), 5), (7 + (2 * Element[tmpB, i] / num), 5), (7 + (2 * Element[tmpB, i] / num), 5 + 4 / num), (7 - (2 * Element[tmpB, i] / num), 5 + 4 / num)], i, 1, Length[tmpB]) → discTB
  6. Sequence(Polygon[(12 - (2 * Element[tmpC, i] / num), 5), (12 + (2 * Element[tmpC, i] / num), 5), (12 + (2 * Element[tmpC, i] / num), 5 + 4 / num), (12 - (2 * Element[tmpC, i] / num), 5 + 4 / num)], i, 1, Length[tmpC]) → discTC

AI Drawing Prompt Reference

Draw a visual representation of the Tower of Hanoi puzzle, featuring three vertical pegs aligned horizontally at the bottom. On the left peg, stack several discs of decreasing size from bottom to top, while the middle and right pegs may be empty or hold fewer discs. Represent each disc as a horizontal rectangle or trapezoid, with width proportional to its size. Arrange the pegs evenly spaced, with discs neatly stacked. Optionally, include a slider or animation to show discs moving between pegs, illustrating recursive steps and sequence growth.
The prompt above was compiled from the original drawing commands and is for reference only.