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

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.

Value

v0.Game

games

*v0.Tree

// id (zero-padded string) -> \*Game

Open
OID
071267…e91b:4
games details

Inspect pointer

nextID

int64

Value

0

NewGame

func(opponent .uverse.address) int64

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

Open
OID
071267…e91b:9
NewGame details

Inspect func

getGame

func(id int64) (*v0.Game, .uverse.error)
Open
OID
071267…e91b:10
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
071267…e91b:11
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
071267…e91b:13
wins details

Inspect func

run

func(b *[6][7]int, r int, c int, dr int, dc int, p int) int
Open
OID
071267…e91b:14
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
071267…e91b:16
Render details

Inspect func

short

func(a .uverse.address) string
Open
OID
071267…e91b:18
short details

Inspect func

renderGame

func(g *v0.Game) string
Open
OID
071267…e91b:19
renderGame details

Inspect func
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 =v0.Game
games : *v0.Tree Inspect
nextID : int64 =0
idKey : func(id int64) string Inspect
NewGame : func(opponent .uverse.address) int64 Inspect
getGame : func(id int64) (*v0.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
short : func(a .uverse.address) string Inspect
renderGame : func(g *v0.Game) string Inspect