aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <thomasvoss@live.com> 2022-01-13 22:55:33 +0100
committerThomas Voss <thomasvoss@live.com> 2022-01-13 22:55:33 +0100
commita24599cce84fa0a8ec14788b177c72ea41dcafa9 (patch)
treeb01aba3efdff4bafe96f6bac13579476fe74d50f
parent610784b7eb6105bc3c4e5ea5aaeb8bc51535e49f (diff)
Remove game IDs, they are useless
-rw-r--r--draughts/app.js2
-rw-r--r--draughts/game.js4
2 files changed, 2 insertions, 4 deletions
diff --git a/draughts/app.js b/draughts/app.js
index fc0b273..ba1d957 100644
--- a/draughts/app.js
+++ b/draughts/app.js
@@ -37,7 +37,7 @@ wss.on("connection", ws => {
*/
let game = env.games.filter(g => !g.ongoing)[0]
if (!game) {
- game = new Game(env.games.length) /* The number of games servers as a unique game ID */
+ game = new Game()
env.games.push(game)
game.bluePlayer = ws
game.messageClient({ head: Messages.WELCOME, body: Color.BLUE }, ws)
diff --git a/draughts/game.js b/draughts/game.js
index 067cb9a..107cd3d 100644
--- a/draughts/game.js
+++ b/draughts/game.js
@@ -197,7 +197,6 @@ const calculateMoves = (p, board) => {
/*
* Signature:
- * this.id :: Number
* this.board :: Piece[][]
* this.ongoing :: Boolean
* this.bluePlayer :: WebSocket
@@ -209,8 +208,7 @@ const calculateMoves = (p, board) => {
* A class representing a game. It contains the current game state as well as the complete move
* history and the websockets of both players.
*/
-const Game = function(gameID) {
- this.id = gameID
+const Game = function() {
this.board = boardInit()
this.ongoing = false
this.bluePlayer = null