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.

v3 state

Back to all declarations

RegulationKicks

untyped bigint

// kicks each side takes before sudden death (win by 1), or at most

Value

(5 <untyped> bigint)

DefaultWinBy

untyped bigint

// goals a challenger must win by, unless the creator chose 1 or 3

Value

(2 <untyped> bigint)

MaxWinBy

untyped bigint

Value

(3 <untyped> bigint)

CreatorPercent

untyped bigint

// of the pot, paid to the game's creator when it is won

Value

(20 <untyped> bigint)

MinDeposit

untyped bigint

// ugnot to seed a pot (1 GNOT)

Value

(1000000 <untyped> bigint)

MinEntryFee

untyped bigint

// ugnot (0.1 GNOT)

Value

(100000 <untyped> bigint)

DefaultTimeout

untyped bigint

// blocks a challenger may sit idle

Value

(1000 <untyped> bigint)

MinTimeout

untyped bigint

Value

(30 <untyped> bigint)

MaxTimeout

untyped bigint

Value

(200000 <untyped> bigint)

engine

type

Value

v3.engine

Instance

func() shots.Impl

Instance returns the implementation, for a caller that registers it explicitly rather than relying on init.

Open
OID
04357b…6aaf:6
Instance details

Inspect func

WinBy

func(gameID uint64) int

WinBy is how many goals a challenger must win game gameID by: as chosen at creation, or 1 for a game created before this implementation.

Open
OID
04357b…6aaf:12
WinBy details

Inspect func

setWinBy

func(gameID uint64, winBy int)

setWinBy records a new game's margin. It crosses into this realm: the engine's methods run as the shots realm, which may not write this realm's table.

Open
OID
04357b…6aaf:13
setWinBy details

Inspect func

takeWinBy

func(config string) (int, string)

takeWinBy removes "winBy=N" from a config string, returning N (DefaultWinBy if absent) and the rest for penalty.ParseConfig.

Open
OID
04357b…6aaf:14
takeWinBy details

Inspect func

checkConstants

func(cfg v0.Config) string

checkConstants allows a game four small changes from the default constants, and nothing else: the chain's mixes are the equilibrium of the default game, and every change opens a gap a skilled player can use. Within these ranges a player who plays the best moves wins 11-14% of shootouts (against 11% under the defaults); outside them up to 40%, which no pot survives. The ranges, as the web client offers them: goal width goalWidth 6400..7000 mm keeper size keeperScale 1117..1235 (95..105% of 1176) keeper agility diveMin and diveMax at 90..105% of 2600 and 5200, together (diveMax = 2 x diveMin) shot speed ballMaxSpeed 34000..37400 mm/s (100..110%) It returns why cfg is refused, or "".

Open
OID
04357b…6aaf:15
checkConstants details

Inspect func

decided

func(sc v0.Shootout, winBy int) v0.Side

decided says whether a shootout is over, and who won it. Win by 1 is a normal shootout (penalty.Shootout's rules, sudden death included). For a larger margin it is SidePlayer once the player is sure to finish winBy goals ahead after RegulationKicks each, SideChain once they no longer can, and 0 while it is open.

Open
OID
04357b…6aaf:16
decided details

Inspect func

settled

func(s v0.Session) v0.Session

settled is an ended session as it stays on chain: everything but its kicks (see SETTLING).

Open
OID
04357b…6aaf:17
settled details

Inspect func

entropy

func(g v0.Game, s v0.Session, blockTime int64) v0.Seed

entropy is the kick's 32-byte seed: SHA-256 of the block time and the kick's identity (see the package comment for what that does and does not guarantee).

Open
OID
04357b…6aaf:18
entropy details

Inspect func

mustGame

func(st *shots.StateRef, id uint64) v0.Game
Open
OID
04357b…6aaf:19
mustGame details

Inspect func

session

func(st *shots.StateRef, id uint64, no int) (v0.Session, bool)

session reads the live session of a game as this realm's own copy.

Open
OID
04357b…6aaf:20
session details

Inspect func

ownGame

func(g v0.Game) v0.Game

ownGame and ownSession rebuild values read through shots.Store in this realm. What Store hands back was allocated by the shots realm, and the VM refuses writes to another realm's objects (a pointer-method update such as Shootout.Record trips its cross-realm check), so the engine only ever mutates copies it built itself; PutGame/PutSession copy them back.

Open
OID
04357b…6aaf:21
ownGame details

Inspect func

ownSession

func(s v0.Session) v0.Session
Open
OID
04357b…6aaf:22
ownSession details

Inspect func

mustPlayersSession

func(st *shots.StateRef, gameID uint64, player .uverse.address) (v0.Game, v0.Session)
Open
OID
04357b…6aaf:23
mustPlayersSession details

Inspect func

chainPlan

type

chainPlan is a keeper plan of the chain's mix: cum is the cumulative weight out of 65536 (the seed's first two bytes pick the first entry above them), the rest the plan's four uint16 under the default constants.

Value

v3.chainPlan

chainKick

type

chainKick is a kick of the chain's mix, in the realm's units for the default goal: aim mm, contact milli-radii, power per-mille.

Value

v3.chainKick

chainKeeper

[]v3.chainPlan (len=7)

The equilibrium mixes for the default constants (a double-oracle solution of the shooter-keeper game on the physics engine; the value is a 78.5% conversion rate). Plans: a third wait and read the shot; the rest dive fast across the goal, mid-height or low. Kicks: low and hard 2.2 m out, top corners, high down the middle.

Open
OID
04357b…6aaf:27
chainKeeper details (len=7)

+7 more Inspect slice

pick

func(u uint32, cum func(...), n int) int

pick is the index of the first entry whose cumulative weight is above u.

Open
OID
04357b…6aaf:47
pick details

Inspect func

keeperFor

func(seed v0.Seed, c v0.Config) v0.KeeperPlan

keeperFor is the chain's keeper plan for a kick. Under constants with other mode bands (StarShare, ReadShare) a plan keeps its mode: a read stays a read, and a dive keeps its place within the dive band.

Open
OID
04357b…6aaf:49
keeperFor details

Inspect func

kickFor

func(seed v0.Seed, c v0.Config) v0.ShotInput

kickFor is the chain's kick, its aim scaled to the game's goal and its contact kept inside the game's selectable disc.

Open
OID
04357b…6aaf:50
kickFor details

Inspect func
RegulationKicks : untyped bigint =(5 <untyped> bigint)
DefaultWinBy : untyped bigint =(2 <untyped> bigint)
MaxWinBy : untyped bigint =(3 <untyped> bigint)
CreatorPercent : untyped bigint =(20 <untyped> bigint)
MinDeposit : untyped bigint =(1000000 <untyped> bigint)
MinEntryFee : untyped bigint =(100000 <untyped> bigint)
DefaultTimeout : untyped bigint =(1000 <untyped> bigint)
MinTimeout : untyped bigint =(30 <untyped> bigint)
MaxTimeout : untyped bigint =(200000 <untyped> bigint)
engine : type =v3.engine
instance : *v3.engine Inspect
Instance : func() shots.Impl Inspect
init.12 : func() Inspect
winBys : *v0.Tree Inspect
WinBy : func(gameID uint64) int Inspect
setWinBy : func(gameID uint64, winBy int) Inspect
takeWinBy : func(config string) (int, string) Inspect
checkConstants : func(cfg v0.Config) string Inspect
decided : func(sc v0.Shootout, winBy int) v0.Side Inspect
settled : func(s v0.Session) v0.Session Inspect
entropy : func(g v0.Game, s v0.Session, blockTime int64) v0.Seed Inspect
mustGame : func(st *shots.StateRef, id uint64) v0.Game Inspect
session : func(st *shots.StateRef, id uint64, no int) (v0.Session, bool) Inspect
ownGame : func(g v0.Game) v0.Game Inspect
ownSession : func(s v0.Session) v0.Session Inspect
mustPlayersSession : func(st *shots.StateRef, gameID uint64, player .uverse.address) (v0.Game, v0.Session) Inspect
itoa : func(n int64) string Inspect
u64 : func(n uint64) string Inspect
chainPlan : type =v3.chainPlan
chainKick : type =v3.chainKick
chainKeeper : []v3.chainPlan (len=7) Inspect
chainKicks : []v3.chainKick (len=10) Inspect
pick : func(u uint32, cum func(...), n int) int Inspect
seedU16 : func(s v0.Seed) uint32 Inspect
keeperFor : func(seed v0.Seed, c v0.Config) v0.KeeperPlan Inspect
kickFor : func(seed v0.Seed, c v0.Config) v0.ShotInput Inspect
isqrt : func(n int64) int64 Inspect