00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00030 #ifndef SIMULATIONMANAGER_HPP_
00031 #define SIMULATIONMANAGER_HPP_
00032
00033 #include "mainController.hpp"
00034 #include "layoutManager.hpp"
00035 #include "truthTableManager.hpp"
00036 #include "ruleManager.hpp"
00037 #include "forbiddenPatternManager.hpp"
00038 #include "layoutManager.hpp"
00039 #include "simulation.hpp"
00040 #include "simulationView.hpp"
00041 #include "resultsView.hpp"
00042 #include <vector>
00043 #include <list>
00044
00045 using namespace std;
00046
00047 class LayoutManager;
00048 class SimulationView;
00049 class ResultsView;
00050 class Simulation;
00051
00052 struct simulationStep;
00053
00054 class SimulationManager
00055 {
00056 public:
00057 SimulationManager(MainController *controller, TruthTableManager *tableManager, ForbiddenPatternManager *FPManager, RuleManager *ruleManager, LayoutManager *layoutManager);
00058 virtual ~SimulationManager();
00059 void prepareSimulation();
00060 void startSimulation();
00061 bool nextRow();
00062 void simulateRow();
00063 void finishedRow();
00064 void results();
00065 void rowSelected(int row);
00066 void informationSelected(int information);
00067 void pathSelected(int path);
00068
00069 private:
00070 void addRule(Rule newRule);
00071 void addPattern(ForbiddenPattern newPattern);
00072 bool findRule(Rule rule);
00073 bool findPattern(ForbiddenPattern pattern);
00074 void printRule(Rule rule);
00075 void printPattern(Grid pattern);
00076 bool rotateGrid(Grid originalGrid, Grid *destGrid);
00077 void rotateHexCoordinate(int center, int i, int j, int *ii, int *jj);
00078 void updateRowList();
00079 void updateInformationList();
00080 void updatePathList();
00081 void updateGrid();
00082 bool verifyRow(int row);
00083 bool verifyGrid(int row, Grid g);
00084
00086 TruthTableManager *tableManager;
00088 ForbiddenPatternManager *FPManager;
00090 RuleManager *ruleManager;
00092 LayoutManager *layoutManager;
00094 MainController *controller;
00095
00097 list<Rule> rules;
00099 list<ForbiddenPattern> patterns;
00101 TruthTable table;
00103 matrix layout;
00105 vector<coordinate> tableInputs;
00107 vector<coordinate> tableOutputs;
00109 vector< list<Grid> > processedLayouts;
00111 vector< list<simulationStep> > finalLayouts;
00113 vector< list<simulationStep> > forbiddenLayouts;
00115 vector< list<simulationStep> > cycles;
00117 int row;
00119 SimulationView *view;
00121 ResultsView *resultsView;
00123 Simulation *simulation;
00125 int rRow;
00127 int rInformation;
00129 int rPath;
00131 Grid initialGrid;
00132 };
00133
00134 #endif