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");
// Provide seed in case of, so that both players initialize with same FEN
function launchGame(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() * 1984), gid: gid},
games[gid]
const gameInfo = Object.assign(
{seed: Math.floor(Math.random() * 1984), gid: gid},
games[gid]
games[obj.gid].fen = obj.fen;
games[obj.gid].time = Date.now(); //update timestamp in case of
const playingWhite = (games[obj.gid].players[0].sid == sid);
games[obj.gid].fen = obj.fen;
games[obj.gid].time = Date.now(); //update timestamp in case of
const playingWhite = (games[obj.gid].players[0].sid == sid);