1 const express = require("express");
2 const cors = require("cors");
3 const body_parser = require("body-parser");
14 return [null,null,null,null].map(() => LMNO.letters.charAt(Math.floor(Math.random() * LMNO.letters.length))).join('');
19 var id = this.generate_id();
20 } while (id in this.ids);
33 /* Some letters we don't use in our IDs:
35 * 1. Vowels (AEIOU) to avoid accidentally spelling an unfortunate word
36 * 2. Lowercase letters (replace with corresponding capital on input)
37 * 3. N (replace with M on input)
38 * 4. P (replace with B on input)
39 * 5. S (replace with F on input)
41 LMNO.letters = "BCDFGHJKLMQRTVWXYZ";
43 const lmno = new LMNO();
45 app.post('/new/:game_engine', (request, response) => {
46 const game_engine = request.params.game_engine;
47 const game = lmno.create_game(game_engine);
48 response.send(JSON.stringify(game.id));
51 app.listen(4000, function () {
52 console.log('LMNO server listening on localhost:4000');