-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDice.hpp
42 lines (37 loc) · 1.07 KB
/
Dice.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef DICE_H
#define DICE_H
#include <array>
#include <vector>
#include <map>
// TODO: Make singleton with getInstance call that only allows 1 instance
class Dice{
private:
std::array<int, 5> _dice;
// Sums for each dice value eg. 4 ones: {1:4},...
std::map<int, int> scoringValues;
// Update values of scoring options based on current dice configuration.
void updateScoreValues();
// Change score values back to 0 before next update of their values.
void resetScoreValues();
void resetScoreOptions();
void createDice();
bool threeOfAKind = false;
bool fourOfAKind = false;
bool smallStraight = false;
bool largeStraight = false;
bool fullHouse = false;
bool yahtzee = false;
public:
Dice();
const int DICE_AMOUNT = 5;
void rollDice(std::vector<int> diceToKeep);
// Get number of times a die landed on a given number
int getValueFrequency(int die);
bool hasThreeOfAKind();
bool hasFourOfAKind();
bool hasSmallStraight();
bool hasLargeStraight();
bool hasFullHouse();
bool hasYahtzee();
};
#endif