|
#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;
|
|
}
|