#include <ctime>
#include <cstdlib>
int CheckSucceed(int);
int main()
{
srand (time(0));
double Counter = 0;
int Simulations;
int Outs;
int Hit;
long double TotalWinnings = 0;
long double TotalLosses = 0;
long double Sum;
int SimulationNumber;
long double Wins = 0;
long double Losses = 0;
long double OddsAgainst;
long double PotOdds;
long double Win = 0;
int run = 1;
cout << "Please type in simulation number: ";
cin >> SimulationNumber;
cout << "\nNumber of hands simulated: ";
cin >> Simulations;
cout << "\nWhat is the odds against making your hand? (X:1): ";
cin >> OddsAgainst;
cout << "\nHow many outs have you got?: ";
cin >> Outs;
cout << "\nPlease type in your potodds (X:1):";
cin >> PotOdds;
system("cls");
cout << "\n\nRESULT FOR PLAYER " << SimulationNumber << " AFTER A SIMULATION OF " << Simulations << " DRAWS.";
cout << "\n\nEACH WIN IS SHOWN AS \"$\" AND EACH LOSS IS SHOWN AS \"-\"\n\n";
while ( Counter < Simulations )
{
Hit = CheckSucceed(Outs);
Win = 0;
if (Hit == 1){
TotalWinnings = TotalWinnings + PotOdds;
Win = PotOdds;
Wins++;
cout << "$";}
if (Hit == 0){
TotalLosses--;
Win--;
Losses++;
cout <<"-";}
Counter++;
}
cout << "\n\nThe odds against making your draw was " << OddsAgainst << ":1.";
cout << "\nYou had " << Outs << " outs" << " and the pot odds where " << PotOdds << ":1.";
cout << "\n\nTotal amount of winnings are: " << TotalWinnings;
cout << "\nTotal amount of losses are: " << TotalLosses;
Sum = Wins + Losses;
cout << "\n\nYou won " << Wins << " times.";
cout << "\nYou lost " << Losses << " times.";
cout << "\n\nYou won " << (Wins / Counter) * 100 << "% of total hands.";
cout << "\nTheory says you should win " << (1 / (OddsAgainst + 1)) * 100 << " percent of time.";
cout << "\n\nYou win: " << TotalWinnings + TotalLosses;
cout << "\n\nAverage win/hand is "<< (TotalWinnings + TotalLosses) / Counter << ".\n\n";
return 0;
}
int CheckSucceed(int Outs)
{
int hits = Outs;
int randomNumber = 1 + rand() % 47;
if (randomNumber > hits)
return 0;
else
return 1;
}