1 % ------------------------- Domain Definition
-------------------------
2 % --- Cross
-file definitions
------------------------------------------
3 :- multifile connected
/3, crate/4, agent
/2, key/3.
5 % --- Primitive control actions
---------------------------------------
6 primitive_action
(move
(_
, _
)).
7 primitive_action
(push(_
, _
)).
8 primitive_action
(pickup
(_
)).
10 % --- Precondition
for primitive actions
------------------------------
11 poss
(move
(From
, To
), S
) :-
13 connected
(From
, To
, _
),
14 not(crate
(_
, _
, To
, S
)).
16 poss
(push(From
, Direction
), S
) :-
18 connected
(From
, CrateLocation
, Direction
),
19 crate
(_
, Key
, CrateLocation
, S
),
21 connected
(CrateLocation
, CrateTarget
, Direction
),
22 not(crate
(_
, _
, CrateTarget
, S
)).
24 poss
(pickup
(CurrentLocation
), S
) :-
25 agent
(CurrentLocation
, S
),
26 key
(_
, CurrentLocation
, S
).
28 % --- Successor
state axioms
------------------------------------------
29 agent
(AgentPlek
, result
(A
, S
)) :-
30 A
= move
(_
, AgentPlek
);
31 A
= push(OudeAgentPlek
, Richting
),
32 connected
(OudeAgentPlek
, AgentPlek
, Richting
);
33 not(A
= move
(AgentPlek
, _
)), not(A
= push(AgentPlek
, _
)),
36 crate
(Krat
, _
, Kratplek
, result
(A
, S
)) :-
37 A
= push(AgentPlek
, Richting
),
38 connected
(AgentPlek
, OudeKratPlek
, Richting
),
39 connected
(OudeKratPlek
, Kratplek
, Richting
),
40 crate
(Krat
, _
, OudeKratPlek
, S
);
41 not(A
= push(AgentPlek2
, Richting2
)),
42 connected
(AgentPlek2
, Kratplek
, Richting2
),
43 crate
(Krat
, _
, Kratplek
, S
).
45 key
(Key
, Location
, result
(A
, S
)) :-
46 not(A
= pickup
(Location
)), key
(Key
, Location
, S
).
48 keyinbag
(Key
, result
(A
, S
)) :-
49 agent
(CurrentLocation
, S
),
50 A
= pickup
(CurrentLocation
),
51 key
(Key
, CurrentLocation
, S
);