-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPiece.java
More file actions
90 lines (66 loc) · 1.62 KB
/
Copy pathPiece.java
File metadata and controls
90 lines (66 loc) · 1.62 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
public class Piece
/* This is the Piece class, which is the type of object that each piece on the board is. The Piece class only holds two properties, the type of piece, and the team the piece
is on. */
{
private String team;
private String type;
public Piece(String pieceType, String pieceTeam)
{
team = pieceTeam;
type = pieceType;
}
public String getType()
{
return this.type;
}
public String getTeam()
{
return this.team;
}
public String toString()
{
String fullTeam = "x";
String fullType = "y";
if (this.type.equals("P"))
{
fullType = "Pawn";
}
if (this.type.equals("R"))
{
fullType = "Rook";
}
if (this.type.equals("k"))
{
fullType = "Knight";
}
if (this.type.equals("B"))
{
fullType = "Bishop";
}
if (this.type.equals("Q"))
{
fullType = "Queen";
}
if (this.type.equals("K"))
{
fullType = "King";
}
if (this.type.equals("N"))
{
fullType = "Empty Space";
}
if (this.team.equals("W"))
{
fullTeam = "White";
}
if (this.team.equals("B"))
{
fullTeam = "Black";
}
if (this.team.equals("N"))
{
fullTeam = "None";
}
return fullType +" on team "+fullTeam+".";
}
}