int main(int argc,char **argv) { int m; int n; int o; int p; int wet_flop_count; int flop_suits[NUM_CARDS_IN_FLOP]; int flop_ranks[NUM_CARDS_IN_FLOP]; double wet_flop_pct; wet_flop_count = 0; for (p = 0; p < POKER_52_3_PERMUTATIONS; p++) { get_permutation_instance( NUM_CARDS_IN_DECK,NUM_CARDS_IN_FLOP, &m,&n,&o,p); flop_suits[0] = suit_of(m); flop_suits[1] = suit_of(n); flop_suits[2] = suit_of(o); flop_ranks[0] = rank_of(m); flop_ranks[1] = rank_of(n); flop_ranks[2] = rank_of(o); if ((flop_suits[0] == flop_suits[1]) && (flop_suits[0] == flop_suits[2])) { // flush wet_flop_count++; } else if (straight(flop_ranks)) { // straight wet_flop_count++; } else if ((flop_ranks[0] == flop_ranks[1]) || (flop_ranks[0] == flop_ranks[2]) || (flop_ranks[1] == flop_ranks[2])) { // pair or better wet_flop_count++; } } wet_flop_pct = (double)wet_flop_count / (double)POKER_52_3_PERMUTATIONS; printf("%5d %5d %lf\n", wet_flop_count,POKER_52_3_PERMUTATIONS,wet_flop_pct); return 0; }
static void print_card(char card,char delim,bool bRankOnly,bool bInteger) { int suit; int rank; if (bInteger) printf("%d%c",card,delim); else { if (!bRankOnly) suit = suit_of(card); rank = rank_of(card); if (!bRankOnly) printf("%c%c%c",rank_chars[rank],suit_chars[suit],delim); else printf("%c%c",rank_chars[rank],delim); } }
bool load_hand(hand a_hand) { uint i = 0; while (i < CARDS_IN_HAND) { if (feof(stdin)) return false; char c = getc(stdin); if (!isalnum(c)) continue; if (!a_hand[i].rank) a_hand[i].rank = rank_of(c); else // if (!a_hand[i].suit) { a_hand[i].suit = suit_of(c); i++; } } return true; }