diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-03 02:02:22 +0200 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-03 02:02:22 +0200 |
| commit | 9977050e6ecb92570698bbacac1a82b74e5e87a4 (patch) | |
| tree | b80ad6c4e1cbe916bc0175e81afc262e5f1744f7 /src/Model/Game.cpp | |
| parent | 30f603ecd31e5cd849e22bc66d85da2e2d526cc5 (diff) | |
Add score and nb move(s) support
Diffstat (limited to 'src/Model/Game.cpp')
| -rw-r--r-- | src/Model/Game.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp index 2ac665f..d75fa32 100644 --- a/src/Model/Game.cpp +++ b/src/Model/Game.cpp @@ -2,7 +2,7 @@ -Game::Game() : m_grid(){ +Game::Game() : m_grid(), m_score(0), m_nbMove(0){ } Game::~Game(){ @@ -30,8 +30,11 @@ bool Game::swipe(kbdh::Direction direction){ break; } - if(moveDone) + if(moveDone){ + m_score+=m_grid.getLastMoveScore(); + m_nbMove++; this->popRandomNumber(); + } return moveDone; } @@ -62,3 +65,11 @@ void Game::popRandomNumber(){ m_grid.setCell(coord, number); } + +int Game::getScore(){ + return m_score; +} + +int Game::getNbMove(){ + return m_nbMove; +} |
