-
Notifications
You must be signed in to change notification settings - Fork 2
/
Position.java
55 lines (42 loc) · 927 Bytes
/
Position.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
public class Position {
/* a simple class to describe a
* position on a backgammon board.
* each position object only needs
* to store the number of checkers
* it contains, and their color,
* since it's impossible for a
* single position to contain checkers
* of different colors in this game */
private int color;
private byte numOfPills;
public Position() {
this.numOfPills = 0;
this.color = 0;
}
public Position(int col, byte numP) {
this.color = col;
numOfPills = numP;
}
public Position(Position pos) {
this.color = pos.color;
this.numOfPills = pos.numOfPills;
}
public void incr() {
this.numOfPills++;
}
public void decr() {
this.numOfPills--;
}
public int getCol(){
return color;
}
public void setCol(int col) {
this.color = col;
}
public byte getNum() {
return numOfPills;
}
public void setNum(byte num) {
this.numOfPills = num;
}
}