X-Git-Url: https://git.auder.net/doc/index.css?a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;h=5020094ce6582c326473acbc74f1e1b9b1901348;hb=a3c86ec9b60326a8ae3d8f237493fb09627aed95;hp=750cd2d4ab72313fc4e1149dd76103ff4926147a;hpb=32cfcea44bf00b0c6c4d172cca715823076ff490;p=vchess.git diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index 750cd2d4..5020094c 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -729,6 +729,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), this.getLongNotation(move)]; @@ -746,6 +750,11 @@ class ChessRules this.moves.pop(); this.unupdateVariables(move); this.parseFlags(JSON.parse(move.flags)); + + // DEBUG: +// if (JSON.stringify(this.board) != this.states[this.states.length-1]) +// debugger; +// this.states.pop(); } ////////////// @@ -1033,11 +1042,10 @@ class ChessRules pieces[c][knight2Pos] = 'n'; pieces[c][rook2Pos] = 'r'; } - let fen = pieces["b"].join("") + + return pieces["b"].join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" + pieces["w"].join("").toUpperCase() + " 1111"; //add flags - return fen; } // Return current fen according to pieces+colors state