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.

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>

parseMove

func(s string) (v1.Move, bool)
Open
OID
0a107b…4bf8:5
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
0a107b…4bf8:6
judge details

Inspect func

beats

func(m v1.Move) v1.Move

beats returns the move that defeats m.

Open
OID
0a107b…4bf8:7
beats details

Inspect func

playerState

type

playerState is the persisted record for one address.

Value

v1.playerState

players

v0.Tree

// address string -> \*playerState

Open
OID
0a107b…4bf8: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) *v1.playerState
Open
OID
0a107b…4bf8:15
getOrCreate details

Inspect func

predict

func(ps *v1.playerState, seed int64) v1.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
0a107b…4bf8: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
0a107b…4bf8:17
Play details

Inspect func

renderPlayer

func(rawAddr string) string
Open
OID
0a107b…4bf8:19
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
0a107b…4bf8:20
Render details

Inspect func
Move : type =v1.Move
Rock : v1.Move =<zero>
Paper : v1.Move =<zero>
Scissors : v1.Move =<zero>
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
beats : func(m v1.Move) v1.Move Inspect
playerState : type =v1.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) *v1.playerState Inspect
predict : func(ps *v1.playerState, seed int64) v1.Move Inspect
Play : func(moveStr string) string Inspect
renderHome : func() string Inspect
renderPlayer : func(rawAddr string) string Inspect
Render : func(path string) string Inspect