6 Commits
Author SHA1 Message Date
owner 8fdd4c18fd Validate if roll is higher than 10, and lower than 0 2025-03-26 12:05:45 +01:00
owner c14a29a070 Add comment 2025-03-19 11:58:53 +01:00
owner 3420815c74 Update README.md 2025-03-19 10:56:40 +00:00
owner f076e0e35c Remove unused text file 2025-03-19 11:51:10 +01:00
owner ceddebcd80 Merge pull request 'Remove unused folder' (#5) from cleanup into main
Reviewed-on: #5
2025-03-19 10:50:03 +00:00
owner b285704ae1 Merge pull request 'cleanup' (#4) from cleanup into main
Reviewed-on: #4
2025-03-19 10:48:15 +00:00
9 changed files with 21 additions and 2 deletions
+1
View File
@@ -2,6 +2,7 @@
To run the project, simply follow these steps:
1. `git clone https://git.rbwr.dk/owner/Bowling.git`
2. `cd Bowling/`
2. `docker build -t bowling .`
3. `docker run --rm bowling`
+1
View File
@@ -13,6 +13,7 @@ class NumberHelper {
~NumberHelper() = default;
static vector<int> getRolls(string csv);
static bool validateRolls(vector<int> rolls);
};
+1 -1
View File
@@ -1 +1 @@
2, 3, 5, 4, 9, 1, 2, 5, 3, 2, 4, 2, 3, 3, 4, 6, 10, 3, 2
2, 3, 5, 4, 9, 1, 2, 5, 3, 2, 4, 2, 3, 3, 4, 6, 10, 3, 2,
-1
View File
@@ -1 +0,0 @@
10, 3, 2, 2, 3, 5, 4, 9, 1, 2, 5, 3, 2, 4, 2, 3, 3, 4, 6
+1
View File
@@ -0,0 +1 @@
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
+1
View File
@@ -0,0 +1 @@
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
+1
View File
@@ -7,6 +7,7 @@ string FileReader::getFile(char *path){
string line;
// There is only one line in the file
getline(file, line);
file.close();
+10
View File
@@ -14,4 +14,14 @@ vector<int> NumberHelper::getRolls(string csv){
}
return rolls;
}
bool NumberHelper::validateRolls(vector<int> rolls){
for(int i = 0; i < rolls.size(); ++i) {
if(rolls[i] > 10 || rolls[i] < 0) {
return false;
}
}
return true;
}
+5
View File
@@ -22,6 +22,11 @@ int main(int argc, char *argv[]) {
string file = FileReader::getFile(argv[1]);
vector<int> rolls = NumberHelper::getRolls(file);
if (!NumberHelper::validateRolls(rolls)) {
cerr << "Non-valid number in rolls.";
return 0;
}
PrintFrames::printHeader(rolls);
PrintFrames::printValue(rolls);