From 7b21a4eb7ed2d6d479842b01c35ba6931c3acdc7 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 31 May 2020 17:44:14 -0700 Subject: [PATCH] Drop the name field from the Game class This name is already not used anywhere, (the code has since changed to using Game.meta.identifier instead), so kill it. And this lets us frop the global "engine_name" variable from each game's JavaScript file (which had a value redundant with meta.identifier anyway). --- empires.js | 4 +--- game.js | 3 +-- tictactoe.js | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/empires.js b/empires.js index 78e7f25..3072a12 100644 --- a/empires.js +++ b/empires.js @@ -1,8 +1,6 @@ const express = require("express"); const Game = require("./game.js"); -const engine_name = "empires"; - const router = express.Router(); const GameState = { @@ -35,7 +33,7 @@ function shuffle(a) { class Empires extends Game { constructor() { - super(engine_name); + super(); this._spectators = []; this.next_spectator_id = 1; this._players = []; diff --git a/game.js b/game.js index 5bbd7f5..fb2d75a 100644 --- a/game.js +++ b/game.js @@ -1,7 +1,6 @@ /* Base class providing common code for game engine implementations. */ class Game { - constructor(name) { - this.name = name; + constructor() { this.clients = []; this.next_client_id = 1; } diff --git a/tictactoe.js b/tictactoe.js index 12bf680..11b4295 100644 --- a/tictactoe.js +++ b/tictactoe.js @@ -1,13 +1,11 @@ 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); + super(); this.moves = []; this.board = Array(9).fill(null); } -- 2.43.0