20f6593af9bdcc4bc8b290a923e4eb259f0ddcad
[ker1415-1.git] / report / src / domaintask1.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
15 poss(push(From, Direction), S) :-
16 agent(From, S),
17 connected(From, CrateLocation, Direction),
18 crate(_, CrateLocation, S),
19 connected(CrateLocation, CrateTarget, Direction),
20 not(crate(_, CrateTarget, S)).
21
22 % --- Successor state axioms ------------------------------------------
23 agent(AgentPlek, result(A, S)) :-
24 A = move(_, AgentPlek);
25 A = push(OudeAgentPlek, Richting),
26 connected(OudeAgentPlek, AgentPlek, Richting);
27 not(A = move(AgentPlek, _)), not(A = push(AgentPlek, _)),
28 agent(AgentPlek, S).
29
30 crate(Krat, Kratplek, result(A, S)) :-
31 A = push(AgentPlek, Richting),
32 connected(AgentPlek, OudeKratPlek, Richting),
33 connected(OudeKratPlek, Kratplek, Richting),
34 crate(Krat, OudeKratPlek, S);
35 not(A = push(AgentPlek2, Richting2)),
36 connected(AgentPlek2, Kratplek, Richting2),
37 crate(Krat, Kratplek, S).