-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.java
47 lines (38 loc) · 1.16 KB
/
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
39
40
41
42
43
44
45
46
47
/* Skeleton code copyright (C) 2008, 2022 Paul N. Hilfinger and the
* Regents of the University of California. Do not distribute this or any
* derivative work without permission. */
package ataxx;
/** A generic Ataxx Player.
* @author P. N. Hilfinger
*/
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 true iff I am automated. */
boolean isAuto() {
return false;
}
/** Return the game I am playing in. */
Game game() {
return _game;
}
/** Return the board I am playing on. The caller should not modify this
* board. */
Board getBoard() {
return _game.getBoard();
}
/** Return a legal move or command for my side. Assumes that
* board.whoseMove() == myColor() and that the game is not over. */
abstract String getMove();
/** The game I am playing in. */
private final Game _game;
/** The color of my pieces. */
private final PieceColor _myColor;
}