Dawn/temp/poker/poker.c

42 lines
894 B
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "poker.h"
void pokerInit(poker_t *poker) {
uint8_t x;
// Prepare the initial game state
poker->round = POKER_ROUND_DEAL;
poker->roundPlayer = 0x00;
poker->roundDealer = 0x00;
poker->blindSmall = 0;
poker->blindBig = 0;
for(x = 0; x < POKER_PLAYER_COUNT; x++) {
poker->players[x].state = 0x00;
poker->players[x].chips = 0;
poker->players[x].cardCount = 0;
poker->players[x].currentBet = 0;
}
pokerRoundInit(poker);
}
void pokerRoundInit(poker_t *poker) {
uint8_t x;
// Refill the deck
cardDeckFill(poker->deck);
poker->deckSize = CARD_DECK_SIZE;
// Reset the players
for(x = 0; x < POKER_PLAYER_COUNT; x++) {
poker->players[x].cardCount = 0;
poker->players[x].currentBet = 0;
}
}