Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source pure

Package shootout holds the state types of gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shots: games, challenge...

Overview

Package shootout holds the state types of gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shots: games, challengers' sessions and their kicks.

They live in a package rather than in the realm because gno only lets a realm's own code allocate the types that realm declares, and the game's rules engine runs in a separate, upgradeable implementation realm. Declared here, both realms can build and read them, and like the realm's storage they never change once deployed.

Constants 2

const GameOpen, GamePlaying, GameWon, GameCancelled

1const (
2	GameOpen      GameStatus = iota + 1 // waiting for a challenger
3	GamePlaying                         // a challenger is playing a shootout
4	GameWon                             // a challenger won the pot; closed
5	GameCancelled                       // the creator withdrew it before anyone played; closed
6)
source

Types 5

type Game

struct
 1type Game struct {
 2	ID            uint64
 3	Creator       address
 4	Config        penalty.Config
 5	EntryFee      int64 // ugnot a challenger pays into the pot to play
 6	TimeoutBlocks int64 // a challenger idle this long may be forfeited by anyone
 7	Pot           int64 // ugnot
 8	Status        GameStatus
 9	Sessions      int // challengers so far; while playing, the live session is number Sessions
10	Winner        address
11	CreatedHeight int64
12	ClosedHeight  int64
13}
source

Game is a pot and the constants it is played for.

type GameStatus

ident
1type GameStatus uint8
source

GameStatus is where a game is in its life.

Methods on GameStatus

func String

method on GameStatus
1func (s GameStatus) String() string
source

type Kick

struct
 1type Kick struct {
 2	Round  int
 3	Kicker penalty.Side
 4	Shot   penalty.ShotParams
 5	Plan   penalty.KeeperPlan
 6	Seed   penalty.Seed
 7	Result penalty.Result
 8	Height int64 // block the kick was played in
 9	Time   int64 // its block time, unix nanoseconds (the seed's source)
10}
source

Kick is one kick of a shootout, with everything needed to re-run it: penalty.SimulateShot(Shot, Plan, game.Config) == Result. Seed is the 32 bytes that completed it, derived from the block it was played in.

type Session

struct
 1type Session struct {
 2	GameID           uint64
 3	No               int
 4	Player           address
 5	Paid             int64
 6	Score            penalty.Shootout
 7	Kicks            []Kick
 8	Status           SessionStatus
 9	JoinHeight       int64
10	LastActionHeight int64
11	EndHeight        int64
12}
source

Session is one challenger's shootout against the chain.

Methods on Session

func Next

method on Session
1func (s Session) Next() string
source

Next says what the session is waiting for: "shoot", "keep", or "none" once it is over.

type SessionStatus

ident
1type SessionStatus uint8
source

SessionStatus is how a challenger's shootout stands.

Methods on SessionStatus

func String

method on SessionStatus
1func (s SessionStatus) String() string
source

Dependencies

Imports 1

/p/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shootout/v0

Imported by indexer

Source Files 2