X-Git-Url: https://git.cworth.org/git?p=lmno-server;a=blobdiff_plain;f=lmno.js;h=71ccc58165298b3e313fa7f60e0422fb19e3b7b6;hp=d01b3e9478543b20c9a51196677a30a02c30edef;hb=fa3bdc8a5207fc93f4d720771cb6155913f06262;hpb=219a2dafd6eea42e66181ef2345590028e18f684 diff --git a/lmno.js b/lmno.js index d01b3e9..71ccc58 100644 --- a/lmno.js +++ b/lmno.js @@ -91,7 +91,8 @@ nunjucks.configure("templates", { const engines = { empires: require("./empires").Game, tictactoe: require("./tictactoe").Game, - scribe: require("./scribe").Game + scribe: require("./scribe").Game, + empathy: require("./empathy").Game }; class LMNO { @@ -100,7 +101,11 @@ class LMNO { } generate_id() { - return Array(4).fill(null).map(() => LMNO.letters.charAt(Math.floor(Math.random() * LMNO.letters.length))).join(''); + /* Note: The copy from Array(4) to [...Array(4)] is necessary so + * that map() will actually work, (which it doesn't on an array + * from Array(N) which is in this strange state of having "empty" + * items rather than "undefined" as we get after [...Array(4)] */ + return [...Array(4)].map(() => LMNO.letters.charAt(Math.floor(Math.random() * LMNO.letters.length))).join(''); } create_game(engine_name) {