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.cpp19
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;
}