X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FBenedict.js;h=039aaeaf93b2f7b72a51876be811e7e4ca5103f7;hb=4eb0915a0659c8bece6930866a526c5e2c296d9f;hp=fbc4b488a1753a298f95f19d151eab1fb19c3a85;hpb=32f6285ee325a14286562a53baefc647201df2af;p=vchess.git diff --git a/client/src/variants/Benedict.js b/client/src/variants/Benedict.js index fbc4b488..039aaeaf 100644 --- a/client/src/variants/Benedict.js +++ b/client/src/variants/Benedict.js @@ -135,13 +135,10 @@ export class BenedictRules extends ChessRules { // Stop at the first move found atLeastOneMove() { const color = this.turn; - const oppCol = V.GetOppCol(color); for (let i = 0; i < V.size.x; i++) { for (let j = 0; j < V.size.y; j++) { - if (this.board[i][j] != V.EMPTY && this.getColor(i, j) != oppCol) { - const moves = this.getPotentialMovesFrom([i, j]); - if (moves.length > 0) - return true; + if (this.board[i][j] != V.EMPTY && this.getColor(i, j) == color) { + if (this.getPotentialMovesFrom([i, j]).length > 0) return true; } } } @@ -154,8 +151,7 @@ export class BenedictRules extends ChessRules { const kp = this.kingPos[color]; if (this.getColor(kp[0], kp[1]) != color) return color == "w" ? "0-1" : "1-0"; - if (this.atLeastOneMove()) - return "*"; + if (this.atLeastOneMove()) return "*"; // Stalemate: return "1/2"; }