Added some turn logic

This commit is contained in:
2021-09-20 13:21:46 -07:00
parent 9505aff1a4
commit a21fbdb881
3 changed files with 88 additions and 31 deletions

View File

@ -14,6 +14,7 @@
#define POKER_TURN_TYPE_BET 0x02
#define POKER_TURN_TYPE_CALL 0x03
#define POKER_TURN_TYPE_ALL_IN 0x04
#define POKER_TURN_TYPE_CALL_ALL_IN 0x04
#define POKER_TURN_TYPE_CHECK 0x05
/** The turn that a player/the AI decided to do for its turn */
@ -35,6 +36,24 @@ typedef struct {
*/
pokerturn_t pokerTurnGet(poker_t *poker, uint8_t playerIndex);
/**
* Perform the turn's action.
*
* @param poker Poker game instance.
* @param player Player instance.
* @param turn Turn to action.
*/
void pokerTurnAction(poker_t *poker, pokerplayer_t *player, pokerturn_t *turn);
/**
* Return a turn action for the player being out.
*
* @param poker Poker game instance.
* @param player Player index.
* @return A turn for an out action.
*/
pokerturn_t pokerTurnOut(poker_t *poker, uint8_t player);
/**
* Return a turn action for the given player to fold.
*
@ -45,13 +64,32 @@ pokerturn_t pokerTurnGet(poker_t *poker, uint8_t playerIndex);
pokerturn_t pokerTurnFold(poker_t *poker, uint8_t player);
/**
* Perform the turn's action.
* Perform a check as a player.
*
* @param poker Poker game instance.
* @param player Player instance.
* @param turn Turn to action.
* @param player Player index for who is checking.
* @return A turn for a check action.
*/
void pokerTurnAction(poker_t *poker, pokerplayer_t *player, pokerturn_t *turn);
pokerturn_t pokerTurnCheck(poker_t *poker, uint8_t player);
/**
* Perform a call as a player
*
* @param poker Poker game instance.
* @param player Player index who is calling.
* @return A turn for a call action.
*/
pokerturn_t pokerTurnCall(poker_t *poker, uint8_t player);
/**
* Perform a bet as a player.
*
* @param poker Poker game instance.
* @param playerIndex Player index who is betting.
* @param chips Chips to raise by.
* @return A turn for a bet action.
*/
pokerturn_t pokerTurnRaise(poker_t *poker, uint8_t playerIndex, int32_t chips);
/**
* Determine whether or not a player CAN check, given the current max bet and