From: Benjamin Auder Date: Sun, 25 Nov 2018 23:39:32 +0000 (+0100) Subject: Attempt to fix Alice chess X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/store/doc/config.php?a=commitdiff_plain;h=a0f5dbaac2a9c028aa0ca2559d157b34aeafd3c9;p=vchess.git Attempt to fix Alice chess --- diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index 0f637c57..85689369 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -698,6 +698,10 @@ class ChessRules play(move, ingame) { + // DEBUG: +// if (!this.states) this.states = []; +// if (!ingame) this.states.push(JSON.stringify(this.board)); + if (!!ingame) move.notation = this.getNotation(move); @@ -715,6 +719,11 @@ class ChessRules this.moves.pop(); this.unupdateVariables(move); this.parseFlags(JSON.parse(move.flags)); + + // DEBUG: +// let state = this.states.pop(); +// if (JSON.stringify(this.board) != state) +// debugger; } ////////////// diff --git a/public/javascripts/variants/Alice.js b/public/javascripts/variants/Alice.js index 76168275..9a7cefa0 100644 --- a/public/javascripts/variants/Alice.js +++ b/public/javascripts/variants/Alice.js @@ -132,7 +132,8 @@ class AliceRules extends ChessRules }); } // Fix en-passant captures - if (m.vanish.length == 2 && this.board[m.end.x][m.end.y] == VariantRules.EMPTY) + if (m.vanish[0].p == VariantRules.PAWN + && m.vanish.length == 2 && this.board[m.end.x][m.end.y] == VariantRules.EMPTY) { m.vanish[1].c = this.getOppCol(this.getColor(x,y)); // In the special case of en-passant, if