#ifndef _ConwayModels_H_ #define _ConwayModels_H_ #include <list> #include "ConwayController.h" class ConwayModels { public: ConwayModels(); void update_state(const int n); private: ConwayController *Controller; // ERROR! class cell { // live or dead bool state; // coordinates int x, y; }; std::list<cell> live_with_neighbors; }; #endif /* _ConwayModels_H_ */
#ifndef _ConwayViews_H_ #define _ConwayViews_H_ #include "IConwayViews.h" #include "ConwayController.h" class ConwayViews : public IConwayViews { public: ConwayViews(); virtual ~ConwayViews(); virtual void drow(); virtual void set_cell(const int x, const int y); virtual void reset_cell(const int x, const int y); private: ConwayController *Controller; }; #endif /* _ConwayViews_H_ */
#ifndef _ConwayController_H_ #define _ConwayController_H_ #include "Parser.h" #include "ConwayModels.h" #include "ConwayViews.h" #include <string> #include <fstream> class ConwayController { public: ConwayController() : default_input("input.txt"), default_output("output.txt") {}; ~ConwayController() {}; // start reading and execution commands of game void start_game(const int argc, const char **argv); // read and execute next command void eval(); private: const char *default_input; const char *default_output; // built-in parcer (aggregation) ArgParser Parser; // communication with model and view (association) ConwayModels *Model; ConwayViews *View; // io files ifstream in; ofstream out; }; #endif /* _ConwayController_H_ */
ConwayModels
ConwayController
new
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)