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.

minichess state

Back to all declarations

Mode

type

Mode is how a game is played.

Value

minichess.Mode

ModeSolo

minichess.Mode

// human vs bot

Value

<zero>

ModeTwoPlayer

minichess.Mode

// human vs human

Value

<zero>

State

type

State is a game's lifecycle stage.

Value

minichess.State

StateWaiting

minichess.State

// challenge waiting for an opponent

Value

<zero>

StateActive

minichess.State

// being played

Value

<zero>

StateWhiteWon

minichess.State

Value

<zero>

StateBlackWon

minichess.State

Value

<zero>

StateDraw

minichess.State

Value

<zero>

StateCancelled

minichess.State

// challenge withdrawn before anyone joined

Value

<zero>

Game

type

Game is one game of minichess.

Value

minichess.Game

openGames

*v0.Tree

// padded id -> \*Game, challenges awaiting an opponent

Open
OID
0ae888…c23d:7
openGames details

Inspect pointer

playerGames

*v0.Tree

// address -> \[]int

Open
OID
0ae888…c23d:10
playerGames details

Inspect pointer

nextID

int

Value

11

realmPath

string

// e.g. "/r/g1um2pwwnx3gn8p3ryfdert8mhpu4u4up49sc9ru/minichess", for links

Value

"/r/g1um2pwwnx3gn8p3ryfdert8mhpu4u4up49sc9ru/minichess"

NewSoloGame

func(color string, level int) int

NewSoloGame starts a game against the bot. color: "white", "black" or "random". level: 1 (easy) to 3 (hard). If you play black, the bot makes the first move immediately.

Open
OID
0ae888…c23d:16
NewSoloGame details

Inspect func

Challenge

func(opponent string, color string) int

Challenge creates a two-player game. opponent may be empty (anyone can accept) or a g1... address (only they can accept). color is the challenger's side: "white", "black" or "random".

Open
OID
0ae888…c23d:17
Challenge details

Inspect func

AcceptChallenge

func(gameID int)

AcceptChallenge takes the open seat in a waiting two-player game.

Open
OID
0ae888…c23d:18
AcceptChallenge details

Inspect func

CancelChallenge

func(gameID int)

CancelChallenge withdraws a challenge nobody has accepted yet.

Open
OID
0ae888…c23d:19
CancelChallenge details

Inspect func

Move

func(gameID int, move string) string

Move plays a move, e.g. "e2e4", "e1g1" (castling) or "e7e8q". In a solo game the bot answers in the same transaction. Returns a short summary.

Open
OID
0ae888…c23d:20
Move details

Inspect func

Resign

func(gameID int)

Resign ends the game as a loss for the caller.

Open
OID
0ae888…c23d:21
Resign details

Inspect func

OfferDraw

func(gameID int)

OfferDraw offers a draw in a two-player game. If your opponent has already offered one, this accepts it.

Open
OID
0ae888…c23d:22
OfferDraw details

Inspect func

AcceptDraw

func(gameID int)

AcceptDraw accepts your opponent's pending draw offer.

Open
OID
0ae888…c23d:23
AcceptDraw details

Inspect func

GameFEN

func(gameID int) string

GameFEN returns the current position of a game in FEN notation.

Open
OID
0ae888…c23d:24
GameFEN details

Inspect func

GameStatus

func(gameID int) string

GameStatus returns a one-line status for a game.

Open
OID
0ae888…c23d:25
GameStatus details

Inspect func

LegalMoves

func(gameID int) string

LegalMoves returns the legal moves of a game as a space-separated list.

Open
OID
0ae888…c23d:26
LegalMoves details

Inspect func

newGame

func(mode minichess.Mode, creator .uverse.address) *minichess.Game
Open
OID
0ae888…c23d:27
newGame details

Inspect func

parseColor

func(color string) minichess.Color
Open
OID
0ae888…c23d:28
parseColor details

Inspect func

saveGame

func(g *minichess.Game)
Open
OID
0ae888…c23d:30
saveGame details

Inspect func

getGame

func(id int) (*minichess.Game, bool)
Open
OID
0ae888…c23d:31
getGame details

Inspect func

mustGetGame

func(id int) *minichess.Game
Open
OID
0ae888…c23d:32
mustGetGame details

Inspect func

addPlayerGame

func(a .uverse.address, id int)
Open
OID
0ae888…c23d:33
addPlayerGame details

Inspect func

botMove

func(g *minichess.Game) (string, bool)

botMove lets the bot play if it is its turn in an active solo game.

Open
OID
0ae888…c23d:35
botMove details

Inspect func

listLimit

untyped bigint

Value

(10 <untyped> bigint)

Render

func(path string) string

Render serves the gnoweb pages: "" home: start a game, open challenges, recent games "game/<id>" a board with clickable legal moves "player/<addr>" a player's games "rules" how to enter moves and the draw rules

Open
OID
0ae888…c23d:36
Render details

Inspect func

short

func(a .uverse.address) string
Open
OID
0ae888…c23d:40
short details

Inspect func

playerName

func(g *minichess.Game, a .uverse.address) string
Open
OID
0ae888…c23d:41
playerName details

Inspect func

statusText

func(g *minichess.Game) string
Open
OID
0ae888…c23d:43
statusText details

Inspect func

renderGame

func(g *minichess.Game) string
Open
OID
0ae888…c23d:44
renderGame details

Inspect func

sqPx

untyped bigint

Value

(56 <untyped> bigint)

margin

untyped bigint

Value

(22 <untyped> bigint)

renderBoardSVG

func(g *minichess.Game) string

renderBoardSVG draws the board as an inline SVG image (white at bottom).

Open
OID
0ae888…c23d:48
renderBoardSVG details

Inspect func

renderPlayer

func(a .uverse.address) string
Open
OID
0ae888…c23d:49
renderPlayer details

Inspect func
Mode : type =minichess.Mode
ModeSolo : minichess.Mode =<zero>
ModeTwoPlayer : minichess.Mode =<zero>
State : type =minichess.State
StateWaiting : minichess.State =<zero>
StateActive : minichess.State =<zero>
StateWhiteWon : minichess.State =<zero>
StateBlackWon : minichess.State =<zero>
StateDraw : minichess.State =<zero>
StateCancelled : minichess.State =<zero>
Game : type =minichess.Game
games : *v0.Tree Inspect
openGames : *v0.Tree Inspect
playerGames : *v0.Tree Inspect
nextID : int =11
realmPath : string ="/r/g1um2pwwnx3gn8p3ryfdert8mhpu4u4up49sc9ru/minichess"
init.16 : func() Inspect
NewSoloGame : func(color string, level int) int Inspect
Challenge : func(opponent string, color string) int Inspect
AcceptChallenge : func(gameID int) Inspect
CancelChallenge : func(gameID int) Inspect
Move : func(gameID int, move string) string Inspect
Resign : func(gameID int) Inspect
OfferDraw : func(gameID int) Inspect
AcceptDraw : func(gameID int) Inspect
GameFEN : func(gameID int) string Inspect
GameStatus : func(gameID int) string Inspect
LegalMoves : func(gameID int) string Inspect
newGame : func(mode minichess.Mode, creator .uverse.address) *minichess.Game Inspect
parseColor : func(color string) minichess.Color Inspect
gameKey : func(id int) string Inspect
saveGame : func(g *minichess.Game) Inspect
getGame : func(id int) (*minichess.Game, bool) Inspect
mustGetGame : func(id int) *minichess.Game Inspect
addPlayerGame : func(a .uverse.address, id int) Inspect
touch : func(g *minichess.Game) Inspect
botMove : func(g *minichess.Game) (string, bool) Inspect
listLimit : untyped bigint =(10 <untyped> bigint)
Render : func(path string) string Inspect
short : func(a .uverse.address) string Inspect
playerName : func(g *minichess.Game, a .uverse.address) string Inspect
renderHome : func() string Inspect
statusText : func(g *minichess.Game) string Inspect
renderGame : func(g *minichess.Game) string Inspect
glyphs : [7]string Inspect
sqPx : untyped bigint =(56 <untyped> bigint)
margin : untyped bigint =(22 <untyped> bigint)
renderBoardSVG : func(g *minichess.Game) string Inspect
renderPlayer : func(a .uverse.address) string Inspect
renderRules : func() string Inspect