Still correcting betting logic.
This commit is contained in:
@ -26,11 +26,9 @@ void _pokerGameActionBetOnUpdate(
|
||||
bool turnMade = false;
|
||||
pokerturn_t turn;
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
pokerplayer_t *player;
|
||||
pokerdiscussiondata_t discussion;
|
||||
|
||||
// Are they human?
|
||||
player = game->poker.players + game->poker.better;
|
||||
isHuman = game->poker.better == POKER_WORLD_HUMAN_INDEX;
|
||||
|
||||
// Handle as an AI
|
||||
@ -46,10 +44,10 @@ void _pokerGameActionBetOnUpdate(
|
||||
if(!turnMade) return;
|
||||
|
||||
// Perform the action
|
||||
// pokerTurnAction(&game->poker, player, &turn);
|
||||
pokerTurnAction(&game->poker, game->poker.better, turn);
|
||||
|
||||
// Speak
|
||||
// discussion.reason = pokerDiscussionGetTypeFromTurnType(turn.type);
|
||||
discussion.reason = pokerDiscussionGetTypeFromTurnType(turn.type);
|
||||
discussion.poker = game;
|
||||
discussion.playerCause = game->poker.better;
|
||||
pokerDiscussionQueue(&discussion);
|
||||
@ -64,19 +62,19 @@ void _pokerGameActionBetOnEnd(
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
|
||||
// // Get which player is remaining to move.
|
||||
// game->poker.bet.better = pokerBetGetRemainingPlayer(
|
||||
// &game->poker.bet, game->poker.players, game->poker.roundSmallBlind
|
||||
// );
|
||||
game->poker.better = pokerPlayerGetNextBetter(
|
||||
&game->poker, game->poker.better
|
||||
);
|
||||
|
||||
// // Restack
|
||||
// pokerGameActionRestackAdd(game);
|
||||
// Restack
|
||||
pokerGameActionRestackAdd(game);
|
||||
|
||||
// // Are we waiting on any players?
|
||||
// if(game->poker.bet.better != 0xFF) {
|
||||
// pokerGameActionLookAdd(game, game->poker.bet.better);
|
||||
// pokerGameActionBetAdd(game);
|
||||
// return;
|
||||
// }
|
||||
// Are we waiting on any players?
|
||||
if(game->poker.better != 0xFF) {
|
||||
pokerGameActionLookAdd(game, game->poker.better);
|
||||
pokerGameActionBetAdd(game);
|
||||
return;
|
||||
}
|
||||
|
||||
// Not waiting, do next action.
|
||||
pokerGameActionFlopAdd(game);
|
||||
|
@ -459,6 +459,32 @@ pokerturn_t pokerTurnGetForPlayer(poker_t *poker, uint8_t playerIndex) {
|
||||
return turn;
|
||||
}
|
||||
|
||||
void pokerTurnAction(poker_t *poker, uint8_t playerIndex, pokerturn_t turn) {
|
||||
pokerplayer_t *player;
|
||||
player = poker->players + playerIndex;
|
||||
|
||||
switch(turn.type) {
|
||||
case POKER_TURN_TYPE_BET:
|
||||
case POKER_TURN_TYPE_CALL:
|
||||
case POKER_TURN_TYPE_ALL_IN:
|
||||
pokerPlayerBet(poker, playerIndex, turn.chips);
|
||||
player->timesRaised++;
|
||||
break;
|
||||
|
||||
case POKER_TURN_TYPE_CHECK:
|
||||
pokerPlayerBet(poker, playerIndex, 0);
|
||||
player->timesRaised = 0;
|
||||
break;
|
||||
|
||||
case POKER_TURN_TYPE_FOLD:
|
||||
player->state |= POKER_PLAYER_STATE_FOLDED;
|
||||
player->timesRaised = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
player->state |= POKER_PLAYER_STATE_HAS_BET_THIS_ROUND;
|
||||
}
|
||||
|
||||
int32_t pokerPlayerGetPotChipsSum(poker_t *poker, uint8_t playerIndex) {
|
||||
int32_t count;
|
||||
uint8_t i;
|
||||
|
@ -421,6 +421,15 @@ pokerturn_t pokerTurnBet(poker_t *poker, uint8_t playerIndex, int32_t chips);
|
||||
*/
|
||||
pokerturn_t pokerTurnGetForPlayer(poker_t *poker, uint8_t playerIndex);
|
||||
|
||||
/**
|
||||
* Perform the turn's action.
|
||||
*
|
||||
* @param poker Poker game instance.
|
||||
* @param playerIndex Player index.
|
||||
* @param turn Turn to action.
|
||||
*/
|
||||
void pokerTurnAction(poker_t *poker, uint8_t playerIndex, pokerturn_t turn);
|
||||
|
||||
/**
|
||||
* Returns the sum of chips in the pot(s) that the specified player is in. This
|
||||
* does not consider the pot, player or hand, just the pure sum of chips.
|
||||
|
Reference in New Issue
Block a user