Added player count
This commit is contained in:
@@ -103,12 +103,12 @@ void conversationQueueNextBetter() {
|
||||
|
||||
// Now we decide the next better.
|
||||
countStillInGame = 0;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
//In theory I don't think the current better can ever be selected again.
|
||||
// if(i == POKER_PLAYER_BETTER) continue; // Commented because we now count
|
||||
|
||||
// Next better is the better to the right of the current better.
|
||||
j = (POKER_PLAYER_BETTER + i) % POKER_PLAYER_COUNT_MAX;
|
||||
j = (POKER_PLAYER_BETTER + i) % POKER_PLAYER_COUNT;
|
||||
if(!pokerDoesPlayerNeedToBet(j)) {
|
||||
if((POKER_PLAYERS[j].state & (POKER_PLAYER_STATE_FOLDED | POKER_PLAYER_STATE_OUT)) == 0) {
|
||||
countStillInGame++;
|
||||
@@ -163,7 +163,7 @@ void conversationQueueFlopTurnRiver() {
|
||||
player = POKER_PLAYERS + i;
|
||||
player->state &= ~POKER_PLAYER_STATE_HAS_BET_THIS_ROUND;
|
||||
player->timesRaised = 0;
|
||||
} while(++i < POKER_PLAYER_COUNT_MAX);
|
||||
} while(++i < POKER_PLAYER_COUNT);
|
||||
|
||||
// In reality we'd burn the top card but that would waste some CPU I need.
|
||||
// Deal the top cards.
|
||||
|
@@ -134,7 +134,7 @@ void main() {
|
||||
|
||||
// DEBUG DRAW
|
||||
uint8_t tiles[10];
|
||||
for(j = 0; j < POKER_PLAYER_COUNT_MAX; j++) {
|
||||
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
||||
mainBufferChar(POKER_PLAYERS[j].hand[0], tiles);
|
||||
mainBufferChar(POKER_PLAYERS[j].hand[1], tiles + 2);
|
||||
|
||||
@@ -175,7 +175,7 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
set_bkg_tiles(0x00, POKER_PLAYER_COUNT_MAX + 1, 10, 1, tiles);
|
||||
set_bkg_tiles(0x00, POKER_PLAYER_COUNT + 1, 10, 1, tiles);
|
||||
|
||||
// Tick time.
|
||||
timeUpdate();
|
||||
|
@@ -24,4 +24,5 @@ typedef struct {
|
||||
uint8_t timesRaised;
|
||||
} pokerplayer_t;
|
||||
|
||||
extern pokerplayer_t POKER_PLAYERS[];
|
||||
extern pokerplayer_t POKER_PLAYERS[];
|
||||
extern uint8_t POKER_PLAYER_COUNT;
|
@@ -30,20 +30,22 @@ uint8_t POKER_WINNER_PLAYERS[POKER_PLAYER_COUNT_MAX];
|
||||
uint8_t POKER_WINNER_PARTICIPANTS[POKER_PLAYER_COUNT_MAX];
|
||||
uint8_t POKER_WINNER_COUNT;
|
||||
uint8_t POKER_WINNER_PARTICIPANT_COUNT;
|
||||
uint8_t POKER_PLAYER_COUNT;
|
||||
|
||||
void pokerInit() {
|
||||
uint8_t i;
|
||||
|
||||
// Set up players
|
||||
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
POKER_PLAYERS[i].chips = 10000;
|
||||
POKER_PLAYERS[i].state = 0;
|
||||
}
|
||||
|
||||
// Set up the initial state.
|
||||
// TODO: Should this be randomized?
|
||||
POKER_PLAYER_DEALER = 0;
|
||||
POKER_GAME_BLINDS_CURRENT = 10;
|
||||
POKER_PLAYER_COUNT = POKER_COMMUNITY_SIZE_MAX;
|
||||
|
||||
// Set up players
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
POKER_PLAYERS[i].chips = 10000;
|
||||
POKER_PLAYERS[i].state = 0;
|
||||
}
|
||||
|
||||
// Reset the round state (For the first round)
|
||||
pokerNewRound();
|
||||
@@ -63,7 +65,7 @@ void pokerNewRound() {
|
||||
for(i = 0; i < POKER_POT_COUNT_MAX; i++) {
|
||||
POKER_POTS[i].chips = 0;
|
||||
POKER_POTS[i].call = 0;
|
||||
for(j = 0; j < POKER_PLAYER_COUNT_MAX; j++) {
|
||||
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
||||
POKER_POTS[i].players[j] = 0;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +88,7 @@ void pokerNewRound() {
|
||||
POKER_PLAYER_DEALER++;
|
||||
|
||||
// Update players for the round.
|
||||
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
player = POKER_PLAYERS + i;
|
||||
player->timesRaised = 0;
|
||||
player->state &= ~(
|
||||
@@ -102,7 +104,7 @@ void pokerNewRound() {
|
||||
|
||||
// Have we found the dealer, small blind, and big blind players?
|
||||
if(found != 3) {
|
||||
k = (POKER_PLAYER_DEALER + i) % POKER_PLAYER_COUNT_MAX;
|
||||
k = (POKER_PLAYER_DEALER + i) % POKER_PLAYER_COUNT;
|
||||
|
||||
if(found == 0) {// Have we found the dealer?
|
||||
POKER_PLAYER_DEALER = i;
|
||||
@@ -375,7 +377,7 @@ inline bool pokerDoesPlayerNeedToBet(uint8_t playerIndex) {
|
||||
inline uint8_t pokerGetRemainingBetterCount() {
|
||||
uint8_t i, count;
|
||||
count = 0;
|
||||
for(i = 0 ; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
for(i = 0 ; i < POKER_PLAYER_COUNT; i++) {
|
||||
if(pokerDoesPlayerNeedToBet(i)) count++;
|
||||
}
|
||||
return count;
|
||||
@@ -722,7 +724,7 @@ void pokerWinnerDetermineForPot(
|
||||
highCard = 0xFF;
|
||||
|
||||
// Get participating players and their hands.
|
||||
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
if(pot->players[i] == 0) continue;
|
||||
|
||||
player = POKER_PLAYERS + i;
|
||||
|
Reference in New Issue
Block a user