More code cleaning.

This commit is contained in:
2021-09-28 07:01:37 -07:00
parent fa54383d6f
commit 327db3557e
28 changed files with 85 additions and 390 deletions

View File

@ -18,8 +18,6 @@ void _pokerActionDealOnStart(queue_t *queue, queueaction_t *action, uint8_t i) {
// Deal 2 card to each player
pokerDealerDealAll(&poker->dealer, poker->players, POKER_DEAL_CARD_EACH);
printf("Cards Dealt\n");
queueNext(queue);
}

View File

@ -13,7 +13,7 @@ void _pokerActionFlopDo(queue_t *queue, queueaction_t *action, uint8_t count) {
poker->state = POKER_STATE_CARDS_FLOPPING;
pokerDealerBurn(&poker->dealer, 1);
pokerDealerBurn(&poker->dealer, POKER_FLOP_BURN_COUNT);
pokerDealerTurn(&poker->dealer, count);
printf("Turned %u cards\n", count);

View File

@ -12,6 +12,9 @@
#include "../poker.h"
#include "../turn.h"
/** How many cards the dealer should burn before dealing the flop */
#define POKER_FLOP_BURN_COUNT 1
/**
* Shorthand action callback parser. Takes the queue, action and the intended
* turn count to complete the action.

View File

@ -18,12 +18,12 @@ void _pokerActionMatchOnStart(queue_t *queue, queueaction_t *action, uint8_t i){
// Reset the main game state. This does not init the round.
pokerBetInit(&poker->bet);
poker->roundDealer = POKER_PLAYER_COUNT-2;
// Reset the players
for(x = 0; x < POKER_PLAYER_COUNT; x++) {
poker->players[x].state = 0x00;
poker->players[x].chips = POKER_BET_PLAYER_CHIPS_DEFAULT;
}
printf("Match Start\n");
queueNext(queue);
}

View File

@ -23,7 +23,6 @@ void _pokerActionRoundOnStart(queue_t *queue, queueaction_t *action ,uint8_t i){
pokerDealerInit(&poker->dealer);
// Reset the players
printf("Resetting the players\n");
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
pokerPlayerReset(poker->players + i);
}
@ -56,8 +55,7 @@ void _pokerActionRoundOnStart(queue_t *queue, queueaction_t *action ,uint8_t i){
poker->roundDealer = indexDealer;
poker->roundBigBlind = indexBigBlind;
poker->roundSmallBlind = indexSmallBlind;
printf("Round Start\n");
queueNext(queue);
}

View File

@ -10,7 +10,7 @@
#include "../util/array.h"
/** How many chips each player has by defautl */
#define POKER_BET_PLAYER_CHIPS_DEFAULT 10000
#define POKER_BET_PLAYER_CHIPS_DEFAULT 1200
/** The default blind cost for the big blind. */
#define POKER_BET_BLIND_BIG_DEFAULT 600

View File

@ -52,4 +52,9 @@ typedef struct {
uint8_t state;
} poker_t;
/**
* Action the poker game winning state after it has been calculated previously.
*
* @param poker Poker game to action the winning state of.
*/
void pokerGameWin(poker_t *poker);