-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
52 lines (46 loc) · 1.2 KB
/
main.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
51
52
#include <cassert>
#include "Game.h"
int simpleCompare(int a, int b) {
if(b > 21)
return 1;
if(a > 21)
return -1;
if(a > b)
return 1;
if(a < b)
return -1;
return 0;
}
void testCompare() {
assert(simpleCompare(12, 20) == -1);
assert(simpleCompare(19, 4) == 1);
assert(simpleCompare(21, 21) == 0);
assert(simpleCompare(22, 20) == -1);
assert(simpleCompare(25, 27) == 1);
assert(simpleCompare(5, 20) == -1);
assert(simpleCompare(12, 12) == 0);
assert(simpleCompare(19, 29) == 1);
assert(simpleCompare(25, 25) == 1);
}
void testHighAce() {
Player bob = Player("Bob");
//Ace
bob.addCard(Card(14, 0));
bob.addCard(Card(5, 1));
assert(bob.getHandValue() == 16);
bob.addCard(Card(6, 1));
assert(bob.getHandValue() == 12);
}
int main() {
Game game{5};
game.playGame();
return 0;
}
//TODO
//double down
//split pairs
//input problems, pressing enter twice, printing instructions twice?
//change addCards so that it automatically moves the vector instead of copying it
//user input filtering for negatives and non integer, you lose when 0
//find better way of doing bettors and players
//change recursion?