Question: ower of Hanoi: ( 1 0 Points ) Program the Tower of Hanoi puzzle. You must use a , b , c as your peg
ower of Hanoi: Points
Program the Tower of Hanoi puzzle. You must use a b c as your peg names. Your output should
be a bunch of move statements like move a to bwhich means moving the top disk from peg a
to peg b You can use Prolog's write predicate to output a string or a variable to the screen. The
nl predicate outputs a newline to screen.
Note: The goal predicate will take the form:
hanoiX a c b
where X is a variable the number of discs
Sample Run:
hanoiacb
Move a to c
Move a to b
Move c to b
Move a to c
Move b to a
Move b to c
Move a to c
File Name: hanoi.pl
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
