-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
47 lines (40 loc) · 1.08 KB
/
Copy pathPlayer.java
File metadata and controls
47 lines (40 loc) · 1.08 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
/**
* Player is an abstract class to capture the general idea of a player.
*/
public abstract class Player {
protected String name;
protected Token token;
/**
* Constructor to be used by subclasses to populate name and token
*
* @param name is the name of the player
* @param token is the token associated with the player
*/
public Player(String name, Token token) {
this.name = name;
this.token = token;
}
/**
* @return name of the player
*/
public String getName() {
return name;
}
/**
* @return token associated with the player
*/
public Token getToken() {
return token;
}
/**
* getMove is an abstract method to be implemented by subclasses i.e. HumanPlayer and ComputerPlayer
*
* @param column is the total number of columns in board
* @return input recieved from player
*/
abstract String getMove(int column);
@Override
public String toString() {
return "Player [name=" + name + ", token=" + token + "]";
}
}