aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <thomasvoss@live.com> 2022-01-14 20:36:30 +0100
committerThomas Voss <thomasvoss@live.com> 2022-01-14 20:36:30 +0100
commitee18ab397ded07830141d0f11ccde2ed67449b62 (patch)
treed2ae4adb9325cb3c9323a92c484e840a3d6454b2
parentd9b00c8bd1c522529455b1174967fc00e5531d1c (diff)
Remove games from the environment when they end
-rw-r--r--draughts/app.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/draughts/app.js b/draughts/app.js
index b5a9fa5..5a4bab7 100644
--- a/draughts/app.js
+++ b/draughts/app.js
@@ -80,7 +80,9 @@ wss.on("connection", ws => {
}
}, ws)
game.move(msg.body)
- game.nextTurn()
+
+ if (!game.nextTurn())
+ env.removeGame(game)
break
}
})