+ processMove: function(move, scoreObj) {
+ playMove(move, this.vr);
+ // Maybe the user stopped the game:
+ if (this.game.score != "*") {
+ this.$emit("game-stopped");
+ return;
+ }
+ // This move could have ended the game
+ if (!scoreObj) scoreObj = { score: this.vr.getCurrentScore() };
+ if (scoreObj.score != "*") {
+ this.gameOver(scoreObj.score);
+ return;
+ }
+ // Send the move to web worker (including his own moves)
+ this.compWorker.postMessage(["newmove", move]);
+ if (this.gameInfo.mode == "auto" || this.vr.turn != this.game.mycolor)
+ this.playComputerMove();
+ // Finally, update storage:
+ if (this.gameInfo.mode == "versus") {
+ CompgameStorage.update(this.gameInfo.vname, {
+ move: getFilteredMove(move),
+ fen: this.vr.getFen()
+ });
+ }
+ },
+ gameOver: function(score) {
+ this.game.score = score;
+ this.game.scoreMsg = getScoreMessage(score);
+ // If comp is thinking, let him finish:
+ if (!this.compThink) this.$emit("game-stopped");
+ }
+ }