The Tower Of Hanoi
Maple Simulation
Andy Gijbels andy.gijbels@student.kuleuven.be gijbelsandy@hotmail.com www.agshome.tk Belgium
Copyright ? 2007 by Andy Gijbels
All rights reserved
Introduction
The Tower of Hanoi or Towers of Hanoi is a mathematical game or puzzle. It consists of three pegs, and a number of disks of different sizes which can slide onto any peg. The puzzle starts with the disks neatly stacked in order of size on one peg, smallest at the top, thus making a conical shape. The objective of the game is to move the entire stack to another peg, obeying the following rules: * Only one disk may be moved at a time. * Each move consists of taking the upper disk from one of the pegs and sliding it
onto another peg, on top of the other disks that may already be present on that
peg. * No disk may be placed on top of a smaller disk.
This Maple worksheet calculates the solution with minimum number of steps and visualises it in an animation.
Initialsiation
Restart
Packages
Parameters
Number of disks
Final state rod
Speed
Minimum is 1
Create game
Storage media
Steps
Disks
Heights
Placing Algoritm
Place Disks on initial positions
Optimal Solution Algorithm
Replacement Algorithm
Graphics
Platform
Rods
Solver
Implementation
Visualisation
Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.