Question: Question Modify your program to use CLP (blocks3.pl). PART3 - Prolog - Blocks World. For a base, you should begin with a simple prolog code

 Question Modify your program to use CLP (blocks3.pl). PART3 - Prolog- Blocks World. For a base, you should begin with a simpleprolog code for simple blocks world at the end of this part.

Question

Modify your program to use CLP (blocks3.pl).

PART3 - Prolog - Blocks World. For a base, you should begin with a simple prolog code for simple blocks world at the end of this part. Also you may use the code segment for your work: https://www.cpp.edu/-irfisher/www/prolog tutorial/2 19.html Consider a table with three distinct positions (table(i) where i is 1,2,3). On the table are a number of blocks which may be stacked on top of each other. The aim is to move the blocks from a given start-state to a goal-state. Only blocks which are free (that is, with no other block on top of them) can be moved. The first step is to determine how to represent the state. A reasonable solution is to use a ternary functor state3 to represent the three positions of the table. Furthermore, use the constant table to denote the table. Finally represent by on(X, Y) the fact that X is positioned on top of Y. That is, state(on(c, on(b, on(a, table), table, table) represents the state Initial State Goal State * All possible actions that transform a state are follows if the first position is nonempty, the topmost block can be moved to either the second or the third position; if the second position is nonempty the topmost block can be moved to either the first or the third position; if the third position is nonempty the topmost block can be moved to either the first or the second position The first action may be formalized as follows move(state(on(M, X), Y, Z), state (X, on(M, Y), Z) move(state(on(M, X), Y, Z), state(X, Y, on(M, Z))) PART3 - Prolog - Blocks World. For a base, you should begin with a simple prolog code for simple blocks world at the end of this part. Also you may use the code segment for your work: https://www.cpp.edu/-irfisher/www/prolog tutorial/2 19.html Consider a table with three distinct positions (table(i) where i is 1,2,3). On the table are a number of blocks which may be stacked on top of each other. The aim is to move the blocks from a given start-state to a goal-state. Only blocks which are free (that is, with no other block on top of them) can be moved. The first step is to determine how to represent the state. A reasonable solution is to use a ternary functor state3 to represent the three positions of the table. Furthermore, use the constant table to denote the table. Finally represent by on(X, Y) the fact that X is positioned on top of Y. That is, state(on(c, on(b, on(a, table), table, table) represents the state Initial State Goal State * All possible actions that transform a state are follows if the first position is nonempty, the topmost block can be moved to either the second or the third position; if the second position is nonempty the topmost block can be moved to either the first or the third position; if the third position is nonempty the topmost block can be moved to either the first or the second position The first action may be formalized as follows move(state(on(M, X), Y, Z), state (X, on(M, Y), Z) move(state(on(M, X), Y, Z), state(X, Y, on(M, Z)))

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!