62 lines
1.8 KiB
C
62 lines
1.8 KiB
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "../libs.h"
|
|
#include "../util/flags.h"
|
|
#include "common.h"
|
|
#include "bet.h"
|
|
|
|
/**
|
|
* Add a player to the game. The player starts in an out state (with no chips).
|
|
*
|
|
* @param poker Poker game instance to add to.
|
|
* @return Player index.
|
|
*/
|
|
uint8_t pokerPlayerAdd(poker_t *poker);
|
|
|
|
/**
|
|
* Add chips to a player. This will also update their state if they were out
|
|
* to ensure that they are no longer.
|
|
*
|
|
* @param player Player to add chips to.
|
|
* @param chips Amount of chips to add.
|
|
*/
|
|
void pokerPlayerChipsAdd(pokerplayer_t *player, int32_t chips);
|
|
|
|
/**
|
|
* Checks a players' state and decided whether or not the players still needs to
|
|
* bet for the current round. This will check both whether the player has bet in
|
|
* the current round yet, and whether or not they have met the call value of the
|
|
* active pot.
|
|
*
|
|
* @param poker Poker game instance.
|
|
* @param playerIndex Player index to check.
|
|
* @return
|
|
*/
|
|
bool pokerPlayerDoesNeedToBetThisRound(poker_t *poker, uint8_t playerIndex);
|
|
|
|
/**
|
|
* Determine whether or not a player CAN check, given the current max bet and
|
|
* the players current bet.
|
|
*
|
|
* @param poker Poker game instance.
|
|
* @param player Player to check.
|
|
* @return True if the player can check, false if they need to call first.
|
|
*/
|
|
bool pokerPlayerCanCheck(poker_t *poker, pokerplayer_t *player);
|
|
|
|
/**
|
|
* Returns the full hand for a given player including the cards on the bench.
|
|
*
|
|
* @param poker Poker game instance.
|
|
* @param player Poker player to get the hand for.
|
|
* @param cards Array to store the cards.
|
|
*/
|
|
void pokerPlayerGetFullHand(
|
|
poker_t *poker, pokerplayer_t *player, card_t *cards
|
|
); |