forked from steger/pr3-sose2026
|
|
||
|---|---|---|
| .. | ||
| README.md | ||
| hanoi.hs | ||
README.md
Assignment - Tower of Hanoi
The Tower of Hanoi is a classic mathematical puzzle that involves three rods and a number of disks of different sizes. The puzzle starts with all the disks stacked in ascending order of size on one rod (the source rod), with the smallest disk on top. The objective is to move the entire stack to another rod (the destination rod), following these rules:
- Only one disk can be moved at a time.
- Each move consists of taking the top disk from one rod and placing it on another rod.
- No disk may be placed on top of a smaller disk.
Your task:
Implement a function that solves the Tower of Hanoi problem for n disks. The rods are represented as Chars (e.g. 'a','b','c'). The result shall be a list of moving instructions. Add your implementation to the file 04-hanoi/hanoi.hs that already contains a test and a helper function that creates the move instruction for a single move.