Added flusg

This commit is contained in:
2021-06-23 19:18:36 -07:00
parent 127257cf99
commit 3cdbf30876

View File

@ -44,14 +44,12 @@ winning_t pokerWinnerGetStatus(poker_t *poker, pokerplayer_t *player) {
// TESTING HAND
winning.full[0] = CARD_CLUBS_ACE;
winning.full[1] = CARD_SPADES_ACE;
winning.full[2] = CARD_HEARTS_TWO;
winning.full[3] = CARD_DIAMONDS_TWO;
winning.full[1] = CARD_CLUBS_TWO;
winning.full[2] = CARD_CLUBS_FIVE;
winning.full[3] = CARD_DIAMONDS_THREE;
winning.full[4] = CARD_SPADES_TWO;
winning.full[5] = CARD_HEARTS_QUEEN;
winning.full[6] = CARD_HEARTS_JACK;
winning.full[5] = CARD_CLUBS_QUEEN;
winning.full[6] = CARD_CLUBS_JACK;
//////////////////////// Now look for the winning set ////////////////////////
@ -126,7 +124,38 @@ winning_t pokerWinnerGetStatus(poker_t *poker, pokerplayer_t *player) {
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;
}