-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.java
38 lines (30 loc) · 836 Bytes
/
Player.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
package ataxx;
/** A generic Ataxx Player.
* @author Aaron Lee
*/
abstract class Player {
/** A Player that will play MYCOLOR in GAME. */
Player(Game game, PieceColor myColor) {
_game = game;
_myColor = myColor;
}
/** Return my pieces' color. */
PieceColor myColor() {
return _myColor;
}
/** Return the game I am playing in. */
Game game() {
return _game;
}
/** Return a view of the board I am playing on. */
Board board() {
return _game.board();
}
/** Return a legal move for me. Assumes that
* board.whoseMove() == myColor and that !board.gameOver(). */
abstract Move myMove();
/** The game I am playing in. */
private final Game _game;
/** The color of my pieces. */
private final PieceColor _myColor;
}