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

minTarget

untyped bigint

Value

(1 <untyped> bigint)

maxTarget

untyped bigint

Value

(1000 <untyped> bigint)

roundT

type

roundT holds the mutable state of the open round. The target stays hidden (never rendered, never returned) until Reveal closes the round.

Value

v0.roundT

winRecord

type

winRecord is one closed-round result, kept for the leaderboard.

Value

v0.winRecord

guessEntry

type

guessEntry is one address's blind guess for the current round.

Value

v0.guessEntry

entries

[]v0.guessEntry

Value

<zero>

leaderboard

[]v0.winRecord

Value

<zero>

newRound

func(number int, height int64) *v0.roundT

newRound builds a fresh round whose hidden target derives deterministically from the start height and round number. Gno has no runtime RNG, so mixing height with the round number is the only available entropy, and it also keeps consecutive rounds at the same height from repeating a target.

Open
OID
05a769…3183:8
newRound details

Inspect func

targetFromHeight

func(h int64, round int) int
Open
OID
05a769…3183:9
targetFromHeight details

Inspect func

Guess

func(n int) string

Guess records the caller's single blind guess for the current round. It returns no hint about correctness — that is the whole point of the puzzle. Crossing function: caller invokes as Guess(cross(cur), n).

Open
OID
05a769…3183:10
Guess details

Inspect func

hasGuessed

func(addr string) bool
Open
OID
05a769…3183:11
hasGuessed details

Inspect func

Reveal

func() string

Reveal closes the current round: discloses the target, crowns whoever landed closest (ties favor the earliest guesser), records a leaderboard entry, and opens a fresh round. Panics if nobody has guessed yet. Crossing function.

Open
OID
05a769…3183:12
Reveal details

Inspect func

distance

func(guess int, target int) int
Open
OID
05a769…3183:13
distance details

Inspect func

Render

func(path string) string

Render produces the gnoweb Markdown view. The current round's target and individual guess values are never shown — only the player count — so rendering the page can't leak the puzzle.

Open
OID
05a769…3183:14
Render details

Inspect func

renderLeaderboard

func() string

renderLeaderboard formats closed rounds ranked by smallest distance (ties: earlier round first). Sorted on a copy so state is untouched.

Open
OID
05a769…3183:15
renderLeaderboard details

Inspect func

sortByClosest

func(rs []v0.winRecord)

sortByClosest does an in-place insertion sort: smallest distance first, then earlier round first on ties. Small n; insertion sort keeps it deterministic and dependency-free.

Open
OID
05a769…3183:16
sortByClosest details

Inspect func

closer

func(a v0.winRecord, b v0.winRecord) bool
Open
OID
05a769…3183:17
closer details

Inspect func

shortAddr

func(a string) string
Open
OID
05a769…3183:18
shortAddr details

Inspect func
minTarget : untyped bigint =(1 <untyped> bigint)
maxTarget : untyped bigint =(1000 <untyped> bigint)
roundT : type =v0.roundT
winRecord : type =v0.winRecord
guessEntry : type =v0.guessEntry
current : *v0.roundT Inspect
entries : []v0.guessEntry =<zero>
leaderboard : []v0.winRecord =<zero>
init.8 : func() Inspect
newRound : func(number int, height int64) *v0.roundT Inspect
targetFromHeight : func(h int64, round int) int Inspect
Guess : func(n int) string Inspect
hasGuessed : func(addr string) bool Inspect
Reveal : func() string Inspect
distance : func(guess int, target int) int Inspect
Render : func(path string) string Inspect
renderLeaderboard : func() string Inspect
sortByClosest : func(rs []v0.winRecord) Inspect
closer : func(a v0.winRecord, b v0.winRecord) bool Inspect
shortAddr : func(a string) string Inspect