summaryrefslogtreecommitdiff
path: root/src/Model/Game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model/Game.cpp')
-rw-r--r--src/Model/Game.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp
index d75fa32..284d82b 100644
--- a/src/Model/Game.cpp
+++ b/src/Model/Game.cpp
@@ -1,15 +1,19 @@
#include "Game.hpp"
+//==================== Constructor and Destructor ====================
+//Constructor
Game::Game() : m_grid(), m_score(0), m_nbMove(0){
}
+//Destructor
Game::~Game(){
}
+//==================== Helpers ====================
-
+//Swipe action
bool Game::swipe(kbdh::Direction direction){
bool moveDone;
@@ -40,14 +44,17 @@ bool Game::swipe(kbdh::Direction direction){
}
+//Cout the grid
void Game::coutGrid(){
std::cout << m_grid.description();
}
+//Return true if the game is lost. False else.
bool Game::isOver(){
return m_grid.isOver();
}
+//Pop a random number on the grid
void Game::popRandomNumber(){
std::tuple<int, int> coord(m_grid.getRandomEmptyCellCoord());
@@ -65,11 +72,14 @@ void Game::popRandomNumber(){
m_grid.setCell(coord, number);
}
+//==================== Getters and Setter ====================
+//Retrieve the Score
int Game::getScore(){
return m_score;
}
+//Retrieve the number of moves
int Game::getNbMove(){
return m_nbMove;
}