+ // Update current game object:
+ this.game.moves.push(move);
+ this.game.fen = move.fen;
+ this.$set(this.game.clocks, colorIdx, this.game.clocks[colorIdx] + addTime);
+ // move.initime is set only when I receive a "lastate" move from opponent
+ this.game.initime[nextIdx] = move.initime || Date.now();
+ // If repetition detected, consider that a draw offer was received:
+ const fenObj = V.ParseFen(move.fen);
+ let repIdx = fenObj.position + "_" + fenObj.turn;
+ if (!!fenObj.flags)
+ repIdx += "_" + fenObj.flags;
+ this.repeat[repIdx] = (!!this.repeat[repIdx]
+ ? this.repeat[repIdx]+1
+ : 1);
+ if (this.repeat[repIdx] >= 3)
+ this.drawOffer = "threerep";
+ else if (this.drawOffer == "threerep")
+ this.drawOffer = "";