- const [sizeX,sizeY] = VariantRules.size;
- const smallScreen = (screen.width <= 420);
+ const [sizeX,sizeY] = [V.size.x,V.size.y];
+ const smallScreen = (window.innerWidth <= 420);
// Precompute hints squares to facilitate rendering
let hintSquares = doubleArray(sizeX, sizeY, false);
this.possibleMoves.forEach(m => { hintSquares[m.end.x][m.end.y] = true; });
// Precompute hints squares to facilitate rendering
let hintSquares = doubleArray(sizeX, sizeY, false);
this.possibleMoves.forEach(m => { hintSquares[m.end.x][m.end.y] = true; });
"class": { "section": true },
domProps: { innerHTML: eogMessage },
}
"class": { "section": true },
domProps: { innerHTML: eogMessage },
}
"class": { "section": true },
domProps: { innerHTML: "New game" },
}
"class": { "section": true },
domProps: { innerHTML: "New game" },
}
"class": { "section": true },
domProps: { innerHTML: "Position + flags (FEN):" },
}
"class": { "section": true },
domProps: { innerHTML: "Position + flags (FEN):" },
}
"class": { "section": true },
domProps: { innerHTML: "Preferences" },
}
"class": { "section": true },
domProps: { innerHTML: "Preferences" },
}
case "newgame": //opponent found
// oppid: opponent socket ID
this.newGame("human", data.fen, data.color, data.oppid);
case "newgame": //opponent found
// oppid: opponent socket ID
this.newGame("human", data.fen, data.color, data.oppid);
{
const storageVariant = localStorage.getItem("variant");
if (!!storageVariant && storageVariant !== variant)
{
const storageVariant = localStorage.getItem("variant");
if (!!storageVariant && storageVariant !== variant)
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 compMove = this.vr.getComputerMove();
// (first move) HACK: avoid selecting elements before they appear on page:
const delay = Math.max(500-(Date.now()-timeStart), 0);
- setTimeout(() => this.play(compMove, "animate"), delay);
+ setTimeout(() => {
+ if (this.mode == "computer") //Warning: mode could have changed!
+ this.play(compMove, "animate")
+ }, delay);
},
// Get the identifier of a HTML table cell from its numeric coordinates o.x,o.y.
getSquareId: function(o) {
},
// Get the identifier of a HTML table cell from its numeric coordinates o.x,o.y.
getSquareId: function(o) {