More betting logic refining.
This commit is contained in:
@ -60,7 +60,9 @@ uint8_t pokerBetGetRemainingPlayer(
|
|||||||
pokerbet_t *bet, pokerplayer_t *players, uint8_t roundSmallBlind
|
pokerbet_t *bet, pokerplayer_t *players, uint8_t roundSmallBlind
|
||||||
) {
|
) {
|
||||||
uint8_t def, j, pi;
|
uint8_t def, j, pi;
|
||||||
def = pokerBetGetRoundPlayerDefault(roundSmallBlind);
|
def = bet->better;
|
||||||
|
|
||||||
|
// Now check for any remaining players
|
||||||
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
||||||
pi = ((def + j) % POKER_PLAYER_COUNT);
|
pi = ((def + j) % POKER_PLAYER_COUNT);
|
||||||
if(!pokerBetPlayerCanBet(bet, players + pi)) continue;
|
if(!pokerBetPlayerCanBet(bet, players + pi)) continue;
|
||||||
|
@ -86,7 +86,8 @@ pokerturn_t pokerTurnGet(poker_t *poker, uint8_t playerIndex) {
|
|||||||
random = randInt32() % 100;
|
random = randInt32() % 100;
|
||||||
|
|
||||||
// Determine the max bet that the AI is willing to make
|
// Determine the max bet that the AI is willing to make
|
||||||
maxBet = (int32_t)(poker->bet.currentBet / 1.75f) - (random / 2) - callBet;
|
maxBet = (int32_t)((float)player->chips / 1.75f) - (random / 2);
|
||||||
|
maxBet -= callBet;
|
||||||
|
|
||||||
// Determine what's a good bluff bet.
|
// Determine what's a good bluff bet.
|
||||||
bluffBet = random * maxBet / 100 / 2;
|
bluffBet = random * maxBet / 100 / 2;
|
||||||
@ -128,11 +129,18 @@ pokerturn_t pokerTurnGet(poker_t *poker, uint8_t playerIndex) {
|
|||||||
amount = maxBet;
|
amount = maxBet;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
amount = (poker->bet.currentBet - callBet) * 9 / 10;
|
amount = (player->chips - callBet) * 9 / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isBluff) printf("Mum I'm bluffing\n");
|
||||||
|
|
||||||
|
printf("Raised %i times\n", player->timesRaised);
|
||||||
|
|
||||||
// Let's not get caught in a raising loop with AI.
|
// Let's not get caught in a raising loop with AI.
|
||||||
if(player->timesRaised >= POKER_TURN_MAX_RAISES) amount = callBet;
|
if(player->timesRaised >= POKER_TURN_MAX_RAISES) {
|
||||||
|
printf("Calling instead.\n");
|
||||||
|
amount = callBet;
|
||||||
|
}
|
||||||
|
|
||||||
// Did we actually bet?
|
// Did we actually bet?
|
||||||
if(amount > 0) {
|
if(amount > 0) {
|
||||||
@ -162,12 +170,10 @@ void pokerTurnAction(poker_t *poker, pokerplayer_t *player, pokerturn_t *turn) {
|
|||||||
|
|
||||||
case POKER_TURN_TYPE_CHECK:
|
case POKER_TURN_TYPE_CHECK:
|
||||||
pokerBetPlayer(&poker->bet, player, 0);
|
pokerBetPlayer(&poker->bet, player, 0);
|
||||||
player->timesRaised = 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POKER_TURN_TYPE_FOLD:
|
case POKER_TURN_TYPE_FOLD:
|
||||||
player->state |= POKER_PLAYER_STATE_FOLDED;
|
player->state |= POKER_PLAYER_STATE_FOLDED;
|
||||||
player->timesRaised = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user