diff options
Diffstat (limited to 'src/Model/Game.cpp')
| -rw-r--r-- | src/Model/Game.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp index e2ac799..9c67184 100644 --- a/src/Model/Game.cpp +++ b/src/Model/Game.cpp @@ -4,7 +4,7 @@ //==================== Constructor and Destructor ==================== //Constructor -Game::Game() : m_grid(), m_score(0), m_nbMove(0){ +Game::Game() : Grid(), m_nbMove(0), m_score(0){ } //Destructor @@ -21,21 +21,21 @@ bool Game::swipe(kbdh::Direction direction){ switch(direction){ case kbdh::Left: - moveDone=m_grid.swipeLeft(); + moveDone=swipeLeft(); break; case kbdh::Right: - moveDone=m_grid.swipeRight(); + moveDone=swipeRight(); break; case kbdh::Up: - moveDone=m_grid.swipeUp(); + moveDone=swipeUp(); break; case kbdh::Down: - moveDone=m_grid.swipeDown(); + moveDone=swipeDown(); break; } if(moveDone){ - m_score+=m_grid.getLastMoveScore(); + m_score+=m_lastMoveScore; m_nbMove++; this->popRandomNumber(); } @@ -46,17 +46,17 @@ bool Game::swipe(kbdh::Direction direction){ //Cout the grid void Game::coutGrid(){ - std::cout << m_grid.description(); + std::cout << this->description(); } //Return true if the game is lost. False else. -bool Game::isOver(){ - return m_grid.isOver(); -} +//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()); + std::tuple<int, int> coord(Grid::getRandomEmptyCellCoord()); int percent=rand() % 100; @@ -70,7 +70,7 @@ void Game::popRandomNumber(){ } - m_grid.setCell(coord, number); + Grid::setCell(coord, number); } //==================== Getters and Setter ==================== @@ -84,11 +84,11 @@ int Game::getNbMove(){ return m_nbMove; } -std::vector<std::vector<int> > Game::getGrid(){ - return m_grid.getGrid(); -} +//std::vector<std::vector<int> > Game::getGrid(){ + //return m_grid.getGrid(); +//} -int Game::maxStrLenInGrid(){ - return m_grid.maxStrLenInGrid(); -} +//int Game::maxStrLenInGrid(){ + //return m_grid.maxStrLenInGrid(); +//} |
