TODO: debug auto mode (newmove event not triggered?). Then corr
[vchess.git] / client / src / components / ComputerGame.vue
index 21b1113..f69e1e6 100644 (file)
@@ -93,22 +93,30 @@ export default {
         this.playComputerMove();
     },
     playComputerMove: function() {
+
+console.log("call comp move");
+
       this.timeStart = Date.now();
       this.compWorker.postMessage(["askmove"]);
     },
     // TODO: do not process if game is over (check score ?)
     processMove: function(move) {
+console.log("play move");
+      console.log(move);
       // Send the move to web worker (including his own moves)
       this.compWorker.postMessage(["newmove",move]);
       // subTurn condition for Marseille (and Avalanche) rules
       if ((!this.vr.subTurn || this.vr.subTurn <= 1)
         && (this.gameInfo.mode == "auto" || this.vr.turn != this.game.mycolor))
       {
+
+console.log("ask new comp move");
+
         this.playComputerMove();
       }
     },
-    // When game ends normally, just switch to analyze mode
-    gameOver: function() {
+    gameOver: function(score) {
+      // Just switch to analyze mode: no user action can set score
       this.game.mode = "analyze";
     },
   },