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>

parseMove

func(s string) (v0.Move, bool)
Open
OID
0c5315…282b:5
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
0c5315…282b:6
judge details

Inspect func

beats

func(m v0.Move) v0.Move

beats returns the move that defeats m.

Open
OID
0c5315…282b:7
beats details

Inspect func

playerState

type

playerState is the persisted record for one address.

Value

v0.playerState

players

v0.Tree

// address string -> \*playerState

Open
OID
0c5315…282b:9
players details

Inspect ref

nonce

int

Value

0

totalRounds

int

Value

0

oracleCorrect

int

// rounds the oracle won by successfully countering

Value

0

topOutwitter

.uverse.address

Value

<zero>

topOutwitterWins

int

Value

0

getOrCreate

func(addr .uverse.address) *v0.playerState
Open
OID
0c5315…282b:15
getOrCreate details

Inspect func

predict

func(ps *v0.playerState, seed int64) v0.Move

predict guesses the player's next move as the most-played move in their history so far. Ties (including a fresh player's all-zero history) fall back to a chain-height-derived seed so the oracle doesn't always break ties the same way.

Open
OID
0c5315…282b:16
predict details

Inspect func

Play

func(moveStr string) string

Play pits the caller against the oracle: it predicts your next move from your own move history and throws the counter. Accepts "rock"/"paper"/"scissors" or the single-letter shorthand "r"/"p"/"s".

Open
OID
0c5315…282b:17
Play 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
0c5315…282b:19
escapeInline details

Inspect func

renderPlayer

func(rawAddr string) string
Open
OID
0c5315…282b:20
renderPlayer details

Inspect func

Render

func(path string) string

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

Open
OID
0c5315…282b:21
Render details

Inspect func
Move : type =v0.Move
Rock : v0.Move =<zero>
Paper : v0.Move =<zero>
Scissors : v0.Move =<zero>
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
beats : func(m v0.Move) v0.Move Inspect
playerState : type =v0.playerState
players : v0.Tree Inspect
nonce : int =0
totalRounds : int =0
oracleCorrect : int =0
topOutwitter : .uverse.address =<zero>
topOutwitterWins : int =0
getOrCreate : func(addr .uverse.address) *v0.playerState Inspect
predict : func(ps *v0.playerState, seed int64) v0.Move Inspect
Play : 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