-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBead.java
97 lines (89 loc) · 2.1 KB
/
Bead.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
public class Bead implements Beadlike
{
private static int numWhite;
private static int numBlack;
private PlayerColour colour;
private int beadId;
private int xCoord;
private int yCoord;
private int zCoord;
private boolean isEmpty;
/**
* Contructs a bead.
* @param c The colour of the Player that the bead belongs to.
* @param x Represents the x position of the Peg the bead will be on.
* @param y Represents the x position of the Peg the bead will be on.
* @param z Represents the x position of the Peg the bead will be on.
*/
public Bead(PlayerColour c, int x, int y, int z)
{
Debug.log("Creating bead at: (x: " + x + ", y: " + y +", z: " + z + ")");
if (c == PlayerColour.WHITE)
{
colour = PlayerColour.WHITE;
beadId = numWhite + 1;
isEmpty = false;
numWhite++;
}
else
{
colour = PlayerColour.BLACK;
beadId = numBlack + 1;
isEmpty = false;
numBlack++;
}
Debug.log("Number of white beads: " + numWhite);
Debug.log("Number of black beads: " + numBlack);
Debug.log("PlayerColour: " + colour);
Debug.log("Bead Id: " + beadId);
}
/**
* Gets colour.
* @return Returns the PlayerColour of the bead.
*/
public PlayerColour getColour()
{
return colour;
}
/**
* Gets bead ID.
* @return Returns the BeadId of the bead.
*/
public int getId()
{
return beadId;
}
/**
* Gets x coordinate (row).
* @return Returns an integer of the x coordinate of the bead.
*/
public int getXCoord()
{
return xCoord;
}
/**
* Gets y coordinate (column).
* @return Returns an integer of the y coordinate of the bead.
*/
public int getYCoord()
{
return yCoord;
}
/**
* Gets z coordnate (height).
* @return Returns an integer of the z coordinate of the bead.
*/
public int getZCoord()
{
return zCoord;
}
/**
* Gets whether the bead is empty or not.
* Only the EmptyBead class will have this true.
* @return Returns whether the bead in this position is empty or not.
*/
public boolean isEmpty()
{
return isEmpty;
}
}