-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrocket.pl
43 lines (39 loc) · 861 Bytes
/
rocket.pl
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
/*
The rocket domain has 3 operators: load, unload, and move.
A piece of cargo can be loaded into a rocket if the rocket and cargo are in the same location.
A rocket may move if it has fuel.
*/
rocket(rocket1).
rocket(rocket2).
place(london).
place(paris).
place(rome).
cargo(a).
cargo(b).
cargo(c).
cargo(d).
plan_operator(move(Rocket,From,To),
[at(Rocket,From), has_fuel(Rocket)],
[at(Rocket, To)],
[at(Rocket,From), has_fuel(Rocket)],
1) :-
rocket(Rocket),
place(From),
place(To),
From \= To.
plan_operator(unload(Rocket, Place, Cargo),
[at(Rocket,Place),in(Cargo,Rocket)],
[at(Cargo,Place)],
[in(Cargo,Rocket)],
1) :-
rocket(Rocket),
cargo(Cargo),
place(Place).
plan_operator(load(Rocket, Place, Cargo),
[at(Rocket,Place),at(Cargo,Place)],
[in(Cargo,Rocket)],
[at(Cargo,Place)],
1) :-
rocket(Rocket),
cargo(Cargo),
place(Place).