From aa81717fd978ee12381f7ed1eabfb706d70cd2a8 Mon Sep 17 00:00:00 2001 From: rasmus Date: Thu, 27 Mar 2025 12:26:17 +0100 Subject: [PATCH] Removing the redundant score calculation from parseValues, as the overarching logic is the same as the calculateScore function --- src/PrintFrames.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/PrintFrames.cpp b/src/PrintFrames.cpp index 6f28fc8..6ba206a 100644 --- a/src/PrintFrames.cpp +++ b/src/PrintFrames.cpp @@ -14,8 +14,6 @@ string PrintFrames::parseValue(vector frames) { string value; stringstream ss; - int score = 0; - // There can only be 10 frames. for (int i = 0; i < 10; i++) { ss << "|"; @@ -39,8 +37,6 @@ string PrintFrames::parseValue(vector frames) { // If the next frame has 3 or 2 rolls, then take those 2. if (frames[i + 1].Roll.size() > 1) { - //score += frames[i].Roll[0] + frames[i + 1].Roll[0] + frames[i + 1].Roll[1]; - if (frames[i + 1].Roll[0] == 10 && frames[i + 1].Roll[1] != 10) { ss << "X, " << frames[i + 1].Roll[0] << " "; } @@ -58,7 +54,6 @@ string PrintFrames::parseValue(vector frames) { } // Both next frames, that are not the last, are 10. - //score += frames[i].Roll[0] + frames[i + 1].Roll[0] + frames[i + 2].Roll[0]; ss << "X "; continue; @@ -67,18 +62,15 @@ string PrintFrames::parseValue(vector frames) { // Spare if (frames[i].Roll[0] + frames[i].Roll[1] == 10) { if (frames[i].Roll.size() == 3) { - score += frames[i].Roll[0] + frames[i].Roll[1] + frames[i].Roll[2]; ss << frames[i].Roll[0] << ", / "; continue; } - //score += 10 + frames[i + 1].Roll[0]; ss << frames[i].Roll[0] << ", /"; continue; } // Open frame - //score += frames[i].Roll[0] + frames[i].Roll[1]; if (i == 9) { ss << frames[i].Roll[0] << ", " << frames[i].Roll[1] << " "; } else {