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

v0 state

Back to all declarations

Move

type

Move is one of rock, paper, or scissors, ordered so that (winner - loser + 3) % 3 == 1 for every winning pair.

Value

v0.Move

Rock

v0.Move

Value

<zero>

Paper

v0.Move

Value

<zero>

Scissors

v0.Move

Value

<zero>

winsNeeded

untyped bigint

winsNeeded is the number of round wins required to take a match.

Value

(2 <untyped> bigint)

match

type

match tracks an in-progress best-of-three series for one player.

Value

v0.match

playerState

type

playerState is the persisted record for one address.

Value

v0.playerState

players

v0.Tree

// address string -> \*playerState

Open
OID
03c83b…6b73:4
players details

Inspect ref

nonce

int

Value

0

totalRounds

int

Value

0

champion

.uverse.address

Value

<zero>

championWins

int

Value

0

parseMove

func(s string) (v0.Move, bool)
Open
OID
03c83b…6b73:11
parseMove details

Inspect func

judge

func(p v0.Move, h v0.Move) int

judge returns 0 for a tie, 1 if p beats h, 2 if h beats p.

Open
OID
03c83b…6b73:12
judge details

Inspect func

pickHouseMove

func(caller .uverse.address, n int) v0.Move

pickHouseMove derives a deterministic pseudo-random move from the current chain height, a monotonic per-realm nonce, and the caller's address, so repeated throws in the same block still diverge.

Open
OID
03c83b…6b73:13
pickHouseMove details

Inspect func

getOrCreate

func(addr .uverse.address) *v0.playerState
Open
OID
03c83b…6b73:14
getOrCreate details

Inspect func

Throw

func(moveStr string) string

Throw plays one round of the caller's current match, starting a fresh match if none is in progress. Accepts "rock"/"paper"/"scissors" or the single-letter shorthand "r"/"p"/"s".

Open
OID
03c83b…6b73:15
Throw details

Inspect func

escapeInline

func(s string) string

escapeInline neutralizes markdown-active characters in untrusted text before it's embedded inline in Render output.

Open
OID
03c83b…6b73:17
escapeInline details

Inspect func

renderPlayer

func(rawAddr string) string
Open
OID
03c83b…6b73:18
renderPlayer details

Inspect func

Render

func(path string) string

Render shows the arena dashboard at "", or one player's record when path is their bech32 address.

Open
OID
03c83b…6b73:19
Render details

Inspect func
Move : type =v0.Move
Rock : v0.Move =<zero>
Paper : v0.Move =<zero>
Scissors : v0.Move =<zero>
winsNeeded : untyped bigint =(2 <untyped> bigint)
match : type =v0.match
playerState : type =v0.playerState
players : v0.Tree Inspect
nonce : int =0
totalRounds : int =0
champion : .uverse.address =<zero>
championWins : int =0
moveName : func(m v0.Move) string Inspect
parseMove : func(s string) (v0.Move, bool) Inspect
judge : func(p v0.Move, h v0.Move) int Inspect
pickHouseMove : func(caller .uverse.address, n int) v0.Move Inspect
getOrCreate : func(addr .uverse.address) *v0.playerState Inspect
Throw : func(moveStr string) string Inspect
renderHome : func() string Inspect
escapeInline : func(s string) string Inspect
renderPlayer : func(rawAddr string) string Inspect
Render : func(path string) string Inspect