Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

The nature and importance of the global marketplace.

Answered: 1 week ago