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

rock

untyped bigint

Moves.

Value

(0 <untyped> bigint)

paper

untyped bigint

Moves.

Value

(1 <untyped> bigint)

scissors

untyped bigint

Moves.

Value

(2 <untyped> bigint)

outLose

untyped bigint

// player loses

Value

(0 <untyped> bigint)

outDraw

untyped bigint

Outcomes.

Value

(1 <untyped> bigint)

outWin

untyped bigint

// player wins

Value

(2 <untyped> bigint)

tally

type

tally holds a single player's cumulative record.

Value

v0.tally

round

type

round is one recorded game (for the recent-rounds table).

Value

v0.round

rounds

[]v0.round

// append-only history; Render shows the tail

Value

<zero>

totalWins

int

// player wins

Value

0

totalLosses

int

// player losses

Value

0

totalDraws

int

State.

Value

0

totalRounds

int

State.

Value

0

maxRecent

untyped bigint

Value

(8 <untyped> bigint)

parseChoice

func(choice string) (int, bool)

parseChoice maps a choice string to a move index; ok=false if invalid.

Open
OID
0a0f42…c009:13
parseChoice details

Inspect func

houseMove

func(height int64, playCount int) int

houseMove derives the house move deterministically from the chain height and the caller's play count (so repeated calls in the same block differ).

Open
OID
0a0f42…c009:15
houseMove details

Inspect func

decide

func(playerMove int, houseM int) int

decide returns the outcome from the player's perspective.

Open
OID
0a0f42…c009:16
decide details

Inspect func

getTally

func(key string) *v0.tally
Open
OID
0a0f42…c009:17
getTally details

Inspect func

Play

func(choice string)

Play plays one round against the chain. choice is "rock"|"paper"|"scissors" (single-letter shortcuts accepted). It panics on an invalid choice.

Open
OID
0a0f42…c009:18
Play details

Inspect func

outcomeName

func(o int) string
Open
OID
0a0f42…c009:19
outcomeName details

Inspect func

winRate

func(wins int, plays int) string
Open
OID
0a0f42…c009:20
winRate details

Inspect func

Render

func(path string) string

Render returns a Markdown dashboard: global tally, per-player table, and the last few rounds. It is caller-agnostic (no cur).

Open
OID
0a0f42…c009:21
Render details

Inspect func

shortAddr

func(a string) string

shortAddr abbreviates an address string for display.

Open
OID
0a0f42…c009:22
shortAddr details

Inspect func
rock : untyped bigint =(0 <untyped> bigint)
paper : untyped bigint =(1 <untyped> bigint)
scissors : untyped bigint =(2 <untyped> bigint)
moveNames : [3]string Inspect
outLose : untyped bigint =(0 <untyped> bigint)
outDraw : untyped bigint =(1 <untyped> bigint)
outWin : untyped bigint =(2 <untyped> bigint)
tally : type =v0.tally
round : type =v0.round
players : *v0.Tree Inspect
rounds : []v0.round =<zero>
totalWins : int =0
totalLosses : int =0
totalDraws : int =0
totalRounds : int =0
maxRecent : untyped bigint =(8 <untyped> bigint)
parseChoice : func(choice string) (int, bool) Inspect
houseMove : func(height int64, playCount int) int Inspect
decide : func(playerMove int, houseM int) int Inspect
getTally : func(key string) *v0.tally Inspect
Play : func(choice string) Inspect
outcomeName : func(o int) string Inspect
winRate : func(wins int, plays int) string Inspect
Render : func(path string) string Inspect
shortAddr : func(a string) string Inspect