2P11/src/Model/Game.cpp
2015-05-03 01:09:19 +02:00

51 lines
678 B
C++

#include "Game.hpp"
Game::Game() : m_grid(){
}
Game::~Game(){
}
bool Game::swipe(kbdh::Direction direction){
bool moveDone;
switch(direction){
case kbdh::Left:
moveDone=m_grid.swipeLeft();
break;
case kbdh::Right:
moveDone=m_grid.swipeRight();
break;
case kbdh::Up:
moveDone=m_grid.swipeUp();
break;
case kbdh::Down:
moveDone=m_grid.swipeDown();
break;
}
return moveDone;
}
void Game::coutGrid(){
std::cout << m_grid.description();
}
bool Game::isOver(){
return m_grid.isOver();
}
void Game::popRandomNumber(){
std::tuple<int, int> coord(m_grid.getRandomEmptyCellCoord());
int number=2;
m_grid.setCell(coord, number);
}