// (Security) No effect if a computer move is in progress:
if (this.mode == "computer" && this.lockCompThink)
return this.$emit("computer-think");
// (Security) No effect if a computer move is in progress:
if (this.mode == "computer" && this.lockCompThink)
return this.$emit("computer-think");
- this.conn.send(JSON.stringify({
- code:"ping",oppid:this.oppid,gameId:this.gameId}));
+ this.conn.onopen = () => {
+ this.conn.send(JSON.stringify({
+ code:"ping",oppid:this.oppid,gameId:this.gameId}));
+ };
}
// TODO: also handle "draw accepted" (use opponents array?)
// --> must give this info also when sending lastState...
}
// TODO: also handle "draw accepted" (use opponents array?)
// --> must give this info also when sending lastState...
this.orientation = this.mycolor;
}
else if (this.mode == "computer") //only other alternative (HH with gameId)
{
this.mycolor = (Math.random() < 0.5 ? "w" : "b");
this.orientation = this.mycolor;
this.orientation = this.mycolor;
}
else if (this.mode == "computer") //only other alternative (HH with gameId)
{
this.mycolor = (Math.random() < 0.5 ? "w" : "b");
this.orientation = this.mycolor;