-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDice.cpp
50 lines (44 loc) · 830 Bytes
/
Dice.cpp
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
/*
* University Of Ottawa
* CSI 2372 Final Project
* Professor : Jochen Lang
* Group Number : 11
* Name : Zekun Li 8520399 Hanyang Yu 8524153
*
*/
#include "Dice.h"
#include "RandomDice.h"
using namespace std;
Dice::Dice(Colour &_colour) : colour(_colour)
{
}
//roll the dice
void Dice::roll()
{
face = rd.getDice();
}
// insertion operator for a single dice
ostream &operator<<(ostream &os, const Dice &d)
{
string colourOut;
switch (d.colour)
{
case Colour::RED:
colourOut = "Red";
break;
case Colour::BLUE:
colourOut = "Blue";
break;
case Colour::YELLOW:
colourOut = "Yellow";
break;
case Colour::GREEN:
colourOut = "Green";
break;
case Colour::WHITE:
colourOut = "White";
break;
}
os << colourOut << " " << d.face;
return os;
}