-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.java
32 lines (28 loc) · 878 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
import java.util.Scanner;
class Player
{
public Player()
{
}
public Board move (Board board)
{
Scanner scan = new Scanner(System.in);
System.out.print("MOVE: (eg'x y', 0 <= x/y <= 2)\n");
String move = scan.nextLine();
scan = new Scanner(move);
int x = Integer.parseInt(scan.next());
int y = Integer.parseInt(scan.next());
while (board.map[y][x] != ' ')
{
scan = new Scanner(System.in);
System.out.print("Unavailable move.\nMOVE: (eg'x y', 0 <= x/y <= 2)\n");
move = scan.nextLine();
scan = new Scanner(move);
x = Integer.parseInt(scan.next());
y = Integer.parseInt(scan.next());
}
board.addMove(x, y, 'X');
//to be implimementededed
return board;
}
}