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/Grid.hpp | |
| parent | fec126f0d2d48310109f85c3647b10ce393db5e8 (diff) | |
| parent | 1d09a0fd3ae35ccf51a3b5f929f77a8c8850712c (diff) | |
First stable fusionning
Diffstat (limited to 'src/Model/Grid.hpp')
| -rw-r--r-- | src/Model/Grid.hpp | 53 |
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 |
