From 06036cf5f5c688c60e17180390447b466fb1da10 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Thu, 17 Sep 2020 18:12:34 -0400 Subject: [PATCH] added stats model --- .../com/wyattjmiller/tictactoeapp/Stats.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/src/main/java/com/wyattjmiller/tictactoeapp/Stats.kt diff --git a/app/src/main/java/com/wyattjmiller/tictactoeapp/Stats.kt b/app/src/main/java/com/wyattjmiller/tictactoeapp/Stats.kt new file mode 100644 index 0000000..ddc1ce4 --- /dev/null +++ b/app/src/main/java/com/wyattjmiller/tictactoeapp/Stats.kt @@ -0,0 +1,23 @@ +package com.wyattjmiller.tictactoeapp + +class Stats { + private var mGamesPlayed: Int = 0 + private var mGamesWonX: Int = 0 + private var mGamesWonO: Int = 0 + private var mGamePiecesPlaced: Int = 0 + + fun updateGamesPlayed() { + mGamesPlayed++ + } + + fun updateGamesWon(gameState: Gameboard.GameState) { + when (gameState) { + Gameboard.GameState.GamePlayerWinX -> mGamesWonX++ + Gameboard.GameState.GamePlayerWinO -> mGamesWonO++ + } + } + + fun updatePiecePlaced() { + mGamePiecesPlaced++ + } +} \ No newline at end of file