From: Benjamin Auder Date: Fri, 14 Dec 2018 15:52:36 +0000 (+0100) Subject: Fix Checkered and Ultima rules. Write Chess960 rules and complete others X-Git-Url: https://git.auder.net/%7B%7B%20path%28%27mixstore_user_board%27%29%20%7D%7D?a=commitdiff_plain;h=2316f8b8248589effc756d5c09c73a1acb431574;p=vchess.git Fix Checkered and Ultima rules. Write Chess960 rules and complete others --- diff --git a/public/javascripts/variants/Checkered.js b/public/javascripts/variants/Checkered.js index 019e1e2c..814d91b8 100644 --- a/public/javascripts/variants/Checkered.js +++ b/public/javascripts/variants/Checkered.js @@ -76,10 +76,15 @@ class CheckeredRules extends ChessRules return standardMoves; //king has to be treated differently (for castles) let moves = []; standardMoves.forEach(m => { - if (m.vanish[0].p == VariantRules.PAWN && Math.abs(m.end.x-m.start.x)==2 - && !this.pawnFlags[this.turn][m.start.y]) + if (m.vanish[0].p == VariantRules.PAWN) { - return; //skip forbidden 2-squares jumps + if (Math.abs(m.end.x-m.start.x)==2 && !this.pawnFlags[this.turn][m.start.y]) + return; //skip forbidden 2-squares jumps + if (this.board[m.end.x][m.end.y] == VariantRules.EMPTY + && m.vanish.length==2 && this.getColor(m.start.x,m.start.y) == 'c') + { + return; //checkered pawns cannot take en-passant + } } if (m.vanish.length == 1) moves.push(m); //no capture diff --git a/public/javascripts/variants/Ultima.js b/public/javascripts/variants/Ultima.js index ac0cf957..ab12c716 100644 --- a/public/javascripts/variants/Ultima.js +++ b/public/javascripts/variants/Ultima.js @@ -67,14 +67,14 @@ class UltimaRules extends ChessRules && this.getColor(i,j) == oppCol) { const oppPiece = this.getPiece(i,j); - if (oppPiece == V.BISHOP && piece == V.IMMOBILIZER) - return true; - if (oppPiece == V.IMMOBILIZER && ![V.BISHOP,V.IMMOBILIZER].includes(piece)) + if (oppPiece == V.IMMOBILIZER) { // Moving is impossible only if this immobilizer is not neutralized for (let step2 of adjacentSteps) { const [i2,j2] = [i+step2[0],j+step2[1]]; + if (i2 == x && j2 == y) + continue; //skip initial piece! if (i2>=0 && i2=0 && j2