-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandLineDomineering.java
More file actions
54 lines (44 loc) · 1.29 KB
/
CommandLineDomineering.java
File metadata and controls
54 lines (44 loc) · 1.29 KB
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
public class CommandLineDomineering {
private static class CommandLineDomi implements MoveChannel<DomineeringMove>{
/**
* read move from the command line
*/
@Override
public DomineeringMove getMove() {
System.out.println("Enter your move: ");
int x1 = Integer.parseInt(System.console().readLine());
int y1 = Integer.parseInt(System.console().readLine());
int x2 = Integer.parseInt(System.console().readLine());
int y2 = Integer.parseInt(System.console().readLine());
return new DomineeringMove(x1, y1, x2, y2);
}
/**
* Print the move the program played
*/
@Override
public void giveMove(DomineeringMove move) {
System.out.println("I play " + move);
}
/**
* The game ends with a winner
*/
@Override
public void end(int Value) {
System.out.println("Game over. The result is " + Value);
}
/**
* Print the board
*/
@Override
public void comment(String msg) {
System.out.println(msg);
}
}
public static void main(String[] args) {
//DomineeringBoard board = new DomineeringBoard();
DomineeringBoard2 board2 = new DomineeringBoard2(8, 8);
//board.tree().firstPlayer(new CommandLineDomi());
//board2.tree().secondPlayer(new CommandLineDomi());
board2.heuristicTree(2).secondPlayer(new CommandLineDomi());
}
}