Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v1 state

Back to all declarations

selfPath

untyped string

selfPath is this realm's own page. A root-relative link resolves against the domain, not the realm, so every link back into it names it in full.

Value

"/r/moul/x/daily/connect4/v1"

cols

untyped bigint

Value

(7 <untyped> bigint)

rows

untyped bigint

Value

(6 <untyped> bigint)

empty

untyped bigint

cell values

Value

(0 <untyped> bigint)

red

untyped bigint

// 🔴 game creator (caller of NewGame)

Value

(1 <untyped> bigint)

yel

untyped bigint

// 🟡 opponent

Value

(2 <untyped> bigint)

Game

type

Game holds the full state of one Connect Four match. board is indexed board\[row]\[col]; row 0 is the BOTTOM row. It carries no ID field: the id belongs to the store, which hands it back on lookup and iteration.

Value

v1.Game

games

*v0.Store

games assigns the game ids. v1 kept its own nextID plus an idKey() that zero-padded to width 12, which stopped ordering the Render list past 10^12.

Open
OID
023ed8…3f2a:4
games details

Inspect pointer

NewGame

func(opponent .uverse.address) int64

NewGame creates a match between the caller (🔴) and opponent (🟡). Returns the new game id.

Open
OID
023ed8…3f2a:7
NewGame details

Inspect func

getGame

func(id int64) (*v1.Game, .uverse.error)
Open
OID
023ed8…3f2a:9
getGame details

Inspect func

Drop

func(gameID int64, column int)

Drop places the caller's disc into the given column (0-6). Enforces turn order by caller, rejects full columns, and detects a 4-in-a-row win or a draw.

Open
OID
023ed8…3f2a:10
Drop details

Inspect func

wins

func(b *[6][7]int, r int, c int, p int) bool

wins checks whether the disc just placed at (r,c) for player p completes a run of 4 in any of the four directions.

Open
OID
023ed8…3f2a:12
wins details

Inspect func

run

func(b *[6][7]int, r int, c int, dr int, dc int, p int) int
Open
OID
023ed8…3f2a:13
run details

Inspect func

Render

func(path string) string

Render draws the board with 🔴🟡· and shows whose turn / the winner. path "" lists all games; path "\<id>" shows a single board.

Open
OID
023ed8…3f2a:15
Render details

Inspect func

renderGame

func(id v0.ID, g *v1.Game) string
Open
OID
023ed8…3f2a:17
renderGame details

Inspect func
selfPath : untyped string ="/r/moul/x/daily/connect4/v1"
cols : untyped bigint =(7 <untyped> bigint)
rows : untyped bigint =(6 <untyped> bigint)
empty : untyped bigint =(0 <untyped> bigint)
red : untyped bigint =(1 <untyped> bigint)
yel : untyped bigint =(2 <untyped> bigint)
Game : type =v1.Game
games : *v0.Store Inspect
NewGame : func(opponent .uverse.address) int64 Inspect
getGame : func(id int64) (*v1.Game, .uverse.error) Inspect
Drop : func(gameID int64, column int) Inspect
full : func(b *[6][7]int) bool Inspect
wins : func(b *[6][7]int, r int, c int, p int) bool Inspect
run : func(b *[6][7]int, r int, c int, dr int, dc int, p int) int Inspect
glyph : func(v int) string Inspect
Render : func(path string) string Inspect
renderList : func() string Inspect
renderGame : func(id v0.ID, g *v1.Game) string Inspect