The Tower of Hanoi is a classic mathematical puzzle that involves moving a tower of disks from one rod to another, following certain rules. This Python program provides a graphical representation of the Tower of Hanoi puzzle and allows you to interactively solve it.

The Tower of Hanoi is a puzzle where you have three rods and a number of disks of different sizes that 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. The objective 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 top disk from one of the stacks and placing it on top of another stack or on an empty rod.
- No disk may be placed on top of a smaller disk.
This Python program provides a graphical representation of the Tower of Hanoi puzzle and allows you to solve it using the keyboard. The game also displays move counters and the time it takes to solve the puzzle.
- Run the program using Python.
- The graphical window will display three rods and a set of blue disks.
- Use the keyboard keys 1, 2, and 3 to select the source and destination rods for moving disks.
- Follow the rules of the Tower of Hanoi puzzle to move the disks.
- Press the 'R' key to reset the game at any time.
- Press the 'Q' key to quit the game.
This Tower of Hanoi game was created with the help of the ChatGPT language model by OpenAI and the Arcade library.
- ChatGPT: https://openai.com/
- Arcade Library: https://api.arcade.academy/en/latest/index.html
Special thanks to the contributors of the Arcade library and the developers behind ChatGPT for providing the tools and resources that made this project possible.