-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMove.java
54 lines (47 loc) · 1.4 KB
/
Move.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
package MKAgent;
/**
* Represents a move (not a turn) in the Kalah game.
*/
public class Move {
/**
* The side of the board the player making the move is playing on.
*/
private Side side;
/**
* The hole from which seeds are picked at the beginning of the move and
* distributed. It has to be >= 1.
*/
private int hole;
/**
* @param side The side of the board the player making the move is playing
* on.
* @param hole The hole from which seeds are picked at the beginning of
* the move and distributed. It has to be >= 1.
* @throws IllegalArgumentException if the hole number is not >= 1.
*/
public Move(Side side, int hole) throws IllegalArgumentException {
if (hole < 1)
throw new IllegalArgumentException("Hole numbers must be >= 1, but " + hole + " was given.");
this.side = side;
this.hole = hole;
}
/**
* @return The side of the board the player making the move is playing on.
*/
public Side getSide() {
return side;
}
public void setSide(Side side) {
this.side = side;
}
/**
* @return The hole from which seeds are picked at the beginning of the
* move and distributed. It will be >= 1.
*/
public int getHole() {
return hole;
}
public void setHole(int hole) {
this.hole = hole;
}
}