, , , , . , ( adds, deletes can). , 17.1 , :
can(move< Block, From, ), [ clear{ Block), clear{ To), on (Block, From)]):-block{ Block},
□bj ect ),
, block (Block), . , . , , . 17.1, clear (). achieves clear; ): move) Something, a, Somewhere)
: can(move(Something, a, Somewhere), Condition)
, , Something Somewhere. , , : move(b, , 1) move(b, a, 2) move! b, £, 3) move(b, a, 4) move! b, a, c) move [ c, a, 1) move (c, a, 2)
, , . , : (rr,ove(Block, From, To), [ clear (Block;, clear I To}, or. (Block, From)]).
, . 17.1, clear(). s achieves : nove(something, a, Somewhere)
- : [ clear< something), clear! Somewhere), on(Something, a)]
, , , . , :
Something = Somewhere = 2
II. Prolog
, - , , . , , . , , 17.1, , , .
|
|
, . . , , , , . 17.1, : move (, , )
, ! , , . .
can(move (Block, From, To),
[ Clear! Block), clear (TO}, on{ Block, From), different (BlOCk, To), different! From, To), different; Block, From)]).
different) X, Y) , X Y . different; X, Y) . - , . satisfied, :
satisfied! State, [Goal [ Goals]);-holds (Goal), % Goal or State satisfied! Goals)
, , different [ X, Y), holds : holds! different (X, Y))
.
X Y , different (X, Y) .
X Y (X == Y), , , , impossible.
(X Y , ) , . , , , X Y .
, , different; X, Y), , . plan , .
17.
, . , : move (, 1, X)
clear (b)? , X = , , different(X, b). , : X , different(X, Y).
|
|
, , , . , . 17.4, , . , :
Planl = | [ move ( | b, | , | ), | move | a, | 1, | b) |
12 = | [ move( | , | d, | t), | move ( | d, | 8, | a)] |
.';
f d
__ i____ i____ I_____ i____ i____ i____ i__
L
1234S678 1 3 4 5 S 7 8
. 17.4, ,
, . , , : Planl, Flan2, 12, Planl, , . , . 1 move! ), move! , d, f}, move; d, 8, e), move (a, 1, b) ]
, 24 , , , : , . , . , - , . , , . , , ( ).
, , . 17.1. , .
II. Prolog
on (a, b) on (b, ), , :
Ml = move (a, X, b} 2 = move (b, Y, )
. , , . . move (, X, } clear (]. , - :
= move! II, , V)
Ml, : before (, !)
, 2 , . , . , [ Ml, M2, ], Ml, . , :
|
|
[ , Ml, 2]
[ , 2, Hi]
(2, , Ml]
, , , : = , V - 2, X = 1, Y = 3. , , .
, , , . . 17.5 , . , . , , , , . , , : , , , . , .
, 17.1, , . , look; Position, Object) , Position (.. object). , , , . , (-
17.
, , , , ). .
, 17.5, , , , 17.7.1.
, 17.7.2.
If
>■
0 1 2 3 4 5 6
, 17.5. : { , ), (, ), on (, d)
, . , , : (, ) (, ).
, .
|
|
, .
. : , .
, , , , , , .
, , , . .
, , , .
II. Prolog
, . , ,
:
, , ;
;
;
;
.