diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-02 23:05:44 +0200 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-02 23:05:44 +0200 |
| commit | 710cc4001f65ac2fee39e25d79f43a01b9e12512 (patch) | |
| tree | 2e78e337b0c7d0f79bd68205badc1630326118ed /src/Model/Game.cpp | |
| parent | fec126f0d2d48310109f85c3647b10ce393db5e8 (diff) | |
| parent | 1d09a0fd3ae35ccf51a3b5f929f77a8c8850712c (diff) | |
First stable fusionning
Diffstat (limited to 'src/Model/Game.cpp')
| -rw-r--r-- | src/Model/Game.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp new file mode 100644 index 0000000..6039bc9 --- /dev/null +++ b/src/Model/Game.cpp @@ -0,0 +1,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); +} |
