summaryrefslogtreecommitdiff
path: root/src/Model/Grid.hpp
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2015-05-02 23:05:44 +0200
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2015-05-02 23:05:44 +0200
commit710cc4001f65ac2fee39e25d79f43a01b9e12512 (patch)
tree2e78e337b0c7d0f79bd68205badc1630326118ed /src/Model/Grid.hpp
parentfec126f0d2d48310109f85c3647b10ce393db5e8 (diff)
parent1d09a0fd3ae35ccf51a3b5f929f77a8c8850712c (diff)
First stable fusionning
Diffstat (limited to 'src/Model/Grid.hpp')
-rw-r--r--src/Model/Grid.hpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/Model/Grid.hpp b/src/Model/Grid.hpp
new file mode 100644
index 0000000..21c653a
--- /dev/null
+++ b/src/Model/Grid.hpp
@@ -0,0 +1,53 @@
+#ifndef DEF_GRID
+#define DEF_GRID
+
+/* Grid.h
+ * Defines the class Grid
+ * A grid contains a table of cells the game will be set on
+ * Creators : krilius, manzerbredes
+ * Date : 29/04/2015 */
+
+#include <iostream>
+#include <sstream>
+#include <vector>
+#include <tuple>
+
+class Grid
+{
+ private:
+ int m_size;
+ std::vector<std::vector<int> > m_grid;
+
+ int maxStrLenInGrid();
+ public:
+ Grid();
+ ~Grid();
+
+ std::string description();
+ bool isEmpty(int i, int j);
+ std::tuple<int, int> getRandomEmptyCellCoord();
+
+ bool setCell(std::tuple<int, int> coord, int value);
+ bool setCell(int i, int j, int value);
+
+ std::vector<int> swipeLine(std::vector<int> line);
+ std::vector<int> defragmentLine(std::vector<int> line);
+ std::vector<int> mergeLine(std::vector<int> line);
+
+ std::vector<int> getCol(int col);
+
+ bool isFull();
+ bool isOver();
+
+ void setCol(int col, std::vector<int> colVect);
+ std::vector<int> reverseLine(std::vector<int> line);
+
+ //Moves
+ void swipeRight();
+ void swipeLeft();
+ void swipeUp();
+ void swipeDown();
+};
+
+
+#endif