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

v1 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

v1.Move

Rock

v1.Move

Value

<zero>

Paper

v1.Move

Value

<zero>

Scissors

v1.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

v1.match

playerState

type

playerState is the persisted record for one address.

Value

v1.playerState

players

v0.Tree

// address string -> \*playerState

Open
OID
0a425f…6e20: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) (v1.Move, bool)
Open
OID
0a425f…6e20:11
parseMove details

Inspect func

judge

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

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

Open
OID
0a425f…6e20:12
judge details

Inspect func

pickHouseMove

func(caller .uverse.address, n int) v1.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
0a425f…6e20:13
pickHouseMove details

Inspect func

getOrCreate

func(addr .uverse.address) *v1.playerState
Open
OID
0a425f…6e20: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
0a425f…6e20:15
Throw details

Inspect func

renderPlayer

func(rawAddr string) string
Open
OID
0a425f…6e20:17
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
0a425f…6e20:18
Render details

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