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

question

type

question is one fixed trivia entry.

Value

v0.question

round

type

round holds the mutable state of the currently open question.

Value

v0.round

scores

*v0.Tree

// addr(string) -> \*int, points across all rounds

Open
OID
065c29…687f:23
scores details

Inspect pointer

totalCorrect

int

// lifetime count of correctly-answered questions

Value

0

newRound

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

newRound builds a fresh round. The question index cycles through the fixed list, offset by a height-derived starting point so consecutive deploys don't all open on the same question.

Open
OID
065c29…687f:28
newRound details

Inspect func

questionIndex

func(number int, height int64) int

questionIndex maps a round number and a height (entropy source for the starting offset) to a slot in the questions slice. Deterministic and pure so it's easy to unit test.

Open
OID
065c29…687f:29
questionIndex details

Inspect func

Answer

func(choiceIdx int) string

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

Open
OID
065c29…687f:30
Answer details

Inspect func

addScore

func(addr string)

addScore bumps addr's lifetime point count.

Open
OID
065c29…687f:31
addScore details

Inspect func

leaderboardEntry

type

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

Value

v0.leaderboardEntry

leaderboard

func() []v0.leaderboardEntry
Open
OID
065c29…687f:33
leaderboard details

Inspect func

Render

func(path string) string

Render produces the gnoweb Markdown view of the quiz.

Open
OID
065c29…687f:34
Render details

Inspect func
question : type =v0.question
round : type =v0.round
questions : []v0.question (len=8) Inspect
current : *v0.round Inspect
scores : *v0.Tree Inspect
totalCorrect : int =0
init.6 : func() Inspect
newRound : func(number int, height int64) *v0.round Inspect
questionIndex : func(number int, height int64) int Inspect
Answer : func(choiceIdx int) string Inspect
addScore : func(addr string) Inspect
scoreOf : func(addr string) int Inspect
leaderboardEntry : type =v0.leaderboardEntry
leaderboard : func() []v0.leaderboardEntry Inspect
Render : func(path string) string Inspect