let challenges = {}; //variantName --> socketId, name
let games = {}; //gameId --> gameInfo (vname, fen, players, options, time)
let challenges = {}; //variantName --> socketId, name
let games = {}; //gameId --> gameInfo (vname, fen, players, options, time)
let sockets = {}; //socketId --> socket
const variants = require("./variants.js");
const Crypto = require("crypto");
let sockets = {}; //socketId --> socket
const variants = require("./variants.js");
const Crypto = require("crypto");
};
return gid;
}
// Provide seed in case of, so that both players initialize with same FEN
function launchGame(gid) {
};
return gid;
}
// Provide seed in case of, so that both players initialize with same FEN
function launchGame(gid) {
const gameInfo = Object.assign(
{seed: Math.floor(Math.random() * 19840), gid: gid},
games[gid]
const gameInfo = Object.assign(
{seed: Math.floor(Math.random() * 19840), gid: gid},
games[gid]
const playingWhite = (games[obj.gid].players[0].sid == sid);
const oppSid = games[obj.gid].players[playingWhite ? 1 : 0].sid;
send(oppSid, "newmove", {moves: obj.moves});
const playingWhite = (games[obj.gid].players[0].sid == sid);
const oppSid = games[obj.gid].players[playingWhite ? 1 : 0].sid;
send(oppSid, "newmove", {moves: obj.moves});