-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
728 lines (497 loc) · 22.9 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
#include <iostream>
#include <Windows.h>
#include <shellapi.h>
#include <vector>
#include "Deck.h"
#include "Player.h"
#include "Dealer.h"
#include <thread>
#include <mutex>
#include <future>
#include <iostream>
#include <fstream>
#include <chrono>
#include "global.h"
#include "farm.h"
#include "sim_task.h"
#include "task.h"
std::pair ace = std::make_pair(1,"ACE");
std::pair two = std::make_pair(2,"TWO");
std::pair three = std::make_pair(3,"THREE");
std::pair four = std::make_pair(4,"FOUR");
std::pair five = std::make_pair(5,"FIVE");
std::pair six = std::make_pair(6,"SIX");
std::pair seven = std::make_pair(7,"SEVEN");
std::pair eight = std::make_pair(8,"EIGHT");
std::pair nine = std::make_pair(9,"NINE");
std::pair ten = std::make_pair(10,"TEN");
std::pair jack = std::make_pair(10,"JACK");
std::pair queen = std::make_pair(10,"QUEEN");
std::pair king = std::make_pair(10,"KING");
std::vector<std::pair<std::pair<int, std::string>,std::pair<int, std::string>>> player_cards;
std::vector<std::pair<int, std::string>> dealer_cards;
std::vector<std::vector<int>> results = {};
std::mutex result_mutex;
std::condition_variable ready_cv;
std::mutex ready_mutex;
bool ready = false;
int deckAmount = 0;
typedef std::chrono::steady_clock the_clock;
the_clock::time_point start = the_clock::now();
int BlackJackRound(){
int deckAmount = 1;
std::pair<int, std::string> currentCard;
std::string playerName, choice;
bool game_over = false, chosen = false, player_stand = false, card_revealed = false, p_blackjack = false, p_bust = false, d_blackjack = false, d_bust = false;
std::cout << "\nPlease enter the Players Name: ";
std::cin >> playerName;
Player player(playerName);
Dealer dealer;
std::cout << "\nPlease enter the amount of decks should be in the stack: ";
std::cin >> deckAmount;
Deck deck(deckAmount);
//deck.print_deck();
std::cout << "\nShuffling the deck.\n";
deck.shuffle_deck();
//deck.print_deck();
std::cout << "\nDistributing initial set.\n";
currentCard = deck.drawCard();
player.add_card(currentCard);
player.print_hand();
currentCard = deck.drawCard();
dealer.add_card(currentCard);
dealer.print_hand();
currentCard = deck.drawCard();
player.add_card(currentCard);
player.print_hand();
currentCard = deck.drawCard();
dealer.add_card(currentCard);
dealer.print_half_hand();
if (player.get_value() == 21 && dealer.get_value() == 21){
//player and dealer has blackjack
// std::cout << "\n player and dealer has blackjack\n";
p_blackjack = true;
d_blackjack = true;
game_over = true;
}
else if (player.get_value() == 21 && dealer.get_value() != 21){
//player got blackjack
// std::cout << "\n player got blackjack\n";
p_blackjack = true;
game_over = true;
}
else if (dealer.get_value() == 21 && player.get_value() != 21 ){
//dealer got blackjack
// std::cout << "\n dealer got blackjack\n";
d_blackjack = true;
game_over = true;
}
while (!game_over){
while (!chosen && !player_stand) {
std::cout << "\nDo you want to Hit (H) or Stand (S): ";
std::cin >> choice;
if (choice == "hit" || choice == "h" || choice == "Hit" || choice == "H"){
//player has hit
currentCard = deck.drawCard();
player.add_card(currentCard);
player.print_hand();
chosen = true;
}
else if (choice == "stand" || choice == "s" || choice == "Stand" || choice == "S"){
//player has chosen stand
player_stand = true;
chosen = true;
}
else{
std::cout << "\nPlease either choose hit or stand by typing either H or S\n";
}
}
chosen = false;
if (player.get_value() == 21 && dealer.get_value() == 21){
//player and dealer has blackjack
// std::cout << "\n player and dealer has blackjack\n";
p_blackjack = true;
d_blackjack = true;
game_over = true;
}
else if (player.get_value() == 21 && dealer.get_value() != 21){
//player got blackjack
// std::cout << "\n player got blackjack\n";
p_blackjack = true;
game_over = true;
}
else if (dealer.get_value() == 21 && player.get_value() != 21 ){
//dealer got blackjack
// std::cout << "\n dealer got blackjack\n";
d_blackjack = true;
game_over = true;
}
else if (player.get_value() > 21){
//player has bust
// std::cout << "\n player has bust\n";
p_bust = true;
game_over = true;
}
else if (dealer.get_value() > 21){
//dealer has bust
//std::cout << "\n dealer has bust\n";
d_bust = true;
game_over = true;
}
else{
//nothing special happened keep playing
//std::cout << "\nothing special happened keep playing\n";
}
if (player_stand){
//dealer will reveal his card and keep drawing until either bust or standing at soft 17
if (!card_revealed){
std::cout << "\nThe dealer reveals his face down card!\n";
dealer.print_hand();
card_revealed = true;
}
if (dealer.get_soft_value() >= 17){
//dealer will stand on soft 17 or higher
//std::cout << "\nThe dealer has soft 17 or higher and will stand\n";
game_over = true;
}
else{
//dealer will keep drawing
currentCard = deck.drawCard();
dealer.add_card(currentCard);
dealer.print_hand();
}
}
}
std::cout << "\nThe round is over and the final hands are as follows:\n";
player.print_hand();
dealer.print_hand();
Sleep(2000);
if (p_blackjack && d_blackjack){
//player and dealer both have blackjacks and therefore have pushed
std::cout << "\nBoth the player and the dealer have hit the blackjack, game is a push and player gets his chips back!\n";
Sleep(2000);
return 3;
}
else if (p_blackjack){
//player has blackjack and takes 1.5 times their bet
std::cout << "\nThe player has hit the blackjack, they get 1.5x of what they bet in addition of original chips!\n";
Sleep(2000);
return 1;
}
else if (d_blackjack){
//dealer has blackjack and player looses their bet
std::cout << "\nThe dealer has hit the blackjack, the player looses their bet!\n";
Sleep(2000);
return 2;
}
else if (p_bust){
//player has gone bust and looses their bet
std::cout << "\nThe player has busted, they loose their bet!\n";
Sleep(2000);
return 2;
}
else if (d_bust){
//dealer has gone bust and player gets back 1x their chips and their original bet
std::cout << "\nThe dealer has busted, the player gets 1x of what they bet in addition of original chips!\n";
Sleep(2000);
return 1;
}
else if (player.get_value() == dealer.get_value()){
//player and dealer have pushed on the same number, the player gets their chips back
std::cout << "\nBoth the player and the dealer have the same number, game is a push and player gets his chips back!\n";
Sleep(2000);
return 3;
}
else if (player.get_value() > dealer.get_value()){
//player has more score than dealer and gets back 1x their chips and their original bet
std::cout << "\nThe player has a higher score than the dealer, the player gets 1x of what they bet in addition of original chips!\n";
Sleep(2000);
return 1;
}
else if (dealer.get_value() > player.get_value()){
//dealer has more score than player and player looses their bet
std::cout << "\nThe dealer has a higher score than the player, the player looses their bet!\n";
Sleep(2000);
return 2;
}
else{
//This should not happen but here is an easter egg.
std::cout << "\nOh no something has gone terribly wrong\n";
ShellExecute(nullptr, "open", "https://www.youtube.com/watch?v=dQw4w9WgXcQ",nullptr, nullptr, SW_SHOWNORMAL);
Sleep(2000);
return 0;
}
}
int simulation_nonpar() {
int deckAmount = 0, sim_a = 0;
results.clear();
std::cout << "\nHow many sims you want to run: ";
std::cin >> sim_a;
std::cout << "\nPlease enter the amount of decks should be in the stack: ";
std::cin >> deckAmount;
// farm.add_task(new SimTask(deckAmount, player_cards[0], dealer_cards[0], "h"));
std::cout << "\nRunning non parallel sim now, please stand by!\n";
the_clock::time_point start = the_clock::now();
for (int s = 0; s < sim_a; s++){
SimTaskNonPar(deckAmount, std::make_pair(five, five), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, five), king, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(five, six), king, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, six), king, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(six, seven), king, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, seven), king, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(seven, eight), king, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, eight), king, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(eight, nine), king, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), ace, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), two, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), three, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), four, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), five, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), six, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), seven, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), eight, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), nine, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), ten, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), jack, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), queen, "h").run();
SimTaskNonPar(deckAmount, std::make_pair(nine, nine), king, "h").run();
}
the_clock::time_point end = the_clock::now();
auto time_taken = duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "\nRunning " << sim_a << " simulations in non parallel (total of " << sim_a*117 << " scenarios) took " << time_taken << " ms!\n";
// for (auto i : results){
//
// for (auto j : i){
//
// std::cout << j << " ";
//
// }
//
// std::cout << "\n";
//
// }
std::ofstream outfile;
outfile.open("outfile.csv");
for (const auto& i : results) {
for (auto j : i) {
// std::cout << j << " ";
outfile << j << ",";
}
outfile << ",\n";
}
outfile.close();
Sleep(5000);
system("pause");
return 0;
}
int simulation() {
int sim_a = 0;
bool valid = false;
while(!valid){
std::cout << "\nHow many sims you want to run: ";
std::cin >> sim_a;
if (sim_a > 68100){
std::cout << "\nSorry you can only run a max of 68,100 simulations!\n";
Sleep(2000);
}
else{
valid = true;
}
}
Farm farm;
farm.add_task(new StartTask());
results.clear();
// farm.add_task(new SimTask(deckAmount, player_cards[0], dealer_cards[0], "h"));
int tmp = 0;
for (int s = 0; s < sim_a; s++){
for (int i = 0; i < 9; i++){
//std::cout << "\nPlayer" << i << "\n";
for (int j = 0; j < 13; j++){
farm.add_task(new SimTask(player_cards[i], dealer_cards[j], "h", tmp));
// if (tmp % 1000 == 0) std::cout << tmp << "\n";
// //std::cout << "\nDealer" << j << "\n";
tmp++;
}
}
}
std::cout << "\nRunning " << farm.size() << " threads now, please stand by!\n";
farm.run();
the_clock::time_point end = the_clock::now();
auto time_taken = duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "\nRunning " << sim_a << " simulations (total of " << sim_a*117 << " scenarios) took " << time_taken << " ms!\n";
// for (auto i : results){
//
// for (auto j : i){
//
// std::cout << j << " ";
//
// }
//
// std::cout << "\n";
//
// }
std::ofstream outfile;
outfile.open("outfile.csv");
for (const auto& i : results) {
for (auto j : i) {
// std::cout << j << " ";
outfile << j << ",";
}
outfile << ",\n";
}
outfile.close();
Sleep(5000);
system("pause");
return 0;
}
int main()
{
int menu_choice = 0, game_result;
bool menu_picked = false;
player_cards.emplace_back(std::make_pair(five,five));
player_cards.emplace_back(std::make_pair(five,six));
player_cards.emplace_back(std::make_pair(six,six));
player_cards.emplace_back(std::make_pair(six,seven));
player_cards.emplace_back(std::make_pair(seven,seven));
player_cards.emplace_back(std::make_pair(seven,eight));
player_cards.emplace_back(std::make_pair(eight,eight));
player_cards.emplace_back(std::make_pair(eight,nine));
player_cards.emplace_back(std::make_pair(nine,nine));
dealer_cards.emplace_back(ace);
dealer_cards.emplace_back(two);
dealer_cards.emplace_back(three);
dealer_cards.emplace_back(four);
dealer_cards.emplace_back(five);
dealer_cards.emplace_back(six);
dealer_cards.emplace_back(seven);
dealer_cards.emplace_back(eight);
dealer_cards.emplace_back(nine);
dealer_cards.emplace_back(ten);
dealer_cards.emplace_back(jack);
dealer_cards.emplace_back(queen);
dealer_cards.emplace_back(king);
while (!menu_picked){
system("cls");
std::cout << "BlackJack Basic Training Simulator\n";
std::cout << "Menu\n\n1. Play round of Black Jack\n2. Run Simulations to Generate Strategy Chart\n3. Run Simulations to Generate Strategy Chart (SingleThread Mode)\n4. Quit";
std::cout << "\nMenu Choice: ";
std::cin >> menu_choice;
switch (menu_choice) {
default:
std::cout << "\nPlease select on of the options in the menu!\n";
Sleep(1000);
break;
case 1:
std::cout << "\nStarting Round of Black Jack\n";
BlackJackRound();
break;
case 2:
std::cout << "\nStarting Simulation\n";
simulation();
break;
case 3:
std::cout << "\nStarting Non Par Simulation\n";
simulation_nonpar();
break;
case 4:
std::cout << "\nQuitting Program\n";
menu_picked = true;
return 0;
}
}
}