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.cpp54
1 files changed, 2 insertions, 52 deletions
diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp
index 7dc32c6..32482b7 100644
--- a/src/Model/Game.cpp
+++ b/src/Model/Game.cpp
@@ -1,59 +1,9 @@
#include "Game.hpp"
-Game::Game()
-{
- m_grid = new Grid(4);
-}
-
-Game::~Game()
-{
- delete m_grid;
-}
-
-
-
-void Game::showGrid()
-{
- m_grid->show();
- std::cout << std::endl;
-}
-
-void Game::pop()
-{
- bool cellChosen = false;
-
- int i;
- int j;
- while(!cellChosen)
- {
- i = rand() % 4;
- j = rand() % 4;
- if (m_grid->isEmpty(i,j))
- cellChosen = true;
- }
- m_grid->setCell(i, j, new Cell<StringElement>(std::to_string(2)));
+Game::Game() : m_grid(){
}
-void Game::swipeRight(){
- m_grid->swipeRight();
-}
-bool Game::isOver()
-{
- if(m_grid->gridIsFull()){
- 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;
+Game::~Game(){
}