Created
April 2, 2011 12:44
-
-
Save supertunaman/899465 to your computer and use it in GitHub Desktop.
Tests ace-high straights that aren't flushes in ircpoker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "card.h" | |
#include "deck.h" | |
#include "hand.h" | |
void print_rank(card_t hand[]) | |
{ | |
switch (rank_hand(hand)) { | |
case HIGHCARD: | |
printf("High Card"); | |
break; | |
case ONEPAIR: | |
printf("One Pair"); | |
break; | |
case TWOPAIR: | |
printf("Two Pair"); | |
break; | |
case THREEKIND: | |
printf("Three of a Kind"); | |
break; | |
case STRAIGHT: | |
printf("Straight"); | |
break; | |
case FLUSH: | |
printf("Flush"); | |
break; | |
case FULLHOUSE: | |
printf("Full House"); | |
break; | |
case FOURKIND: | |
printf("Four of a Kind"); | |
break; | |
case STRAIGHTFLUSH: | |
printf("Straight Flush"); | |
break; | |
case ROYALFLUSH: | |
printf("Royal Flush"); | |
break; | |
} | |
} | |
int main() { | |
card_t royal_flush[5]; | |
card_t not_royal_flush[5]; | |
init_deck(); | |
royal_flush[0] = deck[35]; /* 10 of Hearts */ | |
royal_flush[1] = deck[36]; /* Jack of Hearts */ | |
royal_flush[2] = deck[37]; /* Queen of Hearts */ | |
royal_flush[3] = deck[38]; /* King of Hearts */ | |
royal_flush[4] = deck[26]; /* Ace of Hearts */ | |
not_royal_flush[0] = deck[35]; /* the same except... */ | |
not_royal_flush[1] = deck[36]; | |
not_royal_flush[2] = deck[37]; | |
not_royal_flush[3] = deck[38]; | |
not_royal_flush[4] = deck[0]; /* Ace of Clubs */ | |
printf(" royal_flush is: "); | |
print_rank(royal_flush); | |
printf("\nnot_royal_flush is: "); | |
print_rank(not_royal_flush); | |
printf("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment