-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMobile.java
63 lines (56 loc) · 1.09 KB
/
Mobile.java
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.sokoban;
/**
*
*/
public abstract class Mobile extends Element {
/**
*
*/
private Configuration config;
/**
*
*/
private Position position;
/**
* @param Type
* @param Configuration
* @param Position
*/
public Mobile(Type type,Configuration conf,Position pos) {
super(type);
this.config = conf;
this.position = pos;
}
/**
* @param Position
* @return
*/
public Boolean setPosition(Position pos) {
Boolean res = false;
if (this.config.get(pos).getType().equals(Type.CASE)){
this.position = pos;
res = true;
}
return res;
}
/**
* @return
*/
public Position getPosition() {
return this.position;
}
/**
* @return the config
*/
public Configuration getConfig() {
return config;
}
public Boolean bougerVers(Direction dir) {
Boolean res = false;
Position nPos = this.position.add(dir);
if (this.config.get(nPos).getType().equals(Type.CASE)){
res = true;
}
return res;
}
}