GigaProjects

← Back to Projects

tower-of-hanoi

A python command-line implementation of the classic Tower of Hanoi game.

File Browser:

README

Tower of Hanoi

A python command-line implementation of the classic Tower of Hanoi game.

How to Run

Open your terminal or command prompt and run:

python hanoi.py

(If that doesn't work, try python3 hanoi.py)

How to Play

  1. Select number of rings (1-10)
  2. Move all rings from Tower A to Tower D
  3. Use two-letter commands to move rings:
    • AS - move from A to S
    • AD - move from A to D
    • SD - move from S to D
    • etc.

Special commands: - Q - Quit - R - Restart

Rules

  • Only one ring can be moved at a time
  • A ring can only be placed on top of a larger ring
  • You can use Tower S as an auxiliary tower

Good luck!