/* BiquadrisModel class module stores all the game information (Board(s) and Scoreboard) and game functionalities interacts with Controller commands (default and special commands) */ #ifndef _MODEL_H_ #define _MODEL_H_ #include "subject.h" #include "observer.h" #include <string> #include <vector> #include <memory> #include "subscriptions.h" #include "scoreboard.h" class Controller; class Cell; class Board; class View; class BiquadrisModel : public Subject, public Observer { std::vector<std::shared_ptr<Board>> boards; std::unique_ptr<Scoreboard> sb; Controller *ctr; int currentPlayer; int playerCount; bool specialActionActive; void removeEffect(); public: BiquadrisModel(Controller *ctr, View *v, std::string seq1, std::string seq2, int playerCount, int width, int height, int seed, int level = 0); ~BiquadrisModel(); void setRandom(bool r); void setSequence(std::string file); void nextPlayer(); int getCurrPlayer() const noexcept; int getPlayerCount() const noexcept; void move(char direction, int step); void drop(int amount); void rotate(bool isClockwise, int step); void placeCurrBlock(); void replaceCurrBlock(char type, bool safety = true); void levelUp(); void levelDown(); int getLevel(int player); char getNextBlock(int player); void hint(); std::vector<SubscriptionType> subType() override; void notify(Subject *whoNotified, SubscriptionType t) override; void addBlind(); void addHeavy(); void getSpecialActionCommand(); void restart(); }; #endif