]> git.cworth.org Git - lmno-server/blobdiff - tictactoe.js
tictactoe: Use empty strings instead of null objects for empty squares
[lmno-server] / tictactoe.js
index ca67834ecc5790da0a1d125b9a0038d4a58a28cf..f9b357bf3202dfbc84443818dbd3626958e5f307 100644 (file)
@@ -1,15 +1,13 @@
 const express = require("express");
 const Game = require("./game.js");
 
-const engine_name = "tictactoe";
-
 const router = express.Router();
 
 class TicTacToe extends Game {
-  constructor() {
-    super(engine_name);
+  constructor(id) {
+    super(id);
     this.moves = [];
-    this.board = Array(9).fill(null);
+    this.board = Array(9).fill("");
   }
 
   /* Returns Boolean indicating whether move was legal and added. */
@@ -61,12 +59,9 @@ router.get('/events', (request, response) => {
 });
 
 exports.router = router;
-exports.name = engine_name;
 exports.Game = TicTacToe;
 
 TicTacToe.meta = {
   name: "Tic Tac Toe",
   identifier: "tictactoe"
 };
-
-exports.meta = TicTacToe.meta;