From 1d09a0fd3ae35ccf51a3b5f929f77a8c8850712c Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sat, 2 May 2015 22:57:08 +0200 Subject: End console clean game --- src/Model/Game.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/Model/Game.cpp') diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp index 32482b7..6039bc9 100644 --- a/src/Model/Game.cpp +++ b/src/Model/Game.cpp @@ -7,3 +7,43 @@ 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 coord(m_grid.getRandomEmptyCellCoord()); + + int number=2; + + m_grid.setCell(coord, number); +} -- cgit v1.2.3