X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FComputerGame.vue;h=1181971bed97a23f618b5ade7365ab74d19eb9c9;hp=c05eea0541e4c22f6ebf69c731c464587a533169;hb=f446ee645526d617c8369add83de66888d2db6ce;hpb=0ba6420d3515e278b34c29e5afa1e58f6e08e9eb 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" }];