Working on winning logic.
This commit is contained in:
@ -7,6 +7,10 @@
|
||||
|
||||
#include "winner.h"
|
||||
|
||||
void pokerWinnerGetBestCard(card_t *cards, uint8_t cardCount) {
|
||||
|
||||
}
|
||||
|
||||
void pokerWinnerHandGetFull(
|
||||
pokerdealer_t *dealer, pokerplayer_t *player, card_t *cards
|
||||
) {
|
||||
@ -247,12 +251,15 @@ card_t pokerWinnerCompare(pokerplayerwinning_t *left, pokerplayerwinning_t *righ
|
||||
uint8_t i, number;
|
||||
card_t card;
|
||||
int32_t index;
|
||||
uint8_t countCardsSame;
|
||||
|
||||
card_t highCardLeft, highCardRight;
|
||||
uint8_t highNumberLeft, highNumberRight;
|
||||
|
||||
highNumberLeft = 0xFF;
|
||||
highNumberRight = 0xFF;
|
||||
countCardsSame = 0;
|
||||
|
||||
|
||||
for(i = 0; i < left->setSize; i++) {
|
||||
card = left->set[i];
|
||||
@ -265,7 +272,12 @@ card_t pokerWinnerCompare(pokerplayerwinning_t *left, pokerplayerwinning_t *righ
|
||||
// This number IS within the other hand, let's check that the EXACT card
|
||||
// is a match/isn't a match.
|
||||
index = cardContains(right->set, right->setSize, card);
|
||||
if(index != -1) continue;// Exact card match
|
||||
|
||||
// Exact card match
|
||||
if(index != -1) {
|
||||
countCardsSame++;
|
||||
continue;
|
||||
}
|
||||
// Not exact card match.. ?
|
||||
}
|
||||
|
||||
@ -292,8 +304,17 @@ card_t pokerWinnerCompare(pokerplayerwinning_t *left, pokerplayerwinning_t *righ
|
||||
}
|
||||
}
|
||||
|
||||
if(highCardLeft == 0xFF && highCardRight == 0xFF) {
|
||||
printf("Here\n");
|
||||
|
||||
if(countCardsSame == left->setSize) {
|
||||
for(i = 0; i < left->setSize; i++) {
|
||||
card = left->set[i];
|
||||
number = cardGetNumber(card);
|
||||
if(highNumberLeft == 0xFF||number == CARD_ACE||highNumberLeft < number) {
|
||||
highNumberLeft = number;
|
||||
highCardLeft = card;
|
||||
}
|
||||
}
|
||||
return highCardLeft;
|
||||
}
|
||||
|
||||
if(highCardLeft == 0xFF) return 0xFF;
|
||||
|
Reference in New Issue
Block a user