HaskellProjects

tower_of_hanoi

A recursive Tower of Hanoi solver implemented in Haskell. This program demonstrates the classic recursive algorithm to move disks between three pegs following the rules of the puzzle.

⚙️ Build & Run

Make sure GHC is installed. To build and execute:

cd tower_of_hanoi
ghc -O2 tower_of_hanoi.hs -o tower_of_hanoi
./tower_of_hanoi <n>

Example:

cd tower_of_hanoi
ghc -O2 tower_of_hanoi.hs -o tower_of_hanoi
./tower_of_hanoi 3

Output:

'A' --> 'C'
'A' --> 'B'
'C' --> 'B'
'A' --> 'C'
'B' --> 'A'
'B' --> 'C'
'A' --> 'C'

Each line represents a single move from one peg to another.

🧩 How It Works

🧠 Notes

🪪 Author

Abhrankan Chakrabarti