X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSuicide.js;h=e3630bb408ae7a9df11a3c82beb74bf8c407c760;hb=5d416f0fb2e4c41b38d089d569c464496524ada8;hp=c81d35514ae193b715d4d0f23421ba31612b5add;hpb=6f2f94374f1e73c375edf732d9425e575e81fff7;p=vchess.git diff --git a/client/src/variants/Suicide.js b/client/src/variants/Suicide.js index c81d3551..e3630bb4 100644 --- a/client/src/variants/Suicide.js +++ b/client/src/variants/Suicide.js @@ -7,10 +7,6 @@ export class SuicideRules extends ChessRules { return false; } - static get HasCastle() { - return false; - } - static get PawnSpecs() { return Object.assign( {}, @@ -33,7 +29,7 @@ export class SuicideRules extends ChessRules { pieces[row[i] == lowerRi ? "b" : "w"]++; sumElts++; } else { - const num = parseInt(row[i]); + const num = parseInt(row[i], 10); if (isNaN(num)) return false; sumElts += num; } @@ -54,12 +50,11 @@ export class SuicideRules extends ChessRules { // Stop at the first capture found (if any) atLeastOneCapture() { 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 && + this.getColor(i, j) == color && this.getPotentialMovesFrom([i, j]).some(m => m.vanish.length == 2) ) { return true;