This commit is contained in:
2022-01-15 20:00:41 -08:00
parent 4d9152a6a3
commit 8431c82044
4 changed files with 18 additions and 14 deletions

View File

@@ -48,7 +48,6 @@ void conversationQueueBeginBetting() {
// This is an AI player, get their turn. // This is an AI player, get their turn.
BGB_MESSAGE("AI turn to bet"); BGB_MESSAGE("AI turn to bet");
pokerAi(POKER_PLAYER_BETTER, &turn); pokerAi(POKER_PLAYER_BETTER, &turn);
BGB_printf("AI Decided to %u, with %u chips and %u confidence, bluffin: %u", turn.type, turn.chips, turn.confidence, turn.bluff); BGB_printf("AI Decided to %u, with %u chips and %u confidence, bluffin: %u", turn.type, turn.chips, turn.confidence, turn.bluff);
switch(turn.type) { switch(turn.type) {
@@ -121,7 +120,10 @@ void conversationQueueNextBetter() {
// If we reach this point then we either need to begin the betting round, or // If we reach this point then we either need to begin the betting round, or
// we are going to move to the winning decider. // we are going to move to the winning decider.
if(POKER_COMMUNITY_SIZE_MAX == POKER_COMMUNITY_SIZE) { if(
POKER_COMMUNITY_SIZE_MAX == POKER_COMMUNITY_SIZE ||
pokerGetRemainingBetterCount() <= 1
) {
QUEUE_ITEM = QUEUE_WINNER_DECIDE; QUEUE_ITEM = QUEUE_WINNER_DECIDE;
conversationQueueNext(); conversationQueueNext();
return; return;
@@ -133,6 +135,7 @@ void conversationQueueNextBetter() {
void conversationQueueFlopTurnRiver() { void conversationQueueFlopTurnRiver() {
uint8_t i, count; uint8_t i, count;
pokerplayer_t *player;
QUEUE_ITEM = QUEUE_BEGIN_BETTING; QUEUE_ITEM = QUEUE_BEGIN_BETTING;
@@ -154,15 +157,16 @@ void conversationQueueFlopTurnRiver() {
} }
// Reset each players required to bet state // Reset each players required to bet state
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) { do {
POKER_PLAYERS[i].state &= ~POKER_PLAYER_STATE_HAS_BET_THIS_ROUND; player = POKER_PLAYERS + i;
POKER_PLAYERS[i].timesRaised = 0; player->state &= ~POKER_PLAYER_STATE_HAS_BET_THIS_ROUND;
} player->timesRaised = 0;
} while(++i < POKER_PLAYER_COUNT_MAX);
// In reality we'd burn the top card but that would waste some CPU I need. // In reality we'd burn the top card but that would waste some CPU I need.
// Deal the top cards. // Deal the top cards.
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
POKER_COMMUNITY[POKER_COMMUNITY_SIZE++] = POKER_DECK[POKER_DECK_SIZE--]; POKER_COMMUNITY[POKER_COMMUNITY_SIZE++] = POKER_DECK[--POKER_DECK_SIZE];
} }
} }

View File

@@ -23,8 +23,8 @@
#define BORDER_TILE_BOTTOM_CENTER BORDER_TILE_BOTTOM_LEFT + 1 #define BORDER_TILE_BOTTOM_CENTER BORDER_TILE_BOTTOM_LEFT + 1
#define BORDER_TILE_BOTTOM_RIGHT BORDER_TILE_BOTTOM_CENTER + 1 #define BORDER_TILE_BOTTOM_RIGHT BORDER_TILE_BOTTOM_CENTER + 1
#define TEXTBOX_STATE_VISIBLE 1 << 0 #define TEXTBOX_STATE_VISIBLE (1 << 0)
#define TEXTBOX_STATE_SCROLLED 1 << 1 #define TEXTBOX_STATE_SCROLLED (1 << 1)
#define TEXTBOX_WIDTH_IN_TILES 20 #define TEXTBOX_WIDTH_IN_TILES 20
#define TEXTBOX_HEIGHT_IN_TILES 5 #define TEXTBOX_HEIGHT_IN_TILES 5

View File

@@ -12,9 +12,9 @@
#define POKER_PLAYER_COUNT_MAX 5 #define POKER_PLAYER_COUNT_MAX 5
#define POKER_PLAYER_HAND_SIZE_MAX 2 #define POKER_PLAYER_HAND_SIZE_MAX 2
#define POKER_PLAYER_STATE_FOLDED 1 << 0 #define POKER_PLAYER_STATE_FOLDED (1 << 0)
#define POKER_PLAYER_STATE_OUT 1 << 1 #define POKER_PLAYER_STATE_OUT (1 << 1)
#define POKER_PLAYER_STATE_HAS_BET_THIS_ROUND 1 << 2 #define POKER_PLAYER_STATE_HAS_BET_THIS_ROUND (1 << 2)
// #define POKER_PLAYER_STATE_SHOWING 1 << 3 // #define POKER_PLAYER_STATE_SHOWING 1 << 3
typedef struct { typedef struct {

View File

@@ -294,11 +294,11 @@ void pokerAi(uint8_t player, pokerturn_t *turn) {
turn->confidence = confidence; turn->confidence = confidence;
if(amount == plyr->chips) { if(amount == plyr->chips) {
turn->type == POKER_TURN_TYPE_ALL_IN; turn->type = POKER_TURN_TYPE_ALL_IN;
} else if(amount == callBet) { } else if(amount == callBet) {
turn->type = POKER_TURN_TYPE_CALL; turn->type = POKER_TURN_TYPE_CALL;
} else { } else {
turn->type == POKER_TURN_TYPE_BET; turn->type = POKER_TURN_TYPE_BET;
} }
} else if(pokerCanPlayerCheck(player)) { } else if(pokerCanPlayerCheck(player)) {