diff options
Diffstat (limited to 'include/game.hpp')
| -rw-r--r-- | include/game.hpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/include/game.hpp b/include/game.hpp index 62a024c..5e01b0d 100644 --- a/include/game.hpp +++ b/include/game.hpp @@ -1,6 +1,8 @@ #ifndef GAME_HPP # define GAME_HPP +#include <iostream> +#include <iomanip> #include <cstdlib> #include <vector> #include <utility> @@ -9,23 +11,27 @@ class Game { public: - Game(int s); + Game(int size); + Game(Game const &other); + Game &operator=(Game const &other); ~Game(); - int getSize(); - int getScore(); - int at(int x, int y); - void move(Direction direction); + int getSize() const; + int getScore() const; + int get(int y, int x) const; + bool move(Direction direction); void spawn(); - bool lost(); + bool lost() const; private: - int size; - int **grid; - int score; + int m_size; + int m_score; + int **m_grid; + void mergeRow(std::vector<int> &row); - int **gridCopy(); - bool gridEqual(int **other); - void gridDestroy(int **g); }; +bool operator==(Game const &a, Game const &b); +bool operator!=(Game const &a, Game const &b); +std::ostream &operator<<(std::ostream &out, Game const &game); + #endif |
