Documentation
¶
Overview ¶
Package engine provides access to the game engine.
Index ¶
- type Bet
- type Config
- type Cup
- type Engine
- func (e *Engine) Bet(gameID string, number int, suit rune) (State, error)
- func (e *Engine) Configuration() (Config, error)
- func (e *Engine) Connect(keyStorePath string, address common.Address, passPhrase string) (Token, error)
- func (e *Engine) Events(f func(event string, address common.Address)) (func(), error)
- func (e *Engine) JoinGame(gameID string) (State, error)
- func (e *Engine) Liar(gameID string) (State, error)
- func (e *Engine) NewGame() (State, error)
- func (e *Engine) QueryState(gameID string) (State, error)
- func (e *Engine) Reconcile(gameID string) (State, error)
- func (e *Engine) RollDice(gameID string) (State, error)
- func (e *Engine) StartGame(gameID string) (State, error)
- func (e *Engine) Tables(gameID string) (Tables, error)
- func (e *Engine) URL() string
- type ErrorResponse
- type State
- type Tables
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bet ¶
type Bet struct { AccountID common.Address `json:"account"` Number int `json:"number"` Suit int `json:"suit"` }
Bet represents the bet response.
type Config ¶
type Config struct { Network string `json:"network"` ChainID int `json:"chainId"` ContractID common.Address `json:"contractId"` }
Config represents the configuration of the game engine.
type Cup ¶
type Cup struct { AccountID common.Address `json:"account"` Dice []int `json:"dice"` LastBet Bet `json:"lastBet"` Outs int `json:"outs"` }
Cup represents the cup response.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine provides access to the game engine API.
func (*Engine) Configuration ¶
Configuration returns the configuration of the game engine.
func (*Engine) Connect ¶
func (e *Engine) Connect(keyStorePath string, address common.Address, passPhrase string) (Token, error)
Connect authenticates the use to the game engine.
func (*Engine) QueryState ¶
QueryState returns the current state of the specified game.
type ErrorResponse ¶
type ErrorResponse struct { Error string `json:"error"` Fields map[string]string `json:"fields,omitempty"` }
ErrorResponse is the form used for API responses from failures in the API.
type State ¶
type State struct { GameID string `json:"gameID"` Status string `json:"status"` AnteUSD float64 `json:"anteUSD"` LastOutAcctID common.Address `json:"lastOut"` LastWinAcctID common.Address `json:"lastWin"` CurrentAcctID common.Address `json:"currentID"` Round int `json:"round"` Cups []Cup `json:"cups"` CupsOrder []common.Address `json:"playerOrder"` Bets []Bet `json:"bets"` Balances []string `json:"balances"` }
State represents the game state.
Click to show internal directories.
Click to hide internal directories.