summaryrefslogtreecommitdiff
path: root/src/Model/Game.cpp
blob: 6039bc9d4ba03965765381674b65e3c0a2c9ebec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "Game.hpp"



Game::Game() : m_grid(){
}

Game::~Game(){
}



bool Game::swipe(kbdh::Direction direction){

	switch(direction){

		case kbdh::Left:
			m_grid.swipeLeft();
			break;
		case kbdh::Right:
			m_grid.swipeRight();
			break;
		case kbdh::Up:
			m_grid.swipeUp();
			break;
		case kbdh::Down:
			m_grid.swipeDown();
			break;
	}

	return true;
}


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);
}