From 27d646af15bc9147a141aced8cebd30668de9a8e Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sat, 2 May 2015 18:15:14 +0200 Subject: Restart project --- src/Model/Game.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/Model/Game.cpp') 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("2")); + m_grid->setCell(i, j, new Cell(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;igetNRows();i++){ + + for(int j=0;jgetNCols()-1;j++){ + if(m_grid->getCell(i,j)->equals(m_grid->getCell(i,j+1))){ + return false; + } + } } } + else { + return false; + } return true; } -- cgit v1.2.3