-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMove.java
More file actions
140 lines (110 loc) · 3.66 KB
/
Move.java
File metadata and controls
140 lines (110 loc) · 3.66 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// one origin square, one destination square
public class Move {
private long origin;
private long destination;
private PieceName pieceType;
private PieceName capture;
// for tracking castling
private long rookOriginCastling;
private long rookDestinationCastling;
private boolean revokedCastleRights; // did this move revoke the side's castling rights?
private boolean firstKingsideRookMove; // was this the first time the kingside rook moved?
private boolean firstQueensideRookMove;
private boolean castle;
private boolean enPassant;
private long enPassantTarget = 0L; // the location of the en passant target when this move was made
// pawn move that promotes to this piece
private boolean promotion = false;
private PieceName promotionPiece;
// track what the move count towards a draw was when the move was made
private int moveCountDraw;
Move(PieceName pieceType, long origin, long destination) {
this.pieceType = pieceType;
this.origin = origin;
this.destination = destination;
}
Move(PieceName pieceType, long origin, long destination, PieceName promotion) {
this.pieceType = pieceType;
this.origin = origin;
this.destination = destination;
this.promotion = true;
this.promotionPiece = promotion;
}
Move(PieceName pieceType, long origin, long destination, long rookOriginCastling, long rookDestinationCastling) {
this.pieceType = pieceType;
this.origin = origin;
this.destination = destination;
this.rookOriginCastling = rookOriginCastling;
this.rookDestinationCastling = rookDestinationCastling;
this.castle = true;
}
public long getOrigin() {
return this.origin;
}
public long getDestination() {
return this.destination;
}
public PieceName getCapture() {
return this.capture;
}
public PieceName getPieceType() {
return this.pieceType;
}
public long getRookOriginCastling() {
return this.rookOriginCastling;
}
public long getRookDestinationCastling() {
return this.rookDestinationCastling;
}
public boolean getRevokedCastleRights() {
return this.revokedCastleRights;
}
public boolean getFirstKingsideRookMove() {
return this.firstKingsideRookMove;
}
public boolean getFirstQueensideRookMove() {
return this.firstQueensideRookMove;
}
public long getEnPassantTarget() {
return this.enPassantTarget;
}
public boolean getEnPassant() {
return this.enPassant;
}
public boolean checkCastle() {
return this.castle;
}
public boolean getPromotion() {
return this.promotion;
}
public PieceName getPromotionPiece() {
return this.promotionPiece;
}
public int getMoveCountDraw() {
return this.moveCountDraw;
}
public void setCapture(PieceName capture) {
this.capture = capture;
}
public void setRevokedCastleRights(boolean set) {
this.revokedCastleRights = set;
}
public void setFirstKingsideRookMove(boolean set) {
this.firstKingsideRookMove = set;
}
public void setFirstQueensideRookMove(boolean set) {
this.firstQueensideRookMove = set;
}
public void setCastle(boolean set) {
this.castle = set;
}
public void setEnPassantTarget(long target) {
this.enPassantTarget = target;
}
public void setEnPassant(boolean set) {
this.enPassant = set;
}
public void setMoveCountDraw(int moveCountDraw) {
this.moveCountDraw = moveCountDraw;
}
}