public void bettingRound(Seat startingSeat, Pot pot) { while (true) { Player p = startingSeat.player; GameState gs = this.getState(); PotState ps = pot.getState(p, this.street); if (pot.hasActed(p, this.street) && ps.playerContribution == ps.currentBet) { break; } //Action a = p.selectAction(gs, ps); //pot.handleAction(a); startingSeat = table.getNearestLeftSeatInHand(startingSeat); } }
// logic for a single street of betting during a poker hand public async Task bettingRound(Seat startingSeat, Pot pot) { while (true) { Player p = startingSeat.player; this.ActivePlayer = p; this.TurnTimer = 30; this.turnInProgress = true; GameState gs = this.getState(); PotState ps = pot.getState(p, this.street); // used to end betting round if not enough players to continue (due to folding/etc) if (this.activePlayers.Count < 2) { break; } // used to end the betting round if all players have acted (and action is completed) // BUG --> RRR (line will end the round on the 3rd Raise with 2 players) // probably buggy in general if (pot.hasActed(p, this.street) && ps.playerContribution == ps.currentBet) { break; } // raises Action and waits for response, WORKING OnPlayerTurn(new AwaitingActionEventArgs(gs, ps, p)); while (turnInProgress) { await this.DecrementTimer(); } // updates list of InHand players based on most recent Action this.activePlayers = this.table.getInHandPlayers(); // moves ActivePlayer to the next available Player startingSeat = table.getNearestLeftSeatInHand(startingSeat); } }