Just bashing more code

This commit is contained in:
2022-01-22 19:39:34 -08:00
parent ef6ab568e8
commit cda233365a
3 changed files with 22 additions and 16 deletions

View File

@@ -172,7 +172,7 @@ void conversationQueueFlopTurnRiver() {
void conversationQueueWinnerDecide() { void conversationQueueWinnerDecide() {
pokerpot_t *pot; pokerpot_t *pot;
uint8_t i, countOfPotsWithChips; uint8_t i, j, countOfPotsWithChips, chipsEach;
QUEUE_ITEM = QUEUE_DEBUG; QUEUE_ITEM = QUEUE_DEBUG;
@@ -183,7 +183,7 @@ void conversationQueueWinnerDecide() {
countOfPotsWithChips++; countOfPotsWithChips++;
} }
// Message // TODO: Messages
if(countOfPotsWithChips == 1) { if(countOfPotsWithChips == 1) {
} else { } else {
} }
@@ -200,7 +200,13 @@ void conversationQueueWinnerDecide() {
&POKER_WINNER_PARTICIPANT_COUNT &POKER_WINNER_PARTICIPANT_COUNT
); );
// TODO: hand out the winnings. chipsEach = pot->chips / POKER_WINNER_COUNT;
for(j = 0; j < POKER_WINNER_COUNT; j++) {
POKER_PLAYERS[POKER_WINNER_PLAYERS[j]].chips += chipsEach;
// TODO: I can determine rounding error here if I need to, just sub the
// taken chips for each player and when I get to chips remaining less than
// the chipsEach, then reward the rounding offset.
}
} }
// TODO: Decide on a winner for real. // TODO: Decide on a winner for real.

View File

@@ -72,12 +72,12 @@ void pokerNewRound() {
POKER_DECK_SIZE = CARD_DECK_SIZE; POKER_DECK_SIZE = CARD_DECK_SIZE;
// Shuffle Deck // Shuffle Deck
// for(i = CARD_DECK_SIZE-1; i > 0; i--) { for(i = CARD_DECK_SIZE-1; i > 0; i--) {
// k = POKER_DECK[i]; k = POKER_DECK[i];
// j = rand() % (i+1); j = rand() % (i+1);
// POKER_DECK[i] = POKER_DECK[j]; POKER_DECK[i] = POKER_DECK[j];
// POKER_DECK[j] = k; POKER_DECK[j] = k;
// } }
// Reset Players and decide new blinds. // Reset Players and decide new blinds.
found = 0; found = 0;

View File

@@ -40,12 +40,6 @@
#define POKER_WINNING_CONFIDENCE_PAIR 200 #define POKER_WINNING_CONFIDENCE_PAIR 200
#define POKER_WINNING_CONFIDENCE_HIGH_CARD 100 #define POKER_WINNING_CONFIDENCE_HIGH_CARD 100
extern pokerplayerwinning_t POKER_WINNERS[POKER_PLAYER_COUNT_MAX];
extern uint8_t POKER_WINNER_PLAYERS[POKER_PLAYER_COUNT_MAX];
extern uint8_t POKER_WINNER_PARTICIPANTS[POKER_PLAYER_COUNT_MAX];
extern uint8_t POKER_WINNER_COUNT;
extern uint8_t POKER_WINNER_PARTICIPANT_COUNT;
/** Holds information about a player's winning state */ /** Holds information about a player's winning state */
typedef struct { typedef struct {
/** The full set of both the dealer and player's hand */ /** The full set of both the dealer and player's hand */
@@ -61,4 +55,10 @@ typedef struct {
/** If there was a kicker card it will be here, otherwise -1 for no kicker */ /** If there was a kicker card it will be here, otherwise -1 for no kicker */
uint8_t kicker; uint8_t kicker;
} pokerplayerwinning_t; } pokerplayerwinning_t;
extern pokerplayerwinning_t POKER_WINNERS[POKER_PLAYER_COUNT_MAX];
extern uint8_t POKER_WINNER_PLAYERS[POKER_PLAYER_COUNT_MAX];
extern uint8_t POKER_WINNER_PARTICIPANTS[POKER_PLAYER_COUNT_MAX];
extern uint8_t POKER_WINNER_COUNT;
extern uint8_t POKER_WINNER_PARTICIPANT_COUNT;