rafaelapcruz / Hanoi_Tower

This is an exercise for studying recursion in Python. The Tower of Hanoi is a mathematical puzzle where a stack of n disks on a rod has to be moved to another rod (using the three rods available).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hanoi_Tower

A case study for recursion in Python

Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle 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 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.
3. No disk may be placed on top of a smaller disk.

Source: https://www.geeksforgeeks.org/c-program-for-tower-of-hanoi/

Resources used: - https://en.wikipedia.org/wiki/Recursion_(computer_science)#Recursive_programs - https://en.wikipedia.org/wiki/Tower_of_Hanoi - https://www.youtube.com/watch?v=YstLjLCGmgg (GeeksforGeeks channel)

About

This is an exercise for studying recursion in Python. The Tower of Hanoi is a mathematical puzzle where a stack of n disks on a rod has to be moved to another rod (using the three rods available).


Languages

Language:Python 100.0%