X-Git-Url: https://git.auder.net/assets/icon_infos.svg?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FComputerGame.vue;h=1181971bed97a23f618b5ade7365ab74d19eb9c9;hb=094e11f228623dae26d1c93813db4deaebca293d;hp=c05eea0541e4c22f6ebf69c731c464587a533169;hpb=98b94cc3504937ae0af29a265394dfe52ea1ee67;p=vchess.git diff --git a/client/src/components/ComputerGame.vue b/client/src/components/ComputerGame.vue index c05eea05..1181971b 100644 --- a/client/src/components/ComputerGame.vue +++ b/client/src/components/ComputerGame.vue @@ -72,13 +72,14 @@ export default { game = { vname: this.gameInfo.vname, fenStart: V.GenRandInitFen(), - mycolor: Math.random() < 0.5 ? "w" : "b", moves: [] }; game.fen = game.fenStart; if (this.gameInfo.mode == "versus") CompgameStorage.add(game); } + if (this.gameInfo.mode == "versus" && !game.mycolor) + game.mycolor = Math.random() < 0.5 ? "w" : "b"; this.compWorker.postMessage(["init", game.fen]); this.vr = new V(game.fen); game.players = [{ name: "Myself" }, { name: "Computer" }];