Page 1 of 1

Towers of Hanoi (Tower of Hanoi - Wikipedia) is a puzzle consisting of three rods and a number of disks of various diame

Posted: Wed Apr 27, 2022 3:06 pm
by answerhappygod
Towers of Hanoi (Tower of Hanoi - Wikipedia) is a puzzle
consisting of three rods and a number of disks of various
diameters, which can slide onto any rod as shown in Figure 1. The
puzzle begins with the disks stacked on one rod in order of
decreasing size, the smallest at the top, thus approximating a
conical shape. The objective of the puzzle is to move the entire
stack to the last rod, obeying the following rules:
1. Only one disk may 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 or on an empty
rod.
3. No disk may be placed on top of a disk that is smaller than
it.
----------------------------------------------------------------------------------------
In this assignment, we aim to solve the Towers of Hanoi problem
of 6 disks, though your final algorithm will most likely be capable
of solving more complex versions. Students are required to solve
the problem using TWO search algorithms to achieve the objective:
(1) a blind (Breadth-First) search and (2) a heuristic (A*) search
algorithms.
treat the disks individually, defining a Disk class to store
their diameter, current rod, and the index in that rod.
Disk Class:
Diameter
Number of Rod
Index on the Rod
Step 2 – Coding Python
As previously discussed, your program must be capable of solving
the problem of any number of disks. Consequently, at the start of
the program execution, the integer N should be taken as an
input.
Your final code must implement both Breadth-First Search and A*
Search solutions. Similar to your work solving the 8-Puzzle with
BFS and A*, both algorithms should be implemented into the same
file.
The output of your program should contain (1) a count of the
total number of steps to be taken to reach the goal; and (2) a path
list showing the disk positions at each level of the search.