setTimeout(() => {
if (this.currentUrl != document.location.href) return; //page change
self.$refs["basegame"].play(compMove, "received");
setTimeout(() => {
if (this.currentUrl != document.location.href) return; //page change
self.$refs["basegame"].play(compMove, "received");
// 250 = length of animation, 500 = delay between sub-moves
// TODO: a callback would be cleaner.
// 250 = length of animation, 500 = delay between sub-moves
// TODO: a callback would be cleaner.
if (!game.mycolor) game.mycolor = (Math.random() < 0.5 ? "w" : "b");
this.compWorker.postMessage(["init", game.fen]);
this.vr = new V(game.fen);
if (!game.mycolor) game.mycolor = (Math.random() < 0.5 ? "w" : "b");
this.compWorker.postMessage(["init", game.fen]);
this.vr = new V(game.fen);
// If comp is thinking, let him finish:
if (!this.compThink) this.$emit("game-stopped");
}
// If comp is thinking, let him finish:
if (!this.compThink) this.$emit("game-stopped");
}