X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSynchrone1.js;h=2aa5b45fddf47f57c1853f40816e7aaef225db38;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hp=ba9cf9f226ff8d8d831f6d0cce80cc2a00c77118;hpb=9d15c433c207a2c3bb548d095939c3e08b4038fd;p=vchess.git diff --git a/client/src/variants/Synchrone1.js b/client/src/variants/Synchrone1.js index ba9cf9f2..2aa5b45f 100644 --- a/client/src/variants/Synchrone1.js +++ b/client/src/variants/Synchrone1.js @@ -53,8 +53,8 @@ export class Synchrone1Rules extends ChessRules { ); } - static GenRandInitFen(randomness) { - return ChessRules.GenRandInitFen(randomness).slice(0, -1) + "-,- -"; + static GenRandInitFen(options) { + return ChessRules.GenRandInitFen(options).slice(0, -1) + "-,- -"; } getFen() { @@ -363,9 +363,11 @@ export class Synchrone1Rules extends ChessRules { return smove; } - play(move) { - move.flags = JSON.stringify(this.aggregateFlags()); //save flags (for undo) - this.epSquares.push(this.getEpSquare(move)); + play(move, noFlag) { + if (!noFlag) { + move.flags = JSON.stringify(this.aggregateFlags()); + this.epSquares.push(this.getEpSquare(move)); + } // Do not play on board (would reveal the move...) this.turn = V.GetOppCol(this.turn); this.movesCount++; @@ -399,7 +401,7 @@ export class Synchrone1Rules extends ChessRules { // Update king position + flags let kingAppear = { 'w': false, 'b': false }; - for (let i=0; i= 0 && this.underCheck('w')) res.push(JSON.parse(JSON.stringify(this.kingPos['w']))); if (this.kingPos['b'][0] >= 0 && this.underCheck('b')) res.push(JSON.parse(JSON.stringify(this.kingPos['b']))); - if (color == 'b') this.play(lastMove); + if (color == 'b') this.play(lastMove, "noFlag"); return res; }