(…extracted from Wikipedia) The Tower of Hanoi is a mathematical game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape.
The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:
- Only one disk can be moved at a time.
- Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack.
- No disk may be placed on top of a smaller disk.
With three disks, the puzzle can be solved in seven moves. The minimum number of moves required to solve a Tower of Hanoi puzzle is 2^(n) – 1 (two power n minus one), where n is the number of disks.
First of all, if you are not familiarized with git and you don’t know how the cloning stuff works, just keep it simple:
- Download all this project as a ZIP file (button on right side of the screen). Then, once you have extracted all the contents on your Desktop or wherever you want…
- Uncompress the ZIP file you just downloaded
- Open startup.py with Notepad or your favourite text editor
- Copy all the content from it.
- Paste it to the Script Editor in Maya
- Execute the code
- You will be asked to point the location where all the scripts are. You must point to the folder called script inside the uncompressed folder in which you have uncompressed the ZIP file.
- The UI should be created, then you can click on “Instructions” in order to get started as soon as possible.
This method for including the pointed folder as a sys.path for maya to access the files has been adapted from Jared Auty’s wonderful scripting project, which you can download here http://bit.ly/1kDUXhj
It is stated in the Instructions tab inside the Graphics User Interface I build, but I will write it here as well:
- Select the numbers of disks you want to play with.
- Click ‘Place Disks’ first. Then you will see that the disks has been brought to scene.
- Click ‘Solve it!’. A lot of keyframes will appear on your timeline. Furthermore you will be able to see each movement written down if you see the Script Editor window.
- If you want to change the number of disks FIRST CLEAR the scene by pressing ‘Clear All’. If you skip this step you might crash the program.
- Once you are finished press the ‘Exit’ button and it will delete all the elements that have been created for you