X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSittuyin.js;h=61bab569fdc0714a61b2d8a7e873f3ee53dcc792;hp=f37eabf3a2a56c5cdd5ff7b15652a642965d1186;hb=107dc1bd5361e2538b1551bdcc37c1e90a444b83;hpb=0e0010227e46acb7774d134c9aa345eaa0c4404d diff --git a/client/src/variants/Sittuyin.js b/client/src/variants/Sittuyin.js index f37eabf3..61bab569 100644 --- a/client/src/variants/Sittuyin.js +++ b/client/src/variants/Sittuyin.js @@ -10,12 +10,22 @@ export class SittuyinRules extends ChessRules { return false; } + static get Monochrome() { + return true; + } + + static get Lines() { + return ChessRules.Lines.concat([ + [[0, 0], [8, 8]], + [[0, 8], [8, 0]] + ]); + } + static get PawnSpecs() { return Object.assign( {}, ChessRules.PawnSpecs, { - twoSquares: false, // Promotions are handled differently here promotions: [V.QUEEN] } @@ -119,29 +129,20 @@ export class SittuyinRules extends ChessRules { getPotentialPawnMoves([x, y]) { const color = this.turn; - const [sizeX, sizeY] = [V.size.x, V.size.y]; const shiftX = V.PawnSpecs.directions[color]; let moves = []; - // NOTE: next condition is generally true (no pawn on last rank) - if (x + shiftX >= 0 && x + shiftX < sizeX) { - if (this.board[x + shiftX][y] == V.EMPTY) { + if (x + shiftX >= 0 && x + shiftX < 8) { + if (this.board[x + shiftX][y] == V.EMPTY) // One square forward moves.push(this.getBasicMove([x, y], [x + shiftX, y])); - } // Captures - if (V.PawnSpecs.canCapture) { - for (let shiftY of [-1, 1]) { - if ( - y + shiftY >= 0 && - y + shiftY < sizeY - ) { - if ( - 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])); - } - } + for (let shiftY of [-1, 1]) { + if ( + y + shiftY >= 0 && y + shiftY < 8 && + 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])); } } }