- // Also update current game object:
- this.game.moves.push(move);
- this.game.fen = move.fen;
- //TODO: (Vue3) just this.game.clocks[colorIdx] += addTime;
- this.$set(this.game.clocks, colorIdx, this.game.clocks[colorIdx] + addTime);
- this.game.initime[nextIdx] = 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";