Fix include folder name, update dockerfile and compile the executable inside the docker container

This commit is contained in:
Rasmus Rasmussen 2025-03-19 10:26:16 +01:00
parent 5ec8a150cd
commit 67d8fa370d
13 changed files with 99 additions and 15 deletions

View File

@ -2,6 +2,10 @@ FROM gcc:latest
WORKDIR /app WORKDIR /app
COPY bin/Bowling /app/ COPY rolls.txt /app/
COPY include/* /app/include/
COPY src/* /app/src/
CMD ["./Bowling"] RUN g++ src/*.cpp -o Bowling
CMD ["./Bowling", "rolls.txt"]

13
include/FileHelper.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef FILEHELPER_H
#define FILEHELPER_H
class FileHelper {
public:
FileHelper();
~FileHelper();
static bool FileExists(char *path);
};
#endif

16
include/FileReader.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef FILEREADER_H
#define FILEREADER_H
#include <string>
#include <vector>
class FileReader {
public:
FileReader();
~FileReader();
static std::string GetFile(char *path);
};
#endif

18
include/NumberHelper.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef NUMBERHELPER_H
#define NUMBERHELPER_H
#include <string>
#include <vector>
using namespace std;
class NumberHelper {
public:
NumberHelper();
~NumberHelper();
static vector<int> GetNumbers(string csv);
};
#endif

18
include/PrintFrames.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef PRINTFRAMES_H
#define PRINTFRAMES_H
#include <vector>
using namespace std;
class PrintFrames {
public:
PrintFrames();
~PrintFrames();
static void PrintHeader(vector<int> rolls);
static void PrintValue(vector<int> rolls);
};
#endif

18
include/ScoreCalculator.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef SCORECALCULATOR_H
#define SCORECALCULATOR_H
#include <string>
#include <vector>
using namespace std;
class ScoreCalculator {
public:
ScoreCalculator();
~ScoreCalculator();
static int GetScore(vector<int> rolls);
};
#endif

View File

@ -1,4 +1 @@
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 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

View File

@ -1,4 +1,4 @@
#include "../Include/FileHelper.h" #include "../include/FileHelper.h"
#include <sys/stat.h> #include <sys/stat.h>
FileHelper::FileHelper() {}; FileHelper::FileHelper() {};

View File

@ -1,4 +1,4 @@
#include "../Include/FileReader.h" #include "../include/FileReader.h"
#include <string> #include <string>
#include <fstream> #include <fstream>

View File

@ -1,4 +1,4 @@
#include "../Include/NumberHelper.h" #include "../include/NumberHelper.h"
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <vector> #include <vector>

View File

@ -1,4 +1,4 @@
#include "../Include/PrintFrames.h" #include "../include/PrintFrames.h"
#include <iostream> #include <iostream>
PrintFrames::PrintFrames() {}; PrintFrames::PrintFrames() {};

View File

@ -1,4 +1,4 @@
#include "../Include/ScoreCalculator.h" #include "../include/ScoreCalculator.h"
ScoreCalculator::ScoreCalculator() {}; ScoreCalculator::ScoreCalculator() {};
ScoreCalculator::~ScoreCalculator() {}; ScoreCalculator::~ScoreCalculator() {};

View File

@ -1,10 +1,10 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "../Include/FileReader.h" #include "../include/FileReader.h"
#include "../Include/FileHelper.h" #include "../include/FileHelper.h"
#include "../Include/NumberHelper.h" #include "../include/NumberHelper.h"
#include "../Include/ScoreCalculator.h" #include "../include/ScoreCalculator.h"
#include "../Include/PrintFrames.h" #include "../include/PrintFrames.h"
using namespace std; using namespace std;