comparison SequenceController.h @ 43:4ad0d218f890

can skip runs if it crashed etc.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Mon, 15 Dec 2014 12:51:09 +0000
parents 2bd658b44c2d
children d810aa9ca03a
comparison
equal deleted inserted replaced
42:2bd658b44c2d 43:4ad0d218f890
14 #include "presetManager.h" 14 #include "presetManager.h"
15 #include "TrainingScoreManager.h" 15 #include "TrainingScoreManager.h"
16 16
17 #define MIN_TARGETS_IN_SEQUENCE 1 17 #define MIN_TARGETS_IN_SEQUENCE 1
18 #define NUM_REPETITIONS_AT_LEVEL 2 18 #define NUM_REPETITIONS_AT_LEVEL 2
19 #define MAX_TARGETS_IN_SEQUENCE 3 19 #define MAX_TARGETS_IN_SEQUENCE 4
20 #define MIN_TEMPO 70 20 #define MIN_TEMPO 90
21 #define MAX_TEMPO 500 21 #define MAX_TEMPO 520
22 #define TEMPO_RANDOM_AMOUNT 22 #define TEMPO_RANDOM_AMOUNT
23 #define MAX_TIME 2800 23 #define MAX_TIME 2800
24 #define MIN_TIME 200 24 #define MIN_TIME 200
25 #define NUM_TEMPO_STEPS 20 25 #define NUM_TEMPO_STEPS 20
26 #define END_NEUTRAL_MATCH 0 26 #define END_NEUTRAL_MATCH 0
53 //return 1000* (60.0/tempo); 53 //return 1000* (60.0/tempo);
54 return timeAllowedMs/4.0; 54 return timeAllowedMs/4.0;
55 } 55 }
56 56
57 void setTempoFromTime(){ 57 void setTempoFromTime(){
58 tempo = 60.0 / (4* timeAllowedMs*1000.0); 58 tempo = 4 * 1000. * 60.0 / (timeAllowedMs);
59 } 59 }
60 void setTimeFromTempo(){ 60 void setTimeFromTempo(){
61 timeAllowedMs = 4*1000* (60.0/tempo); 61 timeAllowedMs = 4*1000* (60.0/tempo);
62 } 62 }
63 int presetIndex; 63 int presetIndex;
76 bool isLastOfRun; 76 bool isLastOfRun;
77 77
78 bool showsGuides; // depends on 'level' 78 bool showsGuides; // depends on 'level'
79 bool showsIcons; 79 bool showsIcons;
80 bool showsResultsAtEnd; 80 bool showsResultsAtEnd;
81 81 int totalLengthOfSeq;
82 vector<int> thisSequence; // so that we can show the whole sequence at the top? 82 vector<int> thisSequence; // so that we can show the whole sequence at the top?
83 83
84 TrainingTestResult result; // only applies to steps that were scored. 84 TrainingTestResult result; // only applies to steps that were scored.
85 85
86 86
130 }; 130 };
131 131
132 class SequenceController{ 132 class SequenceController{
133 public: 133 public:
134 SequenceController(); 134 SequenceController();
135 void init(bool asoundOnlyMode); 135 void init(bool asoundOnlyMode, controlPanelType whichInterfaceAreWeUsing);
136 AnimStep getNextStep(); 136 AnimStep getNextStep();
137 void setToStart(); 137 void setToStart();
138 void stepForward(); 138 void stepForward();
139 float getStartTickTime(); 139 float getStartIntervalTime();
140 void saveResultForCurrentStep(TrainingTestResult result); 140 void saveResultForCurrentStep(TrainingTestResult result);
141 TrainingTestResult getResultForPreviousStep(); 141 TrainingTestResult getResultForPreviousStep();
142 int getTotNumRuns(){return totNumRuns;}; 142 int getTotNumRuns(){return totNumRuns;};
143 int getCurrentRunNumber(){return currentRunNumber;};
144 void skipRun();
143 private: 145 private:
144 void generateSteps(); 146 void generateSteps();
145 void generateCountIn(int countInLength); 147 void generateTestSequence();
146 void generateRun(int run, int numInSequence); 148 void generateCountIn(int countInLength, int runNumber);
147 void generateARun(int run, int numInSequence); // use this 149 void generateRun(int run, int numInSequence);// use this now
150 void generateARun(int run, int numInSequence);
148 void generateAnEasyRun(int run, int numInSequence = 1); 151 void generateAnEasyRun(int run, int numInSequence = 1);
149 void generateASoundOnlyRun(int run, int numInSequence); 152 void generateASoundOnlyRun(int run, int numInSequence);
150 vector<int> randomSequence(int numInSequence); 153 vector<int> randomSequence(int numInSequence);
151 vector<int> nonRandomSequence(int numInSequence); 154 vector<int> nonRandomSequence(int numInSequence);
152 int getRandomButNot(int max, vector<int> notThese); 155 int getRandomButNot(int max, vector<int> notThese);
157 vector<AnimStep> steps; 160 vector<AnimStep> steps;
158 vector<AnimStep>::iterator currentStep; 161 vector<AnimStep>::iterator currentStep;
159 float tempoInc; 162 float tempoInc;
160 int timeInc; 163 int timeInc;
161 bool soundOnlyMode; 164 bool soundOnlyMode;
165 controlPanelType panelType;
162 int totNumRuns; 166 int totNumRuns;
167 vector<int> timeIntervalsHard;
168 int currentRunNumber;
163 }; 169 };
164 170
165 #endif /* defined(__riftathon__SequenceGenerator__) */ 171 #endif /* defined(__riftathon__SequenceGenerator__) */