comparison TrainingScoreManager.h @ 36:146033869165

ISSR fixed colors for stages more repetitions
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 02 Dec 2014 13:25:48 +0000
parents 3b10a26da293
children 52dbd5b4cfa9
comparison
equal deleted inserted replaced
35:3b10a26da293 36:146033869165
41 vector<int> startPosition, 41 vector<int> startPosition,
42 vector<int> answer, 42 vector<int> answer,
43 int timeAllowed, 43 int timeAllowed,
44 int difficulty, 44 int difficulty,
45 int whichInSequence, 45 int whichInSequence,
46 int presetIndex) { 46 int presetIndex,
47 int tempoLevel,
48 int runNumber) {
47 TrainingTestResult result; 49 TrainingTestResult result;
48 stringstream msg; 50 stringstream msg;
49 int score = 0; 51 int score = 0;
50 // work out euc distance from actual point 52 // work out euc distance from actual point
51 //for_each(answer.begin(),answer.end(),printThing<int>()); 53
52 //for_each(targetParams.begin(),targetParams.end(),printThing<int>()); 54 float initDist = euclideanDistance(targetParams, startPosition);
53 float initDist = euclideanDistance(startPosition, answer);
54 float dist = euclideanDistance(targetParams, answer); 55 float dist = euclideanDistance(targetParams, answer);
56 if (initDist <= 0) {
57 initDist = 0.001;
58 }
59 if (dist <= 0) dist = 0.001;
55 float TP = calculateThroughput(TOTAL_NUM_PARAMS, dist, initDist, timeAllowed/1000.); 60 float TP = calculateThroughput(TOTAL_NUM_PARAMS, dist, initDist, timeAllowed/1000.);
61 cout << "Preset index " << presetIndex << endl;
62 cout << "whichInSequence " << whichInSequence << endl;
56 63
57 auto dimComp = sqrt(TOTAL_NUM_PARAMS); 64 auto dimComp = sqrt(TOTAL_NUM_PARAMS);
58 int band = -1; 65 int band = -1;
59 if (dist < TARGET_SCORE_CC_BAND*dimComp){ 66 if (dist < TARGET_SCORE_CC_BAND*dimComp){
60 67
124 }else{ 131 }else{
125 c = ofColor(0,0,0,255); // black worst 132 c = ofColor(0,0,0,255); // black worst
126 } 133 }
127 result.colorBand = c; 134 result.colorBand = c;
128 135
129 totalScored += score; 136 if(score > 0) totalScored += score;
137
130 138
131 vector<int> details; 139 vector<int> details;
132 140
133 details.push_back(result.realDistanceToTarget*1000); 141 details.push_back(result.realDistanceToTarget*1000);
134 details.push_back(result.targetBandHit); 142 details.push_back(result.targetBandHit);
136 details.push_back(result.score); // 10 x throughput 144 details.push_back(result.score); // 10 x throughput
137 details.push_back(difficulty); 145 details.push_back(difficulty);
138 details.push_back(whichInSequence); 146 details.push_back(whichInSequence);
139 details.push_back(initDist*1000); 147 details.push_back(initDist*1000);
140 details.push_back(presetIndex); 148 details.push_back(presetIndex);
141 149 details.push_back(tempoLevel);
150 details.push_back(runNumber);
142 eventLogger.logEvent(TRAINING_RESULT, details); 151 eventLogger.logEvent(TRAINING_RESULT, details);
143 details.clear(); 152 details.clear();
144 details.insert(details.begin(), targetParams.begin(), targetParams.end()); 153 details.insert(details.begin(), targetParams.begin(), targetParams.end());
145 details.insert(details.end(), answer.begin(), answer.end()); 154 details.insert(details.end(), answer.begin(), answer.end());
146 eventLogger.logEvent(TARGET_AND_MATCH, details); 155 eventLogger.logEvent(TARGET_AND_MATCH, details);
147 156
148 return result; 157 return result;
149 } 158 }
150 159
151 int getScore(){return totalScored;}; 160 int getScore(){
161 cout << "RUNNING SCORE: " << totalScored << endl;
162 return totalScored;
163 };
152 164
153 private: 165 private:
154 166
155 167
156 float calculateThroughput(int numDims, float endDistance, float startDistance, float time) const{ 168 float calculateThroughput(int numDims, float endDistance, float startDistance, float time) const{
157 if (startDistance == 0) startDistance = 1; 169
158 if (endDistance == 0) endDistance = 1;
159 float ISSR = numDims * log2( startDistance / endDistance); 170 float ISSR = numDims * log2( startDistance / endDistance);
160 cout << "==========Result======= " << endl; 171 cout << "==========Result======= " << endl;
161 cout << "start: " << startDistance << endl; 172 cout << "start: " << startDistance << endl;
162 cout << "end: " << endDistance << endl; 173 cout << "end: " << endDistance << endl;
163 cout << "ISSR: " << ISSR << endl; 174 cout << "ISSR: " << ISSR << endl;