diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..774afda --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,24 @@ +name: Build C++ + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y -f build-essential g++ cmake + build: + needs: install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build project + run: g++ GameDie.cpp -std=c++17 -Wall -Wextra -Werror -o gameDie + diff --git a/GameDie.cpp b/GameDie.cpp index d512405..cccc70c 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -7,10 +7,10 @@ GameDie::GameDie() { srand(time(NULL)); - counter.resize(FACES); + roll_counter.resize(FACES); for(int i=0; i GameDie::get_distribution(){ - return counter; + return roll_counter; +} + +vector GameDie::get_percentages(){ + percentages.resize(FACES); + for(int i = 0; i < FACES; i++){ + percentages[i] = + } + } diff --git a/GameDie.h b/GameDie.h index 54d69ba..c77ea76 100644 --- a/GameDie.h +++ b/GameDie.h @@ -11,9 +11,11 @@ class GameDie GameDie(unsigned int); int roll(); vector get_distribution(); - + vector get_percentages(); + private: - vector counter; + vector percentage; + vector roll_counter; const static int FACES = 6; }; diff --git a/README.md b/README.md index 9a8fe2c..ffcf2a8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build C++](https://github.com/gadhiaeesha/GameDie/actions/workflows/actions.yml/badge.svg)](https://github.com/gadhiaeesha/GameDie/actions/workflows/actions.yml) + # GameDie This repository provides a class that represents a game die, such as the @@ -23,4 +25,4 @@ Once built, run the image: ...or run it with a bind mount to the current source code: -`docker run --mount type=bind,source="$(pwd)",target=/usr/src -it cpp-container` \ No newline at end of file +`docker run --mount type=bind,source="$(pwd)",target=/usr/src -it cpp-container`