forked from Mordequess/CS247_Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathT_Harness.cpp
42 lines (35 loc) · 997 Bytes
/
T_Harness.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
#include <iostream>
#include "Straights.h"
using namespace std;
int main() {
Straights game = Straights(0); //*** retrieve input from std::string[args]?
bool end = false;
while (!end) {
game.nextRound();
int whosTurn = game.getFirstPlayer();
//play out every card till no more in hand
for (int i = 0; i < 52; i++) {
try {
game.playerTurn( (whosTurn+i)%4 );
}
//check if quit command is called
catch (std::string e) {
end = true;
break;
}
}
//check if quit command is called
if (end) break;
game.updateScores();
end = game.checkEnd();
}
//check for ties
int winScore = game.getMinScore();
for (int i = 0; i < 4; i++) {
if (game.getScore(i) == winScore) std::cout << "Player " << i + 1 << " wins!" << std::endl;
}
}
/*
PLAYED SHOWS ADDRESS
Implement is Valid
*/