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

maxHistory

untyped bigint

Value

(10 <untyped> bigint)

maxRecords

untyped bigint

Value

(5 <untyped> bigint)

guessLog

type

Value

v1.guessLog

record

type

Value

v1.record

round

int

Value

1

attempts

int

Value

0

history

[]v1.guessLog

Value

<zero>

records

[]v1.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
070a1e…2f96: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
070a1e…2f96:12
nextRand details

Inspect func

newSecret

func(seed int64) [4]int
Open
OID
070a1e…2f96:13
newSecret details

Inspect func

parseGuess

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

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

Open
OID
070a1e…2f96: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
070a1e…2f96:15
score details

Inspect func

addHistory

func(l v1.guessLog)
Open
OID
070a1e…2f96:16
addHistory details

Inspect func

addRecord

func(r v1.record)

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

Open
OID
070a1e…2f96: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
070a1e…2f96: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
070a1e…2f96:20
GiveUp details

Inspect func

digitsToString

func(d [4]int) string
Open
OID
070a1e…2f96:21
digitsToString details

Inspect func

shortAddr

func(a string) string
Open
OID
070a1e…2f96:23
shortAddr details

Inspect func
maxHistory : untyped bigint =(10 <untyped> bigint)
maxRecords : untyped bigint =(5 <untyped> bigint)
guessLog : type =v1.guessLog
record : type =v1.record
secret : [4]int Inspect
round : int =1
attempts : int =0
history : []v1.guessLog =<zero>
records : []v1.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 v1.guessLog) Inspect
addRecord : func(r v1.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