-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOthello.java
More file actions
52 lines (42 loc) · 1.35 KB
/
Othello.java
File metadata and controls
52 lines (42 loc) · 1.35 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
/*
* Authors: Wolf Honore, Tyler Trine, Anthony Margetic
* CSC 242 Othello Project Spring 2015
*/
import java.util.Scanner;
/*
* class Othello
* Gets the initial conditions from the interface then enters the game loop
* which consists of alternating between updating the board from the opponents
* turn and making a move.
*/
public class Othello {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Player player;
String move;
char playerString;
int depthLimit;
int timeLimit1;
int timeLimit2;
scan.next();
playerString = scan.next().charAt(0);
depthLimit = scan.nextInt();
timeLimit1 = scan.nextInt();
timeLimit2 = scan.nextInt();
player = new Player(playerString, depthLimit, timeLimit1, timeLimit2);
if (player.color == 'B') { /* Black moves first */
move = player.makeMove();
System.out.println(move);
}
scan.nextLine();
while (scan.hasNextLine()) {
move = scan.nextLine();
if (!move.equals("pass")) {
String[] xy = move.split(" ");
player.update(false, Integer.parseInt(xy[0]), Integer.parseInt(xy[1]));
}
move = player.makeMove();
System.out.println(move);
}
}
}