initial double step
This commit is contained in:
parent
9e15058fb8
commit
ccd3dacaed
|
|
@ -423,6 +423,13 @@ private ArrayList<int[]> computeLegalMoves(Piece piece) {
|
||||||
// Move forward if square is empty
|
// Move forward if square is empty
|
||||||
if (isEmpty(x, nextY)) {
|
if (isEmpty(x, nextY)) {
|
||||||
moves.add(new int[]{x, nextY});
|
moves.add(new int[]{x, nextY});
|
||||||
|
|
||||||
|
// Check for first move double step
|
||||||
|
int startRow = piece.isWhite()? 1:6;
|
||||||
|
int twoStepsY = y + 2 * dir;
|
||||||
|
if (y== startRow && isEmpty(x,twoStepsY)) {
|
||||||
|
moves.add(new int[] {x, twoStepsY});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Diagonal capture
|
// Diagonal capture
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue