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.cpp49
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);
+}