-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPush.java
More file actions
28 lines (23 loc) · 692 Bytes
/
Push.java
File metadata and controls
28 lines (23 loc) · 692 Bytes
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
public class Push extends Action{
private String pushFrom;
private String pushTo;
public Push(String to, String from){
this.operatorName = "PUSH";
this.pushFrom = from;
this.pushTo = to;
}
public boolean checkPreconditions(WorldState worldState) {
if(!worldState.isMonkeyAt(pushFrom)){
return false;
}
if(!worldState.isMonkeyHeight(WorldState.HEIGHT_LOW)){
return false;
}
return true;
}
public WorldState applyPostconditions(WorldState worldState) {
//create and return a new WorldState
//with the monkey’s updated location
return null;
}
}