-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHumanPlayer.java
More file actions
37 lines (33 loc) · 984 Bytes
/
Copy pathHumanPlayer.java
File metadata and controls
37 lines (33 loc) · 984 Bytes
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
import java.io.BufferedReader;
import java.io.IOException;
/**
* HumanPlayer is a concrete class representing human player
*/
public class HumanPlayer extends Player {
private BufferedReader reader = new BufferedReader(new java.io.InputStreamReader(System.in));
/**
* Constructore for creating human object
*
* @param name is the name of player
* @param token is the token associated with the player and used for rendering
*/
public HumanPlayer(String name, Token token) {
super(name, token);
}
/**
* getMove method gets input from human player
*
* @param column is the total number of column in the board
* @return input recieved from human player.
*/
@Override
String getMove(int column) {
String move = "";
try {
move = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return move;
}
}