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

maxHistory

untyped bigint

Value

(10 <untyped> bigint)

maxRecords

untyped bigint

Value

(5 <untyped> bigint)

guessLog

type

Value

v0.guessLog

record

type

Value

v0.record

round

int

Value

1

attempts

int

Value

0

history

[]v0.guessLog

Value

<zero>

records

[]v0.record

Value

<zero>

seedFor

func(r int) int64

seedFor derives a per-round PRNG seed from the current chain height so nobody can precompute the next secret before the round actually starts.

Open
OID
05b21d…2d84:11
seedFor details

Inspect func

nextRand

func(seed int64) int64

nextRand is a minimal LCG (glibc constants) — no crypto strength needed for a casual puzzle, just enough spread across digits.

Open
OID
05b21d…2d84:12
nextRand details

Inspect func

newSecret

func(seed int64) [4]int
Open
OID
05b21d…2d84:13
newSecret details

Inspect func

parseGuess

func(guess string) ([4]int, bool)

parseGuess validates a 4-digit, distinct-digit guess string.

Open
OID
05b21d…2d84:14
parseGuess details

Inspect func

score

func(target [4]int, guess [4]int) (int, int)

score returns (bulls, cows) for guess against target, assuming both have distinct digits (guaranteed by parseGuess / newSecret).

Open
OID
05b21d…2d84:15
score details

Inspect func

addHistory

func(l v0.guessLog)
Open
OID
05b21d…2d84:16
addHistory details

Inspect func

addRecord

func(r v0.record)

addRecord keeps the top maxRecords fastest solves, ascending by attempts.

Open
OID
05b21d…2d84:17
addRecord details

Inspect func

Guess

func(guess string) string

Guess submits a 4-distinct-digit code against the current round's secret. Returns the bulls/cows feedback, or "solved!" text when it's a win.

Open
OID
05b21d…2d84:19
Guess details

Inspect func

GiveUp

func() string

GiveUp reveals the current secret and starts a fresh round without awarding a leaderboard record.

Open
OID
05b21d…2d84:20
GiveUp details

Inspect func

digitsToString

func(d [4]int) string
Open
OID
05b21d…2d84:21
digitsToString details

Inspect func

shortAddr

func(a string) string
Open
OID
05b21d…2d84:23
shortAddr details

Inspect func
maxHistory : untyped bigint =(10 <untyped> bigint)
maxRecords : untyped bigint =(5 <untyped> bigint)
guessLog : type =v0.guessLog
record : type =v0.record
secret : [4]int Inspect
round : int =1
attempts : int =0
history : []v0.guessLog =<zero>
records : []v0.record =<zero>
init.9 : func() Inspect
seedFor : func(r int) int64 Inspect
nextRand : func(seed int64) int64 Inspect
newSecret : func(seed int64) [4]int Inspect
parseGuess : func(guess string) ([4]int, bool) Inspect
score : func(target [4]int, guess [4]int) (int, int) Inspect
addHistory : func(l v0.guessLog) Inspect
addRecord : func(r v0.record) Inspect
startNewRound : func() Inspect
Guess : func(guess string) string Inspect
GiveUp : func() string Inspect
digitsToString : func(d [4]int) string Inspect
Render : func(path string) string Inspect
shortAddr : func(a string) string Inspect