diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-02 18:15:14 +0200 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-02 18:15:14 +0200 |
| commit | 27d646af15bc9147a141aced8cebd30668de9a8e (patch) | |
| tree | 81fab7651570910f9232e90b50ba43c061585858 /src/Model/Game.cpp | |
| parent | 6b8a144bd192de206e11a171841ec6161d11b6aa (diff) | |
Restart project
Diffstat (limited to 'src/Model/Game.cpp')
| -rw-r--r-- | src/Model/Game.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp index 3054990..7dc32c6 100644 --- a/src/Model/Game.cpp +++ b/src/Model/Game.cpp @@ -33,18 +33,27 @@ void Game::pop() if (m_grid->isEmpty(i,j)) cellChosen = true; } - - m_grid->setCell(i, j, new Cell<StringElement>("2")); + m_grid->setCell(i, j, new Cell<StringElement>(std::to_string(2))); +} +void Game::swipeRight(){ + m_grid->swipeRight(); } - bool Game::isOver() { if(m_grid->gridIsFull()){ - for(int i=0;i<4;i++){ - std::cout << m_grid->getCell(0,i)->description(); + for(int i=0;i<m_grid->getNRows();i++){ + + for(int j=0;j<m_grid->getNCols()-1;j++){ + if(m_grid->getCell(i,j)->equals(m_grid->getCell(i,j+1))){ + return false; + } + } } } + else { + return false; + } return true; } |
