Mercurial > hg > tweakathon2ios
diff TrainingScoreManager.h @ 32:75202498bee9
perform mode (no guides at all)
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 25 Nov 2014 17:03:33 +0000 |
parents | a677c027e3a0 |
children | 3af380769779 |
line wrap: on
line diff
--- a/TrainingScoreManager.h Fri Nov 21 17:07:56 2014 +0000 +++ b/TrainingScoreManager.h Tue Nov 25 17:03:33 2014 +0000 @@ -14,6 +14,9 @@ //#include "SequenceController.h" #include "algorithms.h" #include "globalVariables.h" +#include "eventLogger.h" + +extern EventLogger eventLogger; //------------------------------------------------------------- struct TrainingTestResult{ @@ -31,7 +34,8 @@ // equiv of score bit of testController public: - TrainingTestResult getScoreForAnswer(vector<int> targetParams, vector<int> startPosition, vector<int> answer, int timeAllowed) const { + + TrainingTestResult getScoreForAnswer(vector<int> targetParams, vector<int> startPosition, vector<int> answer, int timeAllowed) { TrainingTestResult result; stringstream msg; int score = 0; @@ -43,8 +47,6 @@ float TP = calculateThroughput(TOTAL_NUM_PARAMS, dist, initDist, timeAllowed/1000.); - cout << TP << endl; - auto dimComp = sqrt(TOTAL_NUM_PARAMS); int band = -1; if (dist < TARGET_SCORE_CC_BAND*dimComp){ @@ -90,7 +92,7 @@ } msg << "Distance from target: " << dist << endl; - msg << "Basic Score: " << round(TP*10) << endl; + msg << "Score: " << round(TP*10) << endl; msg << "-----" << endl; msg << "Time allowed: " << timeAllowed/1000.0 << endl; @@ -117,17 +119,35 @@ } result.colorBand = c; + totalScored += score; + + vector<int> details; + details.push_back(result.realDistanceToTarget); + details.push_back(result.targetBandHit); + details.push_back(result.timeAllowed); + details.push_back(result.score); // 10 x throughput + + eventLogger.logEvent(TRAINING_RESULT, details); + return result; } + + int getScore(){return totalScored;}; + private: + + float calculateThroughput(int numDims, float endDistance, float startDistance, float time) const{ float ISSR = numDims * log2( startDistance / endDistance); + cout << "==========Result======= " << endl; cout << "start: " << startDistance << endl; cout << "end: " << endDistance << endl; cout << "ISSR: " << ISSR << endl; + cout << "time: " << time << endl; float TP = ISSR / time; + cout << "TP: " << TP << endl; return TP; } float euclideanDistance(vector<int> v1, vector<int> v2) const{ @@ -146,6 +166,7 @@ return sqrt(ans); }; + int totalScored; }; #endif /* defined(__riftathon__TrainingScoreManager__) */