Pocker Pot Divider
Here, as promised is the copy of the program I wrote in C. The program is supposed to take an amount of players and the buy-in they pay and give you a pot division for first, second, etc. The program did not work correctly in C so I plan on rewriting it in python, but anyone who wants to submit a code in python is more than welcome to. If there are any questions just let me know. I try to publish the analysis that I made very soon. It will help you understand the reason I built the program and what its function is.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int Buyin[8];
int Increase[1];
double h,
a,
b,
c;
int PD = 0;
int P;
int n;
int dumby;
void Adding(void);
int main (void)
{
printf (“Welcome to the Poker Pot Maker (PPM)\n”);
printf (“Please enter a Buy-In amount (no decimals): “);
scanf (“%d”, &n);
printf (“\nPlease enter the number of players: “);
scanf (“%d”, &P);
/* Math */
Buyin[] = n * P;
strncpy (Increase[], Buyin[], 1);
if (isdigit (Buyin[])) PD = PD + 1;
if (PD >= 1 && PD <= 2)
{
h = .5;
Adding();
}
else if (PD >= 2 && PD <= 3)
{
h = 5;
Adding();
}
else if (PD >= 3 && PD <= 4 && Increase[1] >= 2)
h = 55;
Adding();
}
else if (PD >= 4 && PD <= 5 && Increase[1] >= 3)
{
h = 555;
Adding();
}
else if (PD >= 5 && PD <= 6 && Increase[1] >= 4);
{
h = 5555;
Adding();
}
else if (PD >= 6 && PD <= 7 && Increase[1] >= 5);
{
h = 55555;
Adding();
}
else if (PD >= 7 && PD <= 8 && Increase[1] >= 6);
{
h = 555555;
Adding();
}
printf (“\n\n1st place receives %lf.\n”, a);
printf (“2nd place receives %lf.\n”, b);
printf (“3rd place receives %lf.\n”, c);
printf (“-Press any key to exit-”);
scanf (“%d”, dumby);
}
void Adding(void)
{
a = Buyin / 2;
b = a / 2;
a = a + h;
b = b + h;
c = -1 * (b + a) + Buyin;
}

Leave a Reply