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

question

type

question is one fixed trivia entry.

Value

v1.question

playerState

type

playerState is one address's progress through the question bank.

Value

v1.playerState

players

*v0.Tree

// addr(string) -> \*playerState

Open
OID
0e68bf…bddb:26
players details

Inspect pointer

startIndex

func(addr string, height int64) int

startIndex picks a deterministic starting question for a brand-new player, spreading players across the bank using their address and the height of their first answer as entropy.

Open
OID
0e68bf…bddb:28
startIndex details

Inspect func

getPlayer

func(addr string) *v1.playerState

getPlayer returns addr's state, lazily creating it on first contact.

Open
OID
0e68bf…bddb:30
getPlayer details

Inspect func

nextIndex

func(cur int, streak int, n int) int

nextIndex advances a solved player to a fresh-feeling next question: the step grows with the streak so a long run doesn't loop through the bank in a visibly fixed order.

Open
OID
0e68bf…bddb:31
nextIndex details

Inspect func

Answer

func(choiceIdx int) string

Answer submits a choice (0..3) for the caller's current question. Crossing function: caller invokes as Answer(cross(cur), choiceIdx).

Open
OID
0e68bf…bddb:32
Answer details

Inspect func

leaderboardEntry

type

leaderboardEntry is a snapshot row used only for rendering, sorted by best streak descending.

Value

v1.leaderboardEntry

leaderboard

func() []v1.leaderboardEntry
Open
OID
0e68bf…bddb:33
leaderboard details

Inspect func

renderQuestion

func(b *strings.Builder, p *v1.playerState)
Open
OID
0e68bf…bddb:34
renderQuestion details

Inspect func

Render

func(path string) string

Render produces the gnoweb Markdown view. The root path shows the rules and the leaderboard; a path of a bech32 address shows that player's current question and stats.

Open
OID
0e68bf…bddb:35
Render details

Inspect func
question : type =v1.question
playerState : type =v1.playerState
questions : []v1.question (len=10) Inspect
players : *v0.Tree Inspect
startIndex : func(addr string, height int64) int Inspect
getPlayer : func(addr string) *v1.playerState Inspect
nextIndex : func(cur int, streak int, n int) int Inspect
Answer : func(choiceIdx int) string Inspect
leaderboardEntry : type =v1.leaderboardEntry
leaderboard : func() []v1.leaderboardEntry Inspect
renderQuestion : func(b *strings.Builder, p *v1.playerState) Inspect
Render : func(path string) string Inspect