Question: using prolog to write this function. write a function, ionah, that takes a single number as input and prints out the solution to the inverted

using prolog to write this function.

write a function, ionah, that takes a single number as input and prints out the solution to the inverted disk problem for that many disks. This is the problem of moving a stack of k disks of increasing size from bottom to top, from the first peg to the third peg with another peg that may be used as well, subject to the condition that a smaller disk is never put on top of a larger one, and only one disk may be moved at a time. Here is a sample run:

?- ionah(3).

move disk from peg 1 to peg 3

move disk from peg 1 to peg 2

move disk from peg 3 to peg 2

move disk from peg 1 to peg 3

move disk from peg 2 to peg 1

move disk from peg 2 to peg 3

move disk from peg 1 to peg 3

Yes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!