X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=44786ff9ff648d051c24ffec0fed540e08f274d4;hb=e82cd97976a6c7707467a384f7d6ca1daa9a0772;hp=7b238f5c2b701f35c4c11f4c7cac1d4a149da244;hpb=9234226104764b91df9d677fb360ad538b98510c;p=vchess.git diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 7b238f5c..44786ff9 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -18,7 +18,6 @@ Vue.component('my-game', { incheck: [], pgnTxt: "", expert: (getCookie("expert") === "1" ? true : false), - gameId: "", //used to limit computer moves' time }; }, render(h) { @@ -855,7 +854,6 @@ Vue.component('my-game', { } return; } - this.gameId = getRandString(); this.vr = new VariantRules(fen, moves || []); this.score = "*"; this.pgnTxt = ""; //redundant with this.score = "*", but cleaner @@ -895,17 +893,6 @@ Vue.component('my-game', { }, playComputerMove: function() { const timeStart = Date.now(); - // We use moves' count to know if search finished: - const nbMoves = this.vr.moves.length; - const gameId = this.gameId; //to know if game was reset before timer end - setTimeout( - () => { - if (gameId != this.gameId) - return; //game stopped - const L = this.vr.moves.length; - if (nbMoves == L || !this.vr.moves[L-1].notation) //move search didn't finish - this.vr.shouldReturn = true; - }, 5000); const compMove = this.vr.getComputerMove(); // (first move) HACK: avoid selecting elements before they appear on page: const delay = Math.max(500-(Date.now()-timeStart), 0);