From 271c0ffdaa0dbde28868fbdf67f86930a11744cd Mon Sep 17 00:00:00 2001 From: Kevin Buffardi Date: Thu, 16 Feb 2023 21:58:57 -0800 Subject: [PATCH 1/4] Refactor counter as roll_counter --- GameDie.cpp | 16 ++++++++-------- GameDie.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/GameDie.cpp b/GameDie.cpp index d512405..e9fb279 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; } diff --git a/GameDie.h b/GameDie.h index 54d69ba..939e8f7 100644 --- a/GameDie.h +++ b/GameDie.h @@ -13,7 +13,7 @@ class GameDie vector get_distribution(); private: - vector counter; + vector roll_counter; const static int FACES = 6; }; From 0b62b461aa34c5b8ce92856e04b4beb5ac9f8420 Mon Sep 17 00:00:00 2001 From: Eesha Gadhia Date: Mon, 20 Feb 2023 11:39:38 -0800 Subject: [PATCH 2/4] Create actions.yml --- .github/workflows/actions.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/actions.yml 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 + From 9af36f353c0a7e40fc6f559751037b2fc8aa1c08 Mon Sep 17 00:00:00 2001 From: Eesha Gadhia Date: Mon, 20 Feb 2023 11:41:40 -0800 Subject: [PATCH 3/4] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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` From 3cf5a344dd07bf5f74da8510086ab91811b2fbd8 Mon Sep 17 00:00:00 2001 From: gadhiaeesha Date: Mon, 20 Feb 2023 12:06:00 -0800 Subject: [PATCH 4/4] in progress of resolving issue #106 --- GameDie.cpp | 8 ++++++++ GameDie.h | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/GameDie.cpp b/GameDie.cpp index e9fb279..cccc70c 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -44,3 +44,11 @@ int GameDie::roll() vector GameDie::get_distribution(){ 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 939e8f7..c77ea76 100644 --- a/GameDie.h +++ b/GameDie.h @@ -11,8 +11,10 @@ class GameDie GameDie(unsigned int); int roll(); vector get_distribution(); - + vector get_percentages(); + private: + vector percentage; vector roll_counter; const static int FACES = 6; };