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 source realm

Package tictactoe is a two-player tic-tac-toe realm.

Overview

Package tictactoe is a two-player tic-tac-toe realm.

Join(cur, "X") / Join(cur, "O") claims a mark; Play(cur, pos) plays cell pos (0-8, row-major); Reset(cur) clears the board once a game has ended. Render shows the current board.

Functions 4

func Join

crossing Action
1func Join(cur realm, mark string)
source

Join claims the X or O mark for the calling account. Each mark may only be claimed once per game; call Reset to start a new game.

func Play

crossing Action
1func Play(cur realm, pos int)
source

Play places the calling player's mark at pos (0-8, row-major).

func Render

1func Render(_ string) string
source

Render draws the current board and game status as markdown.

func Reset

crossing Action
1func Reset(cur realm)
source

Reset clears the board and both player slots. Only a current player may reset, and only after the game has ended.

Imports 2

  • chain stdlib
  • strconv stdlib

Source Files 2