const vname = $.getElementById("selectVariant").value;
const color = $.getElementById("selectColor").value;
for (const select of $.querySelectorAll("#gameOptions select")) {
- const value = parseInt(select.value, 10) || select.value;
+ let value = parseInt(select.value, 10);
+ if (isNaN(value)) //not an integer
+ value = select.value;
options[ select.id.split("_")[1] ] = value;
}
for (const input of $.querySelectorAll("#gameOptions input")) {
if (j == options.length)
break;
const opt = options[j];
- if (!opt[1])
+ if (!opt[1]) //includes 0 and false (lighter display)
continue;
htmlContent +=
'<span class="option">' +
const afterPlay = (move_s) => {
const callbackAfterSend = () => {
curMoves = [];
- const result = vr.getCurrentScore(move);
+ const result = vr.getCurrentScore(move_s);
if (result != "*") {
setTimeout(() => {
toggleVisible("gameStopped");
break;
}
}
- fillGameInfos(obj, playerColor == "w" ? 1 : 0);
- if (obj.randvar)
+ const playerIndex = (playerColor == "w" ? 0 : 1);
+ fillGameInfos(obj, 1 - playerIndex);
+ if (obj.players[playerIndex].randvar)
toggleVisible("gameInfos");
else
toggleVisible("boardContainer");