cdbcfe649480cbad506554074a37e3e984557126
[ker1415-1.git] / report / src / domaintask4.pl
1 % ------------------------- Domain Definition -------------------------
2 % --- Cross-file definitions ------------------------------------------
3 :- multifile connected/3, crate/3, agent/2.
4
5 % --- Primitive control actions ---------------------------------------
6 primitive_action(move(_, _)).
7 primitive_action(push(_, _)).
8
9 % --- Precondition for primitive actions ------------------------------
10 poss(move(From, To), S) :-
11 agent(From, S),
12 connected(From, To, _),
13 not(crate(_, To, S)).
14 poss(push(From, Direction), S) :-
15 agent(From, S),
16 connected(From, CrateLocation, Direction),
17 crate(_, CrateLocation, S),
18 connected(CrateLocation, CrateTarget, Direction),
19 not(crate(_, CrateTarget, S)).
20
21 % --- Successor state axioms ------------------------------------------
22 agent(AgentPlek, result(A, S)) :-
23 A = move(_, AgentPlek);
24 A = push(OudeAgentPlek, Richting),
25 connected(OudeAgentPlek, AgentPlek, Richting);
26 not(A = move(AgentPlek, _)), not(A = push(AgentPlek, _)),
27 agent(AgentPlek, S).
28
29 crate(Krat, Kratplek, result(A, S)) :-
30 A = push(AgentPlek, Richting),
31 connected(AgentPlek, OudeKratPlek, Richting),
32 connected(OudeKratPlek, Kratplek, Richting),
33 crate(Krat, OudeKratPlek, S);
34 not(A = push(AgentPlek2, Richting2)),
35 connected(AgentPlek2, Kratplek, Richting2),
36 crate(Krat, Kratplek, S).