From 2da5ad05365fdec9d7fe8ae9a48305d11a522f3c Mon Sep 17 00:00:00 2001 From: AIDAN73 Date: Mon, 20 Feb 2023 11:22:00 -0800 Subject: [PATCH 1/4] added percentageDistribution --- GameDie.cpp | 17 +++++++++++++++++ GameDie.h | 1 + 2 files changed, 18 insertions(+) diff --git a/GameDie.cpp b/GameDie.cpp index d512405..520ce2a 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -44,3 +44,20 @@ int GameDie::roll() vector GameDie::get_distribution(){ return counter; } + + +//return the percentage distribution of rolls +vector GameDie::get_distribution_percentage() +{ + vector percentages; + int numRolls = 0; + for (int i=0; i get_distribution(); + vector get_distribution_percentage(); private: vector counter; From d0e58df49fb6d879d132981d230b7a221dc9a165 Mon Sep 17 00:00:00 2001 From: AIDAN73 <46492408+AIDAN73@users.noreply.github.com> Date: Mon, 20 Feb 2023 11:32:41 -0800 Subject: [PATCH 2/4] set up continuous integration, resolve #107 --- .github/workflows/actions.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/actions.yaml diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml new file mode 100644 index 0000000..acebb86 --- /dev/null +++ b/.github/workflows/actions.yaml @@ -0,0 +1,23 @@ +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++ main.cpp -std=c++17 -Wall -Wextra -Werror -o hello From aa57f726c2b5279882c32d7d0470eb72b2183423 Mon Sep 17 00:00:00 2001 From: AIDAN73 Date: Mon, 20 Feb 2023 11:38:37 -0800 Subject: [PATCH 3/4] added comments for percentageDistribution, resolve #106 --- GameDie.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameDie.cpp b/GameDie.cpp index 520ce2a..d291c50 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -59,5 +59,5 @@ vector GameDie::get_distribution_percentage() { percentages[i] = (counter[i]/numRolls) * 100; } - return percentages; + return percentages; //return the vector of percentages } From 74ff0cef74889b50dd151aeb163566e75f990e11 Mon Sep 17 00:00:00 2001 From: AIDAN73 <46492408+AIDAN73@users.noreply.github.com> Date: Mon, 20 Feb 2023 11:49:58 -0800 Subject: [PATCH 4/4] added status badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a8fe2c..3491bee 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Build C++](https://github.com/AIDAN73/GameDie/actions/workflows/actions.yaml/badge.svg)](https://github.com/AIDAN73/GameDie/actions/workflows/actions.yaml) # GameDie This repository provides a class that represents a game die, such as the @@ -23,4 +24,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`