-
Notifications
You must be signed in to change notification settings - Fork 0
/
Board.h
88 lines (68 loc) · 2.64 KB
/
Board.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef BOARD_H
#define BOARD_H
/* Board.h
* This class is used to represent the Board aspect of the Yahtzee game.
* This holds 5 Die, a Canister, and Scorer object to do all of the
* operations.
*/
// #Include library files.
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include "Die.h"
#include "Canister.h"
#include "Scorer.h"
using namespace std;
// Number of dice available for Yahtzee game.
const int NUM_DICE = 5;
// Number of labels used for all of the different items on the scorecard.
const int NUM_LABELS = 16;
// The labels for the scorecard.
const string LABELS[] = {"Ones", "Twos", "Threes", "Fours", "Fives", "Sixes",
"Sum", "Bonus", "3 Of A Kind", "4 Of A Kind",
"Full House", "Small Straight", "Large Straight",
"Chance", "Yahtzee", "Total Score"};
class Board
{
public:
// Constructor
// Used to create the Board object.
Board();
// Destructor
// Used to destroy all objects inside of the Board.
~Board();
// Print()
// Used to print all dice, scores, and labels to the screen.
void print();
// TakeTurn()
// Used to take one turn (one dice roll) for the game.
// Makes changes to die in dicePos.
void takeTurn(int *dicePos, int numChanges);
// SetScore()
// Used to set the score of a particular label such as "4 Of A Kind"
bool setScore(int pos);
// GetTotal()
// Used to get the total set score of Yahtzee game.
int getTotal();
// PrintHint()
// Used to get a hint for the current situation (if hints are activated).
void printHint(int *choices, int size);
private:
Die **group; // 5 Dice Used in the Game.
Canister *canister; // Canister to mix/roll dice.
Scorer *scorer; // Scorer to do all scoring jobs.
list<int> *currScores; // Current Scores for this turn.
vector<int> *setScores; // Scores that are already finished.
// PrintDiceGroup()
// Used to print all 5 dices next to each other.
void printDiceGroup();
// LoadScores()
// Used to load the correct values into currScores and setScores.
void loadScores();
// SumItems()
// Returns the sum of the items if they are all finished.
// Otherwise, return -1.
int sumItems(int start, int end);
};
#endif /* BOARD_H */