Documentation
¶
Index ¶
Constants ¶
const ( // Texas Hold'em No Limit game TexasHoldEmNoLimit game = iota // Unknown game Unknown )
List of games
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface {
// String returns string representation of the action.
String() string
// Amount returns the associated amount (not relevant to all action types).
Amount() Amount
}
Action is the interface to a player action.
func NewCallAction ¶
NewCallAction creates a new call action.
func NewRaiseAction ¶
NewRaiseAction creates a new raise action.
type Amount ¶
type Amount int
Amount represents an amount of US cents.
func ParseAmount ¶
ParseAmount parses an amount from a string. The string may contain '$' and 'USD'.
func (Amount) MarshalJSON ¶
MarshalJSON marshals the string representation of the amount.
func (Amount) UnmarshalJSON ¶
UnmarshalJSON parses an amount from JSON.
type Date ¶
func (Date) MarshalJSON ¶
type Game ¶
type Game interface {
Game() game
String() string
}
Game is the interface to a value which describes a game. The Game interface exists to disallow external code to create new types of games.
type Hand ¶
type Hand struct {
Client string
Table Table
HandID int
Date Date
Button PlayerPosition
SmallBlind PlayerPosition
BigBlind PlayerPosition
ThisPlayer *PlayerCards
Players []Player
Rounds []Round
Result *Result
}
type Player ¶
type Player struct {
// Name is the player's name.
Name string
// Stack is the player's stack at hand start.
Stack Amount
}
Player represents a poker player.
func (*Player) UnmarshalJSON ¶
UnmarshalJSON parses a player from JSON.
type PlayerAction ¶
type PlayerAction struct {
// Position is the player's position.
Position PlayerPosition
// Action is the player's action.
Action Action
}
PlayerAction is a player's action.
func (*PlayerAction) UnmarshalJSON ¶
func (p *PlayerAction) UnmarshalJSON(b []byte) error
UnmarshalJSON parses a player action from JSON.
type PlayerCards ¶
type PlayerCards struct {
// Position is the player's position.
Position PlayerPosition
// Cards are the player's cards.
Cards []card.Card
}
PlayerCards is a player's cards.
func (*PlayerCards) UnmarshalJSON ¶
func (p *PlayerCards) UnmarshalJSON(b []byte) error
UnmarshalJSON parses player cards from JSON.
type PlayerPosition ¶
type PlayerPosition int
PlayerPosition is a position of a player. PlayerPositions are 1-indexed, and a value of 0 means 'no player'.
func NextPlayerPosition ¶
func NextPlayerPosition(pos PlayerPosition, tableSize int) PlayerPosition
NextPlayerPosition returns the next player position at the table.
func PreviousPlayerPosition ¶
func PreviousPlayerPosition(pos PlayerPosition, tableSize int) PlayerPosition
PreviousPlayerPosition returns the previous player position at the table.
func (PlayerPosition) Player ¶
func (p PlayerPosition) Player(h *Hand) *Player
Player returns the player given his position. h is the hand in question.
type Result ¶
type Result struct {
Winner PlayerPosition
Pot Amount
ShowDowns []PlayerCards
}
type Stakes ¶
type Stakes struct {
// SmallBlind is the size of the small blind.
SmallBlind Amount
// BigBlind is the size of the big blind.
BigBlind Amount
}
Stakes represents table stakes.
func ParseStakes ¶
ParseStakes parses a string to a stakes object. The string must be in a format similar to '$0.01/$0.02 USD'.
func (Stakes) MarshalJSON ¶
MarshalJSON marshals the string representation of stakes.
func (Stakes) String ¶
String returns a string representation of the stakes in the form '$0.01/$0.02 USD'.
func (*Stakes) UnmarshalJSON ¶
UnmarshalJSON parses stakes from JSON.