-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRRSquare.java
78 lines (64 loc) · 1.6 KB
/
RRSquare.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright © 2003, 2011 Bart Massey
* [This program is licensed under the "MIT License"]
* Please see the file COPYING in the source
* distribution of this software for license terms.
*/
/*
* Ricochet Robots Square
* Created on May 31, 2003
*
*/
/**
* @author Bart Massey <[email protected]>
*
*/
public class RRSquare {
public static final int NO_TARGET = -1;
public static final int RED = 0;
public static final int YELLOW = 1;
public static final int GREEN = 2;
public static final int BLUE = 3;
public static final int WHIRLPOOL = 4;
public static final int NO_ROBOT = -1;
public static final String[] colorname = {
"red", "yellow", "green", "blue", "whirlpool"
};
/* see above */
int target = NO_TARGET;
/* R, Y, G, B */
int robot = NO_ROBOT;
/* N, E, S, W */
boolean[] wall = {false, false, false, false};
/* Is this the goal square? */
boolean primary_target = false;
public void setTarget(int t) {
target = t;
}
public void setTarget(int t, boolean primary) {
target = t;
primary_target = primary;
}
public int getTarget() {
return target;
}
public boolean isPrimaryTarget() {
return primary_target;
}
public int getRobot() {
return robot;
}
public void setRobot(int r) {
robot = r;
}
public void clearRobot() {
robot = NO_ROBOT;
}
public boolean getWall(int w) {
return wall[w];
}
/* XXX can't remove walls for now */
public void setWall(int w) {
wall[w] = true;
}
}