From 271c0ffdaa0dbde28868fbdf67f86930a11744cd Mon Sep 17 00:00:00 2001 From: Kevin Buffardi Date: Thu, 16 Feb 2023 21:58:57 -0800 Subject: [PATCH 1/2] 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 5933358f573aaed0d25b0ca49c85ed9237a62ca6 Mon Sep 17 00:00:00 2001 From: ZenoPsycho Date: Mon, 20 Feb 2023 11:48:30 -0800 Subject: [PATCH 2/2] fixed #106 --- GameDie.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GameDie.cpp b/GameDie.cpp index e9fb279..ec8da60 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -30,6 +30,7 @@ GameDie::GameDie(unsigned int num) } + //generate a random number between 1-n where n is the counter size // (inclusive) and return it int GameDie::roll() @@ -44,3 +45,8 @@ int GameDie::roll() vector GameDie::get_distribution(){ return roll_counter; } + +//Percentage function +vector GameDie::getpercentage(){ + return counter; +}