-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
67 lines (61 loc) · 1.24 KB
/
Copy pathPlayer.java
File metadata and controls
67 lines (61 loc) · 1.24 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
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.awt.Color;
/**
* Represents a
* player in a chess game.
*
* @author Linda Zeng
* @version 4.9.23
*/
public abstract class Player {
private Board board; //board the player is playing in
private String name; //name of player
private Color color; //color player is playing
/**
* Constructs a player with given attributes.
*
* @param boardP board to play on
* @param nameP name of player
* @param colorP color to play
*/
public Player(Board boardP, String nameP, Color colorP)
{
board = boardP;
name = nameP;
color = colorP;
}
/**
* Returns board of player
*
* @return board player is playing on
*/
public Board getBoard()
{
return board;
}
/**
* Returns name of player
*
* @return String name of player
*/
public String getName()
{
return name;
}
/**
* Returns color player
* is on.
*
* @return color of player
*/
public Color getColor()
{
return color;
}
/**
* Returns next move the
* player will play
*
* @return player's next move
*/
public abstract Move nextMove();
}