-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathField.java
More file actions
52 lines (45 loc) · 1.01 KB
/
Copy pathField.java
File metadata and controls
52 lines (45 loc) · 1.01 KB
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
public class Field
{
private int xCord;
private int yCord;
public static final int EMPTY = 0;
public static final int FOOD = 1;
public static final int BODY = 2;
public static final int FEDBODY = 3;
public static final int HEAD = 4;
public static final int TAIL = 5;
public static final int EATING = 6;
private boolean [] properties = {true, false, false, false, false, false, false};
public Field(int x, int y)
{
xCord = x;
yCord = y;
}
public int getxCord()
{
return xCord;
}
public int getyCord()
{
return yCord;
}
public int getProperty()
{
for (int i=0; i<properties.length; i++)
{
if (properties[i])
{
return i;
}
}
return 0;
}
public void setProperty(int name)
{
for (int i=0; i<properties.length; i++)
{
properties[i] = false;
}
properties[name] = true;
}
}