Documentation ¶
Index ¶
- Constants
- type ActionType
- type Hand
- func (hand *Hand) BetterCount() int
- func (hand *Hand) BigBlind() *Player
- func (hand *Hand) Deal() error
- func (hand *Hand) Dealer() *Player
- func (hand *Hand) FinishHand() error
- func (hand *Hand) ListenForPlayerActions()
- func (hand *Hand) PlayerAction(player *Player, action RoundAction) error
- func (hand *Hand) SmallBlind() *Player
- func (hand *Hand) StartHand() error
- func (hand *Hand) String() string
- type Player
- type PlayerBet
- type Pot
- type Round
- type RoundAction
- type Signal
- type SignalType
- type SubPot
- type Table
- type TableConfig
- type TableSignal
Constants ¶
const ( // TableS TODO is this needed for anything? TableS = SignalType(iota) // BetS TODO is this needed for anything? BetS = SignalType(iota) // MessageS TODO is this needed for anything? MessageS = SignalType(iota) // SitS TODO is this needed for anything? SitS = TableSignal(iota) // StandS TODO is this needed for anything? StandS = TableSignal(iota) )
const ( // DefaultMinBet default minimum bet controlling big blinds DefaultMinBet = 200 // MinPlayersToPlay below which the hand cannot start MinPlayersToPlay = 2 // MaxTableSize once reached no more players can sit MaxTableSize = 10 // MaxStandersSize once reached no more players can stand TODO what happens when standers is full and someone stands up? MaxStandersSize = 10 // AllIn takes the player all in AllIn = ActionType(iota) // Raise the current bet Raise = ActionType(iota) // Call the current bet Call = ActionType(iota) // Fold your hand Fold = ActionType(iota) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType int
ActionType an action a player can take during their turn in a round
type Hand ¶
type Hand struct { // TableConfig defines nuances of play TableConfig TableConfig // Deck of cards Deck poker.Deck // Board shared cards Board []poker.Card // Round is the current round of betting Round *Round // Players in the hand Players *ring.Ring // Pot of winnings Pot Pot // FirstToBet bets first FirstToBet *ring.Ring // If dealing is still needed but no more betting BettingDone bool // If no more dealing is needed for the hand HandDone bool }
Hand can be played and winners will be identified
func (*Hand) BetterCount ¶
BetterCount determines the number of betters
func (*Hand) FinishHand ¶
FinishHand is called when all betting is complete and the pot should be distributed.
func (*Hand) ListenForPlayerActions ¶
func (hand *Hand) ListenForPlayerActions()
ListenForPlayerActions get each player's action for the round of bets
func (*Hand) PlayerAction ¶
func (hand *Hand) PlayerAction( player *Player, action RoundAction) error
PlayerAction handles a player action
func (*Hand) SmallBlind ¶
SmallBlind is the small blind of the hand
type Player ¶
type Player struct { Name string Standing bool WantToStandUp bool Playing bool AllIn bool Hole []poker.Card Funds int BetAmount int HandRank int32 ActionChan chan RoundAction SignalChan chan Signal // contains filtered or unexported fields }
Player a player's state at a Table
func NewPlayerWithFunds ¶
NewPlayerWithFunds create a new player with funds
type Round ¶
type Round struct { // BetTurn is betting next BetTurn *ring.Ring // CurrentBet is the amount to call CurrentBet int // If the round of betting is done RoundDone bool }
Round is a cycle of betting, there are 4 in a hand: pre-flop, flop, turn, river
type RoundAction ¶
type RoundAction struct {
// contains filtered or unexported fields
}
RoundAction how a player (another goroutine) can interact with the table during their turn in a round
type Signal ¶
type Signal struct { PlayerName string SignalType SignalType Action RoundAction Amount int Message string }
Signal TODO is this needed for anything?
type SubPot ¶
SubPot is one of potentially multiple pots and identifies the players in the running to win it
type Table ¶
type Table struct { TableConfig TableConfig Players [MaxTableSize]*Player DealerIndex int Standers [MaxStandersSize]*Player Hand *Hand // contains filtered or unexported fields }
Table the group of players playing hands or standing and watching
func NewTableWithConfig ¶
func NewTableWithConfig(tableConfig TableConfig) *Table
NewTableWithConfig create a new table with custom config
type TableConfig ¶
type TableConfig struct {
// contains filtered or unexported fields
}
TableConfig define nuances of the game played at a Table