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

gridSize

untyped bigint

// 4x4

Value

(16 <untyped> bigint)

numPairs

untyped bigint

Value

(8 <untyped> bigint)

faces

[8]string

faces are the 8 distinct emoji; each appears exactly twice on the board.

Open
OID
0b2df3…a2d6:4
faces details

Inspect array

tile

type

tile holds the face index (0..7) for a cell and whether it is matched.

Value

v0.tile

board

struct{...}

board is the full game state. It is a package-level singleton so the realm persists a single shared game.

Open
OID
0b2df3…a2d6:6
board details

Inspect struct

shuffle

func(seed int64) [16]v0.tile

shuffle produces a deterministic permutation of the 16 tile faces from a 64-bit seed. It fills a slice with two of each face index then applies a Fisher-Yates shuffle driven by a simple LCG — fully deterministic, no RNG.

Open
OID
0b2df3…a2d6:24
shuffle details

Inspect func

NewGame

func()

NewGame reshuffles the board using the current block height as the seed.

Open
OID
0b2df3…a2d6:28
NewGame details

Inspect func

Flip

func(index int)

Flip reveals the tile at index (0..15). Rules: - If two tiles are already showing from a previous unmatched attempt, this Flip first clears them (they turn back to hidden), then reveals the requested tile as the first of a new attempt. - Revealing the second tile of an attempt completes a move: matching faces stay face-up (matched); a mismatch leaves both showing until the next Flip clears them. - Flipping an already-matched or already-showing tile is rejected.

Open
OID
0b2df3…a2d6:29
Flip details

Inspect func

cellFace

func(i int) string

cellFace returns the emoji to display for a cell given the current state.

Open
OID
0b2df3…a2d6:31
cellFace details

Inspect func

Render

func(path string) string

Render draws the board as Markdown: a 4x4 grid, move count and solved state.

Open
OID
0b2df3…a2d6:32
Render details

Inspect func
gridSize : untyped bigint =(16 <untyped> bigint)
numPairs : untyped bigint =(8 <untyped> bigint)
faces : [8]string Inspect
tile : type =v0.tile
board : struct{...} Inspect
shuffle : func(seed int64) [16]v0.tile Inspect
ensureStarted : func() Inspect
reset : func(height int64) Inspect
NewGame : func() Inspect
Flip : func(index int) Inspect
solved : func() bool Inspect
cellFace : func(i int) string Inspect
Render : func(path string) string Inspect