+ checkGameInfo: function(g) {
+ if (!g.id.toString().match(/^[0-9]+$/))
+ return "Wrong game ID";
+ if (!g.vid.toString().match(/^[0-9]+$/))
+ return "Wrong variant ID";
+ if (!g.vname.match(/^[a-zA-Z0-9]+$/))
+ return "Wrong variant name";
+ if (!g.timeControl.match(/^[0-9dhms +]+$/))
+ return "Wrong characters in time control";
+ if (!g.fen.match(/^[a-zA-Z0-9, /-]*$/))
+ return "Bad FEN string";
+ if (g.players.length != 2)
+ return "Need exactly 2 players";
+ if (g.players.some(p => !p.id.toString().match(/^[0-9]+$/)))
+ return "Wrong characters in player ID";
+ return "";
+ },
+