-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAntiMove.java
More file actions
59 lines (56 loc) · 1.96 KB
/
AntiMove.java
File metadata and controls
59 lines (56 loc) · 1.96 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
package ChessBot;
import java.util.HashSet;
public class AntiMove {
private int takenPiece;
private int prevEnPassantTarget;
private boolean prevWhiteKingside;
private boolean prevWhiteQueenside;
private boolean prevBlackKingside;
private boolean prevBlackQueenside;
private boolean prevWhiteCheck;
private boolean prevBlackCheck;
private HashSet<Integer> whiteAttackedSquares;
private HashSet<Integer> blackAttackedSquares;
public AntiMove(int taken, int enPassant, boolean whiteKingside, boolean whiteQueenside, boolean blackKingside, boolean blackQueenside, HashSet<Integer> whiteAttackSquares, HashSet<Integer> blackAttackSquares, boolean whiteCheck, boolean blackCheck) {
takenPiece = taken;
prevEnPassantTarget = enPassant;
prevWhiteKingside = whiteKingside;
prevWhiteQueenside = whiteQueenside;
prevBlackKingside = blackKingside;
prevBlackQueenside = blackQueenside;
whiteAttackedSquares = whiteAttackSquares;
blackAttackedSquares = blackAttackSquares;
prevWhiteCheck = whiteCheck;
prevBlackCheck = blackCheck;
}
public int getTakenPiece() {
return takenPiece;
}
public int getPrevEnPassantTarget() {
return prevEnPassantTarget;
}
public boolean getPrevWhiteKingside() {
return prevWhiteKingside;
}
public boolean getPrevWhiteQueenside() {
return prevWhiteQueenside;
}
public boolean getPrevBlackKingside() {
return prevBlackKingside;
}
public boolean getPrevBlackQueenside() {
return prevBlackQueenside;
}
public HashSet<Integer> getAttackedSquares(boolean checkForWhite) {
if (checkForWhite) {
return whiteAttackedSquares;
}
return blackAttackedSquares;
}
public boolean wasCheck(boolean checkForWhite) {
if (checkForWhite) {
return prevWhiteCheck;
}
return prevBlackCheck;
}
}