diff 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
line wrap: on
line diff
--- a/TrainingScoreManager.h	Wed Nov 26 18:18:20 2014 +0000
+++ b/TrainingScoreManager.h	Tue Dec 02 13:25:48 2014 +0000
@@ -43,16 +43,23 @@
                                          int timeAllowed,
                                          int difficulty,
                                          int whichInSequence,
-                                         int presetIndex) {
+                                         int presetIndex,
+                                         int tempoLevel,
+                                         int runNumber) {
         TrainingTestResult result;
         stringstream msg;
         int score = 0;
         // work out euc distance from actual point
-        //for_each(answer.begin(),answer.end(),printThing<int>());
-        //for_each(targetParams.begin(),targetParams.end(),printThing<int>());
-        float initDist = euclideanDistance(startPosition, answer);
+
+        float initDist = euclideanDistance(targetParams, startPosition);
         float dist = euclideanDistance(targetParams, answer);
+        if (initDist <= 0) {
+            initDist = 0.001;
+        }
+        if (dist <= 0) dist = 0.001;
         float TP = calculateThroughput(TOTAL_NUM_PARAMS, dist, initDist, timeAllowed/1000.);
+        cout << "Preset index " << presetIndex << endl;
+        cout << "whichInSequence " << whichInSequence << endl;
         
         auto dimComp = sqrt(TOTAL_NUM_PARAMS);
         int band = -1;
@@ -126,7 +133,8 @@
         }
         result.colorBand = c;
 
-        totalScored += score;
+        if(score > 0) totalScored += score;
+        
         
         vector<int> details;
         
@@ -138,7 +146,8 @@
         details.push_back(whichInSequence);
         details.push_back(initDist*1000);
         details.push_back(presetIndex);
-        
+        details.push_back(tempoLevel);
+        details.push_back(runNumber);
         eventLogger.logEvent(TRAINING_RESULT, details);
         details.clear();
         details.insert(details.begin(), targetParams.begin(), targetParams.end());
@@ -148,14 +157,16 @@
         return result;
     }
     
-    int getScore(){return totalScored;};
+    int getScore(){
+        cout << "RUNNING SCORE: " << totalScored << endl;
+        return totalScored;
+    };
     
 private:
     
     
     float calculateThroughput(int numDims, float endDistance, float startDistance, float time) const{
-        if (startDistance == 0) startDistance = 1;
-        if (endDistance == 0) endDistance = 1;
+
         float ISSR = numDims * log2( startDistance / endDistance);
         cout << "==========Result======= " << endl;
         cout << "start: " << startDistance << endl;