this weeks nonsense
[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 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, Direction)).
20
21 % --- Successor state axioms ------------------------------------------
22 agent(AgentPlek, do(A, S)) :-
23 A = move(_, AgentPlek);
24 A = push(OudeAgentPlek1, Richting), connected(OudeAgentPlek1, AgentPlek, Richting);
25 not(A = move(AgentPlek, _)), not(A = push(AgentPlek, _)), agent(AgentPlek, S).
26
27 crate(Krat, Kratplek, do(A, S)) :-
28 A = push(AgentPlek, Richting),
29 connected(AgentPlek, OudeKratPlek, Richting),
30 connected(OudeKratPlek, Kratplek, Richting),
31 crate(Krat, OudeKratPlek, S);
32 not(A = push(AgentPlek2, Richting)), connected(AgentPlek2, Kratplek, Richting), crate(Krat, Kratplek, S).