-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manual.java
34 lines (27 loc) · 886 Bytes
/
Manual.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
/* 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;
import static ataxx.PieceColor.*;
import static ataxx.Command.Type.*;
/** A Player that receives its moves from its Game's getMoveCmnd method.
* @author P. N. Hilfinger
*/
class Manual extends Player {
/** A Player that will play MYCOLOR on GAME, taking its moves from
* GAME. */
Manual(Game game, PieceColor myColor) {
super(game, myColor);
_prompt = myColor + "> ";
}
@Override
String getMove() {
Game game = game();
Board board = getBoard();
while (true) {
return game.getCommand(_prompt);
}
}
/** The User serving as a source of input commands. */
private String _prompt;
}