Added flusg
This commit is contained in:
@ -44,14 +44,12 @@ winning_t pokerWinnerGetStatus(poker_t *poker, pokerplayer_t *player) {
|
|||||||
|
|
||||||
// TESTING HAND
|
// TESTING HAND
|
||||||
winning.full[0] = CARD_CLUBS_ACE;
|
winning.full[0] = CARD_CLUBS_ACE;
|
||||||
winning.full[1] = CARD_SPADES_ACE;
|
winning.full[1] = CARD_CLUBS_TWO;
|
||||||
|
winning.full[2] = CARD_CLUBS_FIVE;
|
||||||
winning.full[2] = CARD_HEARTS_TWO;
|
winning.full[3] = CARD_DIAMONDS_THREE;
|
||||||
winning.full[3] = CARD_DIAMONDS_TWO;
|
|
||||||
winning.full[4] = CARD_SPADES_TWO;
|
winning.full[4] = CARD_SPADES_TWO;
|
||||||
|
winning.full[5] = CARD_CLUBS_QUEEN;
|
||||||
winning.full[5] = CARD_HEARTS_QUEEN;
|
winning.full[6] = CARD_CLUBS_JACK;
|
||||||
winning.full[6] = CARD_HEARTS_JACK;
|
|
||||||
|
|
||||||
//////////////////////// Now look for the winning set ////////////////////////
|
//////////////////////// Now look for the winning set ////////////////////////
|
||||||
|
|
||||||
@ -126,7 +124,38 @@ winning_t pokerWinnerGetStatus(poker_t *poker, pokerplayer_t *player) {
|
|||||||
return winning;
|
return winning;
|
||||||
}
|
}
|
||||||
|
|
||||||
// High card (worst)
|
// Flush (5 same suit)
|
||||||
|
for(i = 0; i < winning.size; i++) {
|
||||||
|
card = winning.full[i];
|
||||||
|
suit = cardGetSuit(card);
|
||||||
|
winning.set[0] = i;
|
||||||
|
winning.count = 1;
|
||||||
|
for(j = i+1; j < winning.size; j++) {
|
||||||
|
if(cardGetSuit(winning.full[j]) != suit) continue;
|
||||||
|
winning.set[winning.count] = j;
|
||||||
|
winning.count++;
|
||||||
|
if(winning.count == POKER_WINNING_SET_SIZE) break;
|
||||||
|
}
|
||||||
|
if(winning.count < POKER_WINNING_SET_SIZE) continue;
|
||||||
|
winning.type = POKER_WINNING_TYPE_FOUR_OF_A_KIND;
|
||||||
|
printf("Four of a kind\n");
|
||||||
|
return winning;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Straight (sequence any suit)
|
||||||
|
winning.count = 0;
|
||||||
|
|
||||||
|
// Three of a kind
|
||||||
|
winning.count = 0;
|
||||||
|
|
||||||
|
// Two Pair
|
||||||
|
winning.count = 0;
|
||||||
|
|
||||||
|
// Pair
|
||||||
|
winning.count = 0;
|
||||||
|
|
||||||
|
// High card
|
||||||
|
|
||||||
return winning;
|
return winning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user