<template lang="pug">
-BaseGame(:game="game" :vr="vr" ref="basegame"
- @newmove="processMove" @gameover="gameOver")
+BaseGame(:game="game" :vr="vr" @newmove="processMove" @gameover="gameOver")
</template>
<script>
import BaseGame from "@/components/BaseGame.vue";
import { store } from "@/store";
import Worker from "worker-loader!@/playCompMove";
-
export default {
name: "my-computer-game",
components: {
if (!!this.gameInfo.fen)
this.launchGame();
},
- // dans variant.js (plutôt room.js) conn gère aussi les challenges
- // et les chats dans chat.js. Puis en webRTC, repenser tout ça.
methods: {
- launchGame: async function() {
- const vModule = await import("@/variants/" + this.gameInfo.vname + ".js");
- window.V = vModule.VariantRules;
+ launchGame: function() {
this.compWorker.postMessage(["scripts",this.gameInfo.vname]);
this.compWorker.postMessage(["init",this.gameInfo.fen]);
this.vr = new V(this.gameInfo.fen);
this.compWorker.postMessage(["askmove"]);
},
processMove: function(move) {
+ if (this.game.score != "*")
+ return;
// Send the move to web worker (including his own moves)
this.compWorker.postMessage(["newmove",move]);
// subTurn condition for Marseille (and Avalanche) rules