-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr1.asl
48 lines (34 loc) · 767 Bytes
/
r1.asl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// mars robot 1
/* Initial beliefs */
at(P) :- pos(P,X,Y) & pos(r1,X,Y).
/* Initial goal */
!check(slots).
/* Plans */
+!check(slots) : not garbage(r1)
<- next(slot);
!check(slots).
+!check(slots).
@lg[atomic]
+garbage(r1) : not .desire(carry_to(r2))
<- !carry_to(r2).
+!carry_to(R)
<- // remember where to go back
?pos(r1,X,Y);
-+pos(last,X,Y);
// carry garbage to r2
!take(garb,R);
// goes back and continue to check
!at(last);
!check(slots).
+!take(S,L) : true
<- !ensure_pick(S);
!at(L);
drop(S).
+!ensure_pick(S) : garbage(r1)
<- pick(garb);
!ensure_pick(S).
+!ensure_pick(_).
+!at(L) : at(L).
+!at(L) <- ?pos(L,X,Y);
move_towards(X,Y);
!at(L).