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

tictactoe state

Back to all declarations

zero

.uverse.address

Value

<zero>

playerX

.uverse.address

Value

<gnolang.StringValue>

playerO

.uverse.address

Value

<zero>

turn

string

// "X" or "O", whose move is next

Value

"X"

winner

string

// "", "X", "O", or "Draw"

Value

""

moves

int

Value

0

Join

func() string

Join seats the caller as X (if the seat is open) or O (if X is taken). Panics if both seats are already filled.

Open
OID
072ee6…fc4d:13
Join details

Inspect func

Move

func(pos int)

Move places the caller's mark at the given cell (0-8) if it is their turn and the cell is empty, then checks for a win or a draw.

Open
OID
072ee6…fc4d:14
Move details

Inspect func

Reset

func()

Reset clears the board for a new game. Only callable once the current game has ended (someone won or the board is full).

Open
OID
072ee6…fc4d:15
Reset details

Inspect func

Render

func(path string) string

Render draws the current board and game status as markdown.

Open
OID
072ee6…fc4d:28
Render details

Inspect func
zero : .uverse.address =<zero>
board : [9]string Inspect
playerX : .uverse.address =<gnolang.StringValue>
playerO : .uverse.address =<zero>
turn : string ="X"
winner : string =""
moves : int =0
init.7 : func() Inspect
Join : func() string Inspect
Move : func(pos int) Inspect
Reset : func() Inspect
winLines : [8][3]int Inspect
checkWin : func(mark string) bool Inspect
cell : func(pos int) string Inspect
Render : func(path string) string Inspect