Skip to content

IgorNascAlves/Tower-of-Hanoi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tower of Hanoi Game

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.

tower_hanoi

Table of Contents

Description

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:

  1. Only one disk can be moved at a time.
  2. 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.
  3. 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.

How to Use

  1. Run the program using Python.
  2. The graphical window will display three rods and a set of blue disks.
  3. Use the keyboard keys 1, 2, and 3 to select the source and destination rods for moving disks.
  4. Follow the rules of the Tower of Hanoi puzzle to move the disks.
  5. Press the 'R' key to reset the game at any time.
  6. Press the 'Q' key to quit the game.

Credits

This Tower of Hanoi game was created with the help of the ChatGPT language model by OpenAI and the Arcade library.

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages