forked from ChicoState/PigsGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
69 lines (53 loc) · 1.19 KB
/
Main.cpp
File metadata and controls
69 lines (53 loc) · 1.19 KB
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
#include "Player.h"
#include "AI.h"
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
srand(time(NULL));
Player Player1;
AI Computer1;
Dice Die;
while (!(Player1.Get_Score() >= 100) && !(Computer1.Get_Score() >= 100))
{
int input = 0;
while (!Player1.Get_Hold())
{
cout << "Roll Dice(1) or Hold(2)?" << endl;
cin >> input;
if (input == 1)
{
int tmp = Player1.RollDie(&Die);
cout << "Dice Rolled a: " << tmp << endl;
cout << "Running Score is: " << Player1.Get_TempScore() << endl;
cout << "Current Overall Score is: " << Player1.Get_Score() << endl;
}
else if (input == 2)
{
Player1.Set_Hold(true);
cout << "New Overall Score: " << Player1.Get_Score() << endl;
}
}
cout << endl;
while (!Computer1.Get_Hold())
{
cout << "Computers Rolls: " << Computer1.RollDie(&Die) << endl;
}
cout << "Computers New Overall Score: " << Computer1.Get_Score() << endl;
cout << endl;
Player1.Set_Hold(false);
Computer1.Set_Hold(false);
}
if (Player1.Get_Score() >= 100)
{
cout << "Player One is the winner!!!";
}
else
{
cout << "The Computer is the winner!!!";
}
cin.ignore();
cin.get();
return 0;
}