- // Captures
- const shiftX = -1;
- for (let shiftY of [-1, 1]) {
- if (
- V.OnBoard(x + shiftX, y + shiftY) &&
- this.board[x + shiftX][y + shiftY] != V.EMPTY &&
- this.canTake([x, y], [x + shiftX, y + shiftY])
- ) {
- moves.push(this.getBasicMove([x, y], [x + shiftX, y + shiftY]));
+ // Captures (in both directions)
+ for (let shiftX of [-1, 1]) {
+ for (let shiftY of [-1, 1]) {
+ if (
+ V.OnBoard(x + shiftX, y + shiftY) &&
+ this.board[x + shiftX][y + shiftY] != V.EMPTY &&
+ this.canTake([x, y], [x + shiftX, y + shiftY])
+ ) {
+ moves.push(this.getBasicMove([x, y], [x + shiftX, y + shiftY]));
+ }