Documentation ¶
Index ¶
- type Bank
- func (b *Bank) AddPlayer(player *models.Player)
- func (b *Bank) ConcludeRound(winners []showdown.WinnerInfo, publicPlayers []models.PublicPlayer) []*money.Money
- func (b *Bank) GetMaxBet() *money.Money
- func (b *Bank) GetPlayerBet(id string) *money.Money
- func (b *Bank) GetPlayerWallet(id string) *money.Money
- func (b *Bank) GetPot() *money.Money
- func (b *Bank) HasZeroWallet(id string) bool
- func (b *Bank) IsAllIn(id string) bool
- func (b *Bank) MustAllIn(id string) (bool, error)
- func (b *Bank) PerformAllIn(id string) (bool, error)
- func (b *Bank) PerformBet(id string) error
- func (b *Bank) PerformBlind(id string, blind *money.Money) error
- func (b *Bank) PerformRaise(id string, amount *money.Money) (int, error)
- func (b *Bank) RegisterLobby(lobbyId string)
- func (b *Bank) RemovePlayer(id string) error
- func (b *Bank) UpdatePublicPlayerBuyIn(p []models.PublicPlayer)
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bank ¶
type Bank struct { PlayerWallet map[string]*money.Money PlayerBets map[string]*money.Money Pot *money.Money MaxBet *money.Money LobbyId string // contains filtered or unexported fields }
Bank handles the bets and wallets of players.
func NewBank ¶
func NewBank(eventBus *rabbit.RabbitMessageBroker) *Bank
NewBank creates a new bank to handle the bets and wallets of players.
func (*Bank) ConcludeRound ¶
func (b *Bank) ConcludeRound(winners []showdown.WinnerInfo, publicPlayers []models.PublicPlayer) []*money.Money
ConcludeRound resets the current round and adds the fair share of the to the winners wallets.
func (*Bank) GetMaxBet ¶
func (b *Bank) GetMaxBet() *money.Money
GetMaxBet returns the highest bet in the current round
func (*Bank) GetPlayerBet ¶
GetPlayerBet gets the bet of a given player
func (*Bank) GetPlayerWallet ¶
GetPlayerWallet gets the current wallet for the given player
func (*Bank) HasZeroWallet ¶
HasZeroWallet returns true if the player has zero money left in his wallet or no bank wallet could be found with this id.
func (*Bank) IsAllIn ¶
IsAllIn determines whether a given player has already placed all his wallet. He can be excluded from the blocking list
func (*Bank) MustAllIn ¶
MustAllIn determines whether a player has to bet everything in because the maximum bet is already past his wallet amount
func (*Bank) PerformBet ¶
PerformBet performs a check action. This equals the players bet to the current maximum bet.
func (*Bank) PerformBlind ¶
PerformBlind is a wrapper around the core bet() function
func (*Bank) PerformRaise ¶
PerformRaise checks if it
func (*Bank) RegisterLobby ¶
func (*Bank) RemovePlayer ¶
RemovePlayer removes the given player from the bank
func (*Bank) UpdatePublicPlayerBuyIn ¶
func (b *Bank) UpdatePublicPlayerBuyIn(p []models.PublicPlayer)
UpdatePublicPlayerBuyIn updates the buyIns of the public player arrays according to the current state.
type Interface ¶
type Interface interface { RegisterLobby(string) GetMaxBet() *money.Money GetPlayerBet(id string) *money.Money GetPlayerWallet(id string) *money.Money GetPot() *money.Money HasZeroWallet(id string) bool PerformBet(id string) error PerformRaise(id string, amount *money.Money) (int, error) PerformAllIn(id string) (bool, error) PerformBlind(id string, amount *money.Money) error MustAllIn(id string) (bool, error) IsAllIn(id string) bool AddPlayer(player *models.Player) RemovePlayer(id string) error UpdatePublicPlayerBuyIn(p []models.PublicPlayer) ConcludeRound(winners []showdown.WinnerInfo, publicPlayers []models.PublicPlayer) []*money.Money }