Restored from backup.

This commit is contained in:
2025-02-20 19:01:27 +00:00
commit 59bdaca8e7
51 changed files with 2068 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
{
"files.associations": {
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"chrono": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
}
}
+4
View File
@@ -0,0 +1,4 @@
all: build
build:
./build.py
+9
View File
@@ -0,0 +1,9 @@
# Game documentation
## bet
This is a bet semulator what ends every first bet. This will speed up your learning progres and how confident you can be.
### bet_flipflop
This is the same as bet but already three cards open.
Executable
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env python3
import os
executables = [name for name in os.listdir() if len(name.split(".")) == 1]
print(executables)
for executable in executables:
os.system("./" + executable)
Executable
BIN
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+59
View File
@@ -0,0 +1,59 @@
#include <iostream>
#include "../game.hpp"
#include "../gui.hpp"
#include "../player.hpp"
void cls() {
for(int i = 0; i < 100; i++){
std::cout << std::endl;
}
}
int main() {
int playerCount = 3;
Game game(playerCount);
CardGui gui;
while(true){
cls();
game.playTheFlop();
int blind = 20;
Player player = game.players[playerCount-1];
std::cout << game.players[playerCount-1].name;
std::cout << " Chips: " << player.chips;
std::cout << " Wins: " << player.wins;
std::cout << gui.renderCards(game.communityCards);
std::cout << gui.renderCards(player.cards) << std::endl;
int raiseAmount = 0.05 * player.chips;
std::cout << "Raise amount: ";
std::cin >> raiseAmount;
if(raiseAmount == 0)
raiseAmount = 20;
if(game.bestPlayer.name == player.name){
game.players[playerCount-1].chips += raiseAmount;
}else{
game.players[playerCount-1].chips -= raiseAmount;
}
cls();
std::cout << game.players[playerCount-1].name;
std::cout << " Chips: " << game.players[playerCount-1].chips;
std::cout << " Wins: " << game.players[playerCount-1].wins;
std::cout << gui.renderCards(game.communityCards);
std::cout << gui.renderCards(game.bestPlayer.cards) << std::endl;
std::cout << game.bestPlayer.name << ": " << game.bestPlayer.score.name << std::endl;
std::string buff;
std::getline(std::cin, buff, '\n');
std::getline(std::cin, buff, '\n');
}
return 0;
}
BIN
View File
Binary file not shown.
+57
View File
@@ -0,0 +1,57 @@
#include <iostream>
#include "../game.hpp"
#include "../gui.hpp"
#include "../player.hpp"
void cls() {
for(int i = 0; i < 100; i++){
std::cout << std::endl;
}
}
int main() {
int playerCount = 3;
Game game(playerCount);
CardGui gui;
while(true){
cls();
game.playTheFlop();
int blind = 20;
Player player = game.players[playerCount-1];
std::cout << game.players[playerCount-1].name;
std::cout << " Chips: " << player.chips;
std::cout << " Wins: " << player.wins;
std::cout << gui.renderCards(player.cards) << std::endl;
int raiseAmount = 0.05 * player.chips;
std::cout << "Raise amount: ";
std::cin >> raiseAmount;
if(raiseAmount == 0)
raiseAmount = 20;
if(game.bestPlayer.name == player.name){
game.players[playerCount-1].chips += raiseAmount;
}else{
game.players[playerCount-1].chips -= raiseAmount;
}
cls();
std::cout << game.players[playerCount-1].name;
std::cout << " Chips: " << game.players[playerCount-1].chips;
std::cout << " Wins: " << game.players[playerCount-1].wins;
std::cout << gui.renderCards(game.communityCards);
std::cout << gui.renderCards(game.bestPlayer.cards) << std::endl;
std::cout << game.bestPlayer.name << ": " << game.bestPlayer.score.name << std::endl << std::endl;
std::string buff;
std::getline(std::cin, buff, '\n');
std::getline(std::cin, buff, '\n');
}
return 0;
}
Executable
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
import time
import os
source_files = [name for name in os.listdir() if name[-4:] == ".cpp"]
print(source_files)
for executable in source_files:
cmd = f"g++ {executable} -o {executable[:-4]}"
print(f"Executing {cmd}", end="",flush=True)
tstart = time.time()
os.system(cmd)
tend = time.time()
duration = tend - tstart
print(f" took {duration} seconds")
BIN
View File
Binary file not shown.
+69
View File
@@ -0,0 +1,69 @@
#include "../card.hpp"
#include "../deck.hpp"
double getPairPercentage(double minWorth=0) {
double count = 0;
while(true){
count++;
Deck deck;
auto card1 = deck.getCard();
auto card2 = deck.getCard();
if(card1.worth == card2.worth && card1.worth >= minWorth)
break;
}
return 1 / count * 100;
}
double getPairBatchPercentage(double times=10, double minWorth=0)
{
double total = 0;
double count = 0;
while(times > count) {
count++;
total += getPairPercentage(minWorth);
}
return total / count;
}
double getPairTurns(double minWorth=0) {
double count = 0;
while(true){
count++;
Deck deck;
auto card1 = deck.getCard();
auto card2 = deck.getCard();
if(card1.worth == card2.worth && card1.worth >= minWorth)
break;
}
return count;
}
double getPairBatchTurns(double minWorth=0)
{
double times = 1000;
double total = 0;
double count = 0;
while(times > count) {
count++;
total += getPairTurns(minWorth);
}
return total / count;
}
int main() {
std::cout << "Receiving pair as first hand statistics." << std::endl;
double pairGeneral = getPairBatchPercentage(1000, 0);
std::cout << pairGeneral << "% chance of getting a random pair." << std::endl;
double pairHigh = getPairBatchPercentage(1000, 0.11);
std::cout << pairHigh << "% chance of getting a (J,Q,K,A) pair." << std::endl;
std::cout << pairGeneral - pairHigh << "% difference." << std::endl;
double pairAce = getPairBatchPercentage(1000, 0.14);
std::cout << pairAce << "% chance of getting an Ace pair (or any specific pair)" << std::endl;
return 0;
}
Executable
BIN
View File
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
#include "../game.hpp"
#include "../simulate.hpp"
#include <iostream>
#include <string>
#include "../gui.hpp"
int main() {
CardGui cg;
Game game(2);
while(true)
{
game.play();
std::cout<< cg.renderCards(game.players[0].cards);
std::string cardString = game.players[0].cards[0].key + "," + game.players[0].cards[1].key;
std::cout << std::endl;
double score = simulate(cardString,2000, 2);
std::string line;
std::cout << "Bet? (y/n) ";
std::getline(std::cin, line);
if((line[0] == 'y' and score > 50) or (line[0] == 'n' and score < 50) ){
std::cout << "Correct: " << score << "%" << std::endl;
}else{
std::cout << "Wrong: " << score << "%" << std::endl;;
}
}
return 0;
}
BIN
View File
Binary file not shown.
+44
View File
@@ -0,0 +1,44 @@
#include "../deck.hpp"
#include "../simulate.hpp"
#include <iostream>
#include <iostream>
#include <fstream>
//32.4272
//32.4241
//32.4287
//32.425
//HA,DA 73.7738
//DA,HA 72.5726
int main() {
std::ofstream myfile;
myfile.open ("pair_stats.txt");
Deck deckA("", false);
Deck deckB;
int setsCreated = 0;
double successTotal = 0;
while(deckA.length){
auto cardA = deckA.getCard();
// Want only half of cards in set
if(cardA.kind == "D" || cardA.kind == "H")
continue;
deckB = Deck("", false);
while(deckB.length){
auto cardB = deckB.getCard();
// Want only half of cards in set to prevent dupplication
if(cardB.kind == "S" || cardB.kind == "C")
continue;
std::string cardString = cardA.key + "," + cardB.key;
double success = simulate(cardString,1000, 2);
successTotal += success;
setsCreated++;
std::cout << cardString << " " << success << "%" << std::endl;
myfile << cardString << " " << success << "%" << std::endl;
}
}
double successAverage = successTotal / setsCreated;
std::cout << "Combinations: " << setsCreated << " Average score: " << successAverage << "%" << std::endl;
myfile << "Combinations: " << setsCreated << " Average score: " << successAverage << "%" << std::endl;
myfile.close();
return 0;
}
+5
View File
@@ -0,0 +1,5 @@
C2,D2 68.0681%
C2,D3 21.1211%
C2,D4 23.3233%
C2,D5 21.9219%
C2,D6 25.4254%
BIN
View File
Binary file not shown.
+46
View File
@@ -0,0 +1,46 @@
#include "../deck.hpp"
#include "../simulate.hpp"
#include <iostream>
#include <iostream>
#include <fstream>
//32.4272
//32.4241
//32.4287
//32.425
//HA,DA 73.7738
//DA,HA 72.5726
int main() {
std::ofstream myfile;
myfile.open ("pair_stats_only_winning.txt");
Deck deckA;
Deck deckB;
int setsCreated = 0;
double successTotal = 0;
while(deckA.length){
auto cardA = deckA.getCard();
// Want only half of cards in set
if(cardA.kind == "D" || cardA.kind == "H")
continue;
deckB = Deck();
while(deckB.length){
auto cardB = deckB.getCard();
// Want only half of cards in set to prevent dupplication
if(cardB.kind == "S" || cardB.kind == "C")
continue;
std::string cardString = cardA.key + "," + cardB.key;
double success = simulate(cardString,1000, 2);
successTotal += success;
setsCreated++;
if(success > 50){
std::cout << cardString << " " << success << "%" << std::endl;
myfile << cardString << " " << success << "%" << std::endl;
}
}
}
double successAverage = successTotal / setsCreated;
std::cout << "Combinations: " << setsCreated << " Average score: " << successAverage << "%" << std::endl;
myfile << "Combinations: " << setsCreated << " Average score: " << successAverage << "%" << std::endl;
myfile.close();
return 0;
}
+325
View File
@@ -0,0 +1,325 @@
S5,D5 68.8689%
S5,DK 54.955%
S5,H5 68.969%
S5,HQ 51.2513%
S5,HK 54.955%
S5,HA 59.1592%
S5,DA 60.2603%
S6,HQ 54.5546%
S6,H6 73.7738%
S6,D6 70.5706%
S6,HA 62.0621%
S6,DQ 50.951%
S6,DA 64.0641%
S6,HJ 51.952%
S6,HK 58.8589%
S6,DK 56.5566%
S10,DA 67.4675%
S10,DK 69.2693%
S10,D9 53.2533%
S10,H9 54.7548%
S10,HK 72.3724%
S10,HQ 64.3644%
S10,DQ 64.4645%
S10,D10 87.4875%
S10,HA 71.5716%
S10,DJ 63.964%
S10,H10 87.0871%
S10,D8 51.1512%
S10,H8 51.2513%
S10,HJ 62.4625%
SQ,H6 51.4515%
SQ,H10 64.2643%
SQ,D9 61.4615%
SQ,H5 52.4525%
SQ,HQ 92.4925%
SQ,D6 53.6537%
SQ,D8 58.8589%
SQ,DA 68.8689%
SQ,H9 63.0631%
SQ,H8 57.5576%
SQ,H7 56.3564%
SQ,HK 70.6707%
SQ,DQ 92.2923%
SQ,D7 58.5586%
SQ,DK 71.2713%
SQ,DJ 68.3684%
SQ,HJ 69.7698%
SQ,D10 64.1642%
SQ,HA 68.0681%
C9,HA 68.2683%
C9,D9 82.3824%
C9,HQ 59.7598%
C9,DK 66.3664%
C9,H10 52.6527%
C9,DJ 56.8569%
C9,DA 67.2673%
C9,HJ 59.2593%
C9,H9 86.8869%
C9,D10 52.8529%
C9,DQ 61.1612%
C9,HK 64.7648%
C3,DK 50.951%
C3,HK 50.7508%
C3,D3 66.967%
C3,H3 65.8659%
C3,DA 53.6537%
C3,HA 54.955%
CJ,H10 63.5636%
CJ,HK 68.5686%
CJ,D10 62.1622%
CJ,DA 72.1722%
CJ,D9 57.958%
CJ,D7 52.7528%
CJ,HJ 92.7928%
CJ,H7 50.4505%
CJ,HA 72.5726%
CJ,DJ 91.3914%
CJ,H9 56.8569%
CJ,H8 56.7568%
CJ,DK 68.2683%
CJ,DQ 64.4645%
CJ,HQ 65.8659%
CJ,D8 57.5576%
CQ,DA 73.5736%
CQ,H9 63.0631%
CQ,H8 58.8589%
CQ,H6 55.5556%
CQ,D5 52.5526%
CQ,HQ 94.1942%
CQ,DQ 93.5936%
CQ,DJ 66.0661%
CQ,DK 73.7738%
CQ,H7 57.8579%
CQ,H5 51.1512%
CQ,D10 66.5666%
CQ,H10 63.4635%
CQ,HJ 63.4635%
CQ,HA 73.974%
CQ,D7 55.4555%
CQ,D9 62.8629%
CQ,D8 57.7578%
CQ,D6 53.3534%
CQ,HK 69.2693%
CK,HQ 71.4715%
CK,H9 64.965%
CK,HA 75.6757%
CK,D4 53.954%
CK,DJ 68.5686%
CK,D5 56.7568%
CK,D9 66.1662%
CK,D7 61.0611%
CK,H4 52.2523%
CK,H7 59.2593%
CK,D8 62.8629%
CK,H8 61.7618%
CK,HK 95.2953%
CK,DK 95.4955%
CK,DA 70.6707%
CK,H6 59.5596%
CK,H5 56.0561%
CK,D6 58.7588%
CK,H10 68.5686%
CK,D10 70.0701%
CK,DQ 70.8709%
CK,HJ 67.3674%
SJ,HK 70.0701%
SJ,HQ 65.1652%
SJ,H8 56.5566%
SJ,DK 67.4675%
SJ,D7 52.1522%
SJ,DQ 66.4665%
SJ,HJ 91.3914%
SJ,DJ 90.991%
SJ,D6 50.2503%
SJ,D8 55.6557%
SJ,DA 70.6707%
SJ,D9 60.3604%
SJ,H7 50.7508%
SJ,D10 63.4635%
SJ,HA 68.5686%
SJ,H9 61.3614%
SJ,H10 64.3644%
S9,DJ 58.0581%
S9,D9 85.2853%
S9,HA 70.2703%
S9,HJ 57.0571%
S9,H10 55.956%
S9,HK 65.1652%
S9,D10 53.7538%
S9,DA 64.1642%
S9,HQ 62.1622%
S9,DK 62.8629%
S9,H9 81.982%
S9,DQ 58.6587%
SK,H10 69.3694%
SK,DQ 67.968%
SK,D6 59.4595%
SK,HK 93.8939%
SK,D7 56.957%
SK,D4 50.7508%
SK,H7 61.2613%
SK,H3 50.1502%
SK,H9 65.2653%
SK,H5 53.2533%
SK,DJ 67.968%
SK,H6 59.5596%
SK,D5 53.5536%
SK,HQ 69.6697%
SK,D10 67.6677%
SK,D8 64.3644%
SK,H8 63.6637%
SK,H4 52.7528%
SK,DK 95.2953%
SK,HJ 68.0681%
SK,DA 73.4735%
SK,D9 63.8639%
SK,HA 74.1742%
CA,D6 62.3624%
CA,H3 55.0551%
CA,HQ 70.0701%
CA,D9 66.8669%
CA,H4 56.4565%
CA,DA 96.4965%
CA,H9 66.5666%
CA,D7 66.4665%
CA,D4 57.4575%
CA,H8 66.5666%
CA,HA 96.3964%
CA,DK 73.4735%
CA,HJ 69.8699%
CA,DJ 69.7698%
CA,D10 71.0711%
CA,D8 63.964%
CA,D5 60.2603%
CA,D3 55.4555%
CA,H10 67.8679%
CA,H2 50.3504%
CA,H6 61.3614%
CA,HK 72.5726%
CA,H7 62.4625%
CA,H5 59.4595%
CA,DQ 70.5706%
C10,HA 68.5686%
C10,D9 52.7528%
C10,H10 87.4875%
C10,DJ 60.6607%
C10,DA 67.968%
C10,HQ 61.2613%
C10,D10 87.0871%
C10,HK 66.7668%
C10,H9 51.1512%
C10,DK 67.8679%
C10,D8 50.8509%
C10,HJ 62.4625%
C10,DQ 62.5626%
C10,H8 52.7528%
S3,HA 55.7558%
S3,H3 68.1682%
S3,DA 52.7528%
S3,D3 69.0691%
C2,H2 66.0661%
C2,DA 50.8509%
C2,D2 65.5656%
S7,HQ 56.0561%
S7,D7 73.7738%
S7,DK 57.1572%
S7,DJ 51.3514%
S7,DA 65.8659%
S7,HJ 52.0521%
S7,DQ 55.956%
S7,HA 65.966%
S7,HK 61.1612%
S7,H7 76.1762%
S4,D4 69.3694%
S4,DA 54.5546%
S4,HK 50.4505%
S4,HA 56.5566%
S4,DK 51.5516%
S4,H4 69.6697%
C6,DK 55.8559%
C6,H6 72.973%
C6,HK 58.0581%
C6,HA 60.0601%
C6,HJ 51.3514%
C6,DA 60.2603%
C6,D6 73.0731%
C6,HQ 54.0541%
C6,DQ 52.7528%
S8,HK 62.8629%
S8,H8 79.6797%
S8,HJ 56.2563%
S8,DK 62.963%
S8,DQ 57.6577%
S8,D8 79.98%
S8,HQ 60.7608%
S8,HA 65.5656%
S8,D10 53.954%
S8,DJ 59.8599%
S8,DA 65.2653%
S2,H2 67.8679%
S2,HA 53.0531%
S2,DA 50.8509%
S2,D2 66.1662%
C8,DJ 56.4565%
C8,HA 64.5646%
C8,DK 64.3644%
C8,H8 82.5826%
C8,D8 79.1792%
C8,DQ 62.8629%
C8,H10 51.0511%
C8,DA 69.4695%
C8,HQ 62.0621%
C8,HJ 57.8579%
C8,D10 53.2533%
C8,HK 63.4635%
SA,DJ 69.1692%
SA,D10 67.968%
SA,D2 50.2503%
SA,H9 65.966%
SA,H4 57.8579%
SA,HJ 71.0711%
SA,DQ 72.7728%
SA,HA 95.6957%
SA,D4 58.959%
SA,H7 66.1662%
SA,D5 59.8599%
SA,DA 94.4945%
SA,HQ 72.6727%
SA,H6 62.2623%
SA,H3 53.4535%
SA,H8 65.3654%
SA,D7 64.6647%
SA,D8 64.8649%
SA,DK 74.0741%
SA,H10 71.0711%
SA,D3 51.2513%
SA,D9 69.6697%
SA,D6 64.2643%
SA,HK 71.4715%
SA,H5 58.3584%
C7,HA 63.2633%
C7,H10 50.5506%
C7,D7 73.2733%
C7,HQ 57.6577%
C7,HJ 55.1552%
C7,H7 75.8759%
C7,DA 64.8649%
C7,DQ 54.1542%
C7,DK 63.4635%
C7,DJ 51.6517%
C7,HK 59.0591%
C5,DA 61.5616%
C5,H5 69.6697%
C5,DK 53.5536%
C5,HQ 52.953%
C5,DQ 50.1502%
C5,HK 57.6577%
C5,D5 69.3694%
C5,HA 61.7618%
C4,H4 67.4675%
C4,D4 66.5666%
C4,DA 58.7588%
C4,DK 51.6517%
C4,HA 58.2583%
Combinations: 676 Average score: 49.4598%
BIN
View File
Binary file not shown.
+55
View File
@@ -0,0 +1,55 @@
#include "../deck.hpp"
#include "../simulate.hpp"
#include <iostream>
#include <iostream>
#include <fstream>
#include "../card.hpp"
//32.4272
//32.4241
//32.4287
//32.425
//HA,DA 73.7738
//DA,HA 72.5726
int main() {
std::ofstream myfile;
myfile.open ("pair_stats_value.txt");
Deck deckA;
Deck deckB;
int setsCreated = 0;
double successTotal = 0;
double correct = 0;
double incorrect = 0;
while(deckA.length){
auto cardA = deckA.getCard();
// Want only half of cards in set
deckB = Deck();
while(deckB.length){
auto cardB = deckB.getCard();
// Want only half of cards in set to prevent dupplication
if(cardA.kind == cardB.kind && cardA.value == cardB.value)
continue;
std::string cardString = cardA.key + "," + cardB.key;
double success = simulate(cardString,1000, 2);
bool shouldWin = cardA.worth >= 7 && cardB.worth >= 7;
if(shouldWin && success > 50){
correct++;
}else{
incorrect++;
}
successTotal += success;
setsCreated++;
std::cout << cardString << " " << (cardA.worth + cardB.worth * 100) << " " << success << "%" << std::endl;
myfile << cardString << " " << (cardA.worth + cardB.worth * 100) << " " << success << " %" << std::endl;
}
}
double successAverage = successTotal / setsCreated;
std::cout << "Combinations: " << setsCreated << " Average score: " << successAverage << "%" << std::endl;
myfile << "Combinations: " << setsCreated << " Average score: " << successAverage << "%" << std::endl;
std::cout << "Correct: " << correct << " Incorrect: : " << incorrect << std::endl;
myfile << "Correct: " << correct << " Incorrect: : " << incorrect << std::endl;
myfile.close();
return 0;
}
+2
View File
@@ -0,0 +1,2 @@
H6,D3 3.06 26.2262 %
H6,DK 13.06 60.3604 %
BIN
View File
Binary file not shown.
+28
View File
@@ -0,0 +1,28 @@
#include "../game.hpp"
#include "../gui.hpp"
#include <iostream>
#include <string>
int main() {
Game game(1);
CardGui cg;
while(true){
game.play();
std::cout << cg.renderCards(game.communityCards);
std::cout << cg.renderCards(game.players[0].cards);
std::cout << std::endl;
std::string line;
std::getline(std::cin, line);
if(line == game.players[0].score.name)
std::cout << "Correct: ";
std::cout << game.players[0].score.name << " (" << game.players[0].score.score << ")" << std::endl;
std::getline(std::cin, line);
}
return 0;
}
BIN
View File
Binary file not shown.
+114
View File
@@ -0,0 +1,114 @@
#include "../deck.hpp"
#include "../simulate.hpp"
#include "../game.hpp"
#include <iostream>
#include <iostream>
#include <fstream>
#include <map>
//32.4272
//32.4241
//32.4287
//HA,DA 73.7738
//DA,HA 72.5726
int main() {
int times = 100000;
std::cout << "Statistics on how big the chance is you'll end up winning with certain score" << std::endl;
std::cout << "Lower percentage is better to bet on. High percentage is chance you'll win with this score" << std::endl << std::endl;
std::map<std::string, double> stats = std::map<std::string, double>();
Game game(2);
std::ofstream myfile;
myfile.open ("score_stats.txt");
for(int i = 0; i < times; i++){
game.play();
auto player = game.bestPlayer;
if(stats.find(player.score.name)==stats.end()){
stats[player.score.name] = 0;
}
stats[player.score.name]++;
}
for(auto &kv : stats){
std::cout<< kv.first << " " << kv.second / times * 100 << "% in the showdown" << std::endl;
myfile << kv.first << " " << kv.second / times * 100 << "% in the showdown" << std::endl;
}
std::cout << std::endl;
stats.clear();
game = Game(2);
for(int i = 0; i < times; i++){
game.playTheFlop();
auto player = game.bestPlayer;
if(stats.find(player.score.name)==stats.end()){
stats[player.score.name] = 0;
}
stats[player.score.name]++;
}
for(auto &kv : stats){
std::cout<< kv.first << " " << kv.second / times * 100 << "% in the flop" << std::endl;
myfile << kv.first << " " << kv.second / times * 100 << "% in the flop" << std::endl;
}
myfile.close();
return 0;
}
View File
BIN
View File
Binary file not shown.
+91
View File
@@ -0,0 +1,91 @@
#include "../deck.hpp"
#include "../simulate.hpp"
#include "../game.hpp"
#include <iostream>
#include <iostream>
#include <fstream>
#include <map>
//32.4272
//32.4241
//32.4287
//HA,DA 73.7738
//DA,HA 72.5726
int main() {
int times = 100000;
std::map<std::string, double> stats = std::map<std::string, double>();
Game game(2);
std::cout << "This statistics shows the score occurence of every player, not only winners." << std::endl;
std::cout << "HighCard is around 17%. It means that 1/5 cards dealt is worthless because highcard is arround 2% win rate." << std::endl;
std::cout << "Winning statistics are in score_stats." << std::endl;
std::ofstream myfile;
myfile.open ("score_stats_occurences.txt");
for(int i = 0; i < times; i++){
game.play();
for(auto & player : game.players){
if(stats.find(player.score.name)==stats.end()){
stats[player.score.name] = 0;
}
stats[player.score.name]++;
}
}
for(auto &kv : stats){
std::cout<< kv.first << " " << kv.second / times / game.players.size() * 100 << "%" << std::endl;
myfile << kv.first << " " << kv.second / times / game.players.size() * 100 << "%" << std::endl;
}
myfile.close();
return 0;
}
View File