-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
136 lines (97 loc) · 3.88 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#include <iostream>
#include <string>
#include "BlackJackBot_lib/StrategyGuideHandler.h"
#include "BlackJackBot_lib/Shoe.h"
#include "BlackJackBot_lib/Card.h"
#include "BlackJackBot_lib/PlayerHand.h"
#include "BlackJackBot_lib/DealerHand.h"
#include "BlackJackBot_lib/PlayerBot.h"
#include "BlackJackBot_lib/Table.h"
#include "BlackJackBot_lib/HouseRules.h"
#include "StrategyGuideGenerator.h"
#include "GeneticAlgorithmManager.h"
//#include <filesystem>
//Test loading, editing, and saving a .csv into the strategyguidehandler
void testStrategyGuideHandler();
//Test drawing cards from a shoe and shuffling
void testShoe();
//Test giving the player bot a hand and getting a response
void testPlayerBot();
//Test running a table
void testTable();
void testGuideGeneration();
void testGeneticAlgorithm();
using namespace std;
int main() {
//testStrategyGuideHandler();
//testShoe();
//testPlayerBot();
//testTable();
//testGuideGeneration();
testGeneticAlgorithm();
return 0;
}
void testStrategyGuideHandler() {
StrategyGuideHandler newStrategy;
newStrategy.loadStrategyGuide(R"(C:\Users\small\CLionProjects\BasicStrategySolver\Book1.csv)");
cout << "The entry is: " << newStrategy.getEntry("PH", 11) << endl;
//newStrategy.editEntry("PH", 7, "Monkey");
newStrategy.saveStrategyGuide(R"(C:\Users\small\CLionProjects\BasicStrategySolver\Book2.csv)");
}
void testShoe(){
Shoe shoe(4, .5, .7);
/*for (int i = 0; i < 5; ++i) {
cout << shoe.drawCard().toString() << endl;
}*/
while (!shoe.tryShuffle()) {
//cout << shoe.drawCard().toString() << endl;
shoe.drawCard();
}
shoe.doShuffle();
while (!shoe.tryShuffle()) {
//cout << shoe.drawCard().toString() << endl;
shoe.drawCard();
}
}
void testPlayerBot(){
StrategyGuideHandler newStrategy;
newStrategy.loadStrategyGuide(R"(C:\Users\small\CLionProjects\BasicStrategySolver\Book1.csv)");
float bankRoll = 500;
DealerHand dealerHand;
PlayerHand playerHand(50);
Shoe shoe(4, .5, .7);
playerHand.addCard(shoe.drawCard());
dealerHand.addHiddenCard(shoe.drawCard());
playerHand.addCard(shoe.drawCard());
dealerHand.addCard(shoe.drawCard());
PlayerBot playerBot(bankRoll, newStrategy);
playerBot.getPlayerAction(playerHand, dealerHand);
}
void testTable(){
StrategyGuideHandler newStrategy;
//newStrategy.loadGuide("ActualStrategy.csv");
newStrategy.loadStrategyGuide(R"(C:\Users\small\CLionProjects\BasicStrategySolver\ActualStrategy.csv)");
float bankRoll = 5000;
PlayerBot playerBot(bankRoll, newStrategy);
Table table(playerBot);
//table.playGame();
table.runGameTesting(100000);
//cout << "Results: " << newStrategy.getResults() << endl;
//StrategyGuideHandler newStrategy2(R"(C:\Users\small\CLionProjects\BasicStrategySolver\)");
//newStrategy.loadStrategyGuide("Book1.csv");
//PlayerBot playerBot2(bankRoll, newStrategy2);
//Table table2(playerBot2);
//table.runGameTesting(100000);
//table.startGame();
}
void testGuideGeneration(){
StrategyGuideGenerator strategyGuideGenerator;
strategyGuideGenerator.createRandomGuideFile(R"(C:\Users\small\CLionProjects\BasicStrategySolver\RandomGuide1.csv)");
strategyGuideGenerator.createRandomGuideFile(R"(C:\Users\small\CLionProjects\BasicStrategySolver\RandomGuide2.csv)");
strategyGuideGenerator.mergeTwoGuides(R"(C:\Users\small\CLionProjects\BasicStrategySolver\RandomGuide1.csv)", R"(C:\Users\small\CLionProjects\BasicStrategySolver\RandomGuide2.csv)", R"(C:\Users\small\CLionProjects\BasicStrategySolver\RandomGuide3.csv)", true);
}
void testGeneticAlgorithm(){
//cout << HouseRules::toString() << endl;
GeneticAlgorithmManager geneticAlgorithmManager;
geneticAlgorithmManager.runGeneticAlgorithm(R"(C:\Users\small\CLionProjects\BasicStrategySolver\GA_Testing\Root)", 1000, 50, 50);
}