@@ -42,7 +42,7 @@ int get_terminal_width(void){
4242
4343// End credit
4444
45- inline float calculateMean (std::vector<float >& times, int count=0 )
45+ inline float calculateMean (std::vector<float >& times, int count=0 , bool punishDNFs= false )
4646{
4747 float avg = 0 .00f ;
4848
@@ -53,6 +53,16 @@ inline float calculateMean(std::vector<float>& times, int count=0)
5353
5454 for (float n : times)
5555 {
56+ if (punishDNFs){
57+ if (n == std::numeric_limits<float >::max ()){
58+ return -1 ;
59+ }
60+ } else {
61+ if (n == std::numeric_limits<float >::max ()){
62+ count--;
63+ continue ;
64+ }
65+ }
5666 avg += n;
5767 }
5868
@@ -86,7 +96,7 @@ inline float calculateAvg(std::vector<float>& times, size_t count=0)
8696 latestTimes.erase (latestTimes.end () - 1 );
8797 }
8898
89- return calculateMean (latestTimes);
99+ return calculateMean (latestTimes, latestTimes. size (), true );
90100}
91101
92102void appendAvg (std::vector<std::string>& scrambleLines, float avg, std::string avgName)
@@ -115,7 +125,13 @@ void appendAvg(std::vector<std::string>& scrambleLines, float avg, std::string a
115125 avg = 0 .00f ;
116126 }
117127
118- std::string avgAsStr = outputTimePretty (avg);
128+ std::string avgAsStr;
129+
130+ if (avg == -1 ){
131+ avgAsStr = " DNF" ;
132+ } else {
133+ avgAsStr = outputTimePretty (avg);
134+ }
119135
120136 if (scrambleLines.size () < level+1 )
121137 {
@@ -279,4 +295,5 @@ void outputVersion()
279295 std::cout << " Added next or skip to skip." << std::endl;
280296 std::cout << " Un-\" fixed\" a warning." << std::endl;
281297 std::cout << " Fixed bug with getting mean when saving to a file." << std::endl;
298+ std::cout << " Made you get punished for DNFs." << std::endl;
282299}
0 commit comments