aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayteApolix <83069108+MayteApolix@users.noreply.github.com> 2022-01-16 23:06:18 +0100
committerMayteApolix <83069108+MayteApolix@users.noreply.github.com> 2022-01-16 23:06:18 +0100
commitefcc8b13e9489ad01d31740883f5ef0bcda5f6fb (patch)
treebfe217d91388df612d464a3d4a70e0049faf7bc4
parent41796113aab42a97af2fb5b0091053db96732f4c (diff)
some more comments in statTracker
-rw-r--r--draughts/app.js5
-rw-r--r--draughts/statTracker.js12
2 files changed, 11 insertions, 6 deletions
diff --git a/draughts/app.js b/draughts/app.js
index e7fd6a1..e255308 100644
--- a/draughts/app.js
+++ b/draughts/app.js
@@ -37,6 +37,9 @@ wss.on("connection", ws => {
* to join.
*/
let game = env.games.filter(g => !g.ongoing)[0]
+ stats.ongoingGames++
+ stats.totalGames++
+
if (!game) {
game = new Game()
env.games.push(game)
@@ -47,8 +50,6 @@ wss.on("connection", ws => {
game.ongoing = true
game.messageClient({ head: Messages.WELCOME, body: Color.RED }, ws)
game.messageOpponent({ head: Messages.START }, ws)
- stats.ongoingGames++
- stats.totalGames++
game.nextTurn()
}
diff --git a/draughts/statTracker.js b/draughts/statTracker.js
index b5a09b9..c301d9f 100644
--- a/draughts/statTracker.js
+++ b/draughts/statTracker.js
@@ -1,8 +1,12 @@
+/**
+ * The gameStatus object tracks our statics to be displayed on our splash screen.
+ */
+
var gameStatus = {
- minimumMoves: Infinity,
- averageMoves: Infinity,
- ongoingGames: 0,
- totalGames: 0
+ minimumMoves: Infinity, /* The minimum amount of moves a game was completed*/
+ averageMoves: Infinity, /* The average amount of moves of all games completed*/
+ ongoingGames: 0, /*How many games are ongoing*/
+ totalGames: 0 /* How many games were initialized (used for calculations) */
}
module.exports = gameStatus;