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 e96cb736b5400d2a031d097cf31ba1ca15bc3475 Mon Sep 17 00:00:00 2001 From: Alex Ayala Date: Mon, 20 Feb 2023 11:44:57 -0800 Subject: [PATCH 2/2] added percent feature --- GameDie.cpp | 9 +++++++++ GameDie.h | 1 + 2 files changed, 10 insertions(+) diff --git a/GameDie.cpp b/GameDie.cpp index d512405..e1d3779 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -44,3 +44,12 @@ int GameDie::roll() vector GameDie::get_distribution(){ return counter; } + +vector GameDie::get_percentages(){ + vector p; + for(int i=0;i get_distribution(); + vector get_percentages(); private: vector counter;