Tower of Hanoi Demonstration
Loading the math board and drawing, please wait…
This example demonstrates the Tower of Hanoi problem, showcasing the solution and process of moving disks through animated paths for different numbers of disks. Core mathematical concepts include recursive algorithms, logical reasoning, sequence generation, and geometric visualization. Construction highlights involve using GeoGebra commands like Sequence for objects seqC, seqB, seqA, along with buttons, sliders, and text elements, utilizing temporary objects like tmpA, tmpB, tmpC for disk movement animations. Suitable for high school and above learners to understand recursion, algorithm design, and geometric dynamic demonstrations.
GeoGebra Commands & Parameters
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, {1.777777777777777, 3.5555555555555545, 5.333333333333333}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, {}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, {}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, {}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, {}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 three parallel tower positions and, above them, a sequence-based animation layout of four-point disk outlines to demonstrate moving disks between towers. Each disk is a rectangular outline defined by four corner points: its horizontal center shifts depending on whether it belongs to the left, middle, or right tower, and its width changes by level so disks progressively narrow upward. Create three main disk sequences corresponding to the left, middle, and right towers, placing them from a shared top-to-bottom height range so that each level differs in size while keeping the same outline shape. Then add three extra temporary disk sequences at a fixed intermediate height to act as transition placements, one aligned to each tower direction, arranged level by level to visually represent the movement process.
The prompt above was compiled from the original drawing commands and is for reference only.