X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=16e1fdbb739ad139fcbf3f97e1852e06b84ba4e3;hp=9d7bb1fbf7da57e47621d5c34b55e713665648fd;hb=45109880413a50dec3a07298b987fb07d60630b2;hpb=2d7194bd9c976f444e43e5dc0a725823b6472eb9 diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 9d7bb1fb..16e1fdbb 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -1162,7 +1162,7 @@ Vue.component('my-game', { { this.mycolor = Math.random() < 0.5 ? 'w' : 'b'; if (this.mycolor == 'b') - this.playComputerMove(); + setTimeout(this.playComputerMove, 100); //small delay for drawing board } //else: against a (IRL) friend or problem solving: nothing more to do }, @@ -1170,7 +1170,7 @@ Vue.component('my-game', { const timeStart = Date.now(); 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); + const delay = Math.max(250-(Date.now()-timeStart), 0); setTimeout(() => { if (this.mode == "computer") //Warning: mode could have changed! this.play(compMove, "animate") @@ -1360,7 +1360,7 @@ Vue.component('my-game', { } } if (this.mode == "computer" && this.vr.turn != this.mycolor) - this.playComputerMove; + setTimeout(this.playComputerMove, 250); //small delay for animation }, undo: function() { // Navigate after game is over