Mode
typeMode 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
typeState 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.StateValue
<zero>
StateBlackWon
minichess.StateValue
<zero>
StateDraw
minichess.StateValue
<zero>
StateCancelled
minichess.State// challenge withdrawn before anyone joined
Value
<zero>
Game
typeGame is one game of minichess.
Value
minichess.Game
games
*v0.Tree// padded id -> \*Game
- OID
- 0ae888…c23d:4
games details
openGames
*v0.Tree// padded id -> \*Game, challenges awaiting an opponent
- OID
- 0ae888…c23d:7
openGames details
playerGames
*v0.Tree// address -> \[]int
- OID
- 0ae888…c23d:10
playerGames details
nextID
intValue
11
realmPath
string// e.g. "/r/g1um2pwwnx3gn8p3ryfdert8mhpu4u4up49sc9ru/minichess", for links
Value
"/r/g1um2pwwnx3gn8p3ryfdert8mhpu4u4up49sc9ru/minichess"
init.16
func()- OID
- 0ae888…c23d:14
init.16 details
NewSoloGame
func(color string, level int) intNewSoloGame 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.
- OID
- 0ae888…c23d:16
NewSoloGame details
Challenge
func(opponent string, color string) intChallenge 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".
- OID
- 0ae888…c23d:17
Challenge details
AcceptChallenge
func(gameID int)AcceptChallenge takes the open seat in a waiting two-player game.
- OID
- 0ae888…c23d:18
AcceptChallenge details
CancelChallenge
func(gameID int)CancelChallenge withdraws a challenge nobody has accepted yet.
- OID
- 0ae888…c23d:19
CancelChallenge details
Move
func(gameID int, move string) stringMove 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.
- OID
- 0ae888…c23d:20
Move details
Resign
func(gameID int)Resign ends the game as a loss for the caller.
- OID
- 0ae888…c23d:21
Resign details
OfferDraw
func(gameID int)OfferDraw offers a draw in a two-player game. If your opponent has already offered one, this accepts it.
- OID
- 0ae888…c23d:22
OfferDraw details
AcceptDraw
func(gameID int)AcceptDraw accepts your opponent's pending draw offer.
- OID
- 0ae888…c23d:23
AcceptDraw details
GameFEN
func(gameID int) stringGameFEN returns the current position of a game in FEN notation.
- OID
- 0ae888…c23d:24
GameFEN details
GameStatus
func(gameID int) stringGameStatus returns a one-line status for a game.
- OID
- 0ae888…c23d:25
GameStatus details
LegalMoves
func(gameID int) stringLegalMoves returns the legal moves of a game as a space-separated list.
- OID
- 0ae888…c23d:26
LegalMoves details
newGame
func(mode minichess.Mode, creator .uverse.address) *minichess.Game- OID
- 0ae888…c23d:27
newGame details
parseColor
func(color string) minichess.Color- OID
- 0ae888…c23d:28
parseColor details
gameKey
func(id int) string- OID
- 0ae888…c23d:29
gameKey details
saveGame
func(g *minichess.Game)- OID
- 0ae888…c23d:30
saveGame details
getGame
func(id int) (*minichess.Game, bool)- OID
- 0ae888…c23d:31
getGame details
mustGetGame
func(id int) *minichess.Game- OID
- 0ae888…c23d:32
mustGetGame details
addPlayerGame
func(a .uverse.address, id int)- OID
- 0ae888…c23d:33
addPlayerGame details
touch
func(g *minichess.Game)- OID
- 0ae888…c23d:34
touch details
botMove
func(g *minichess.Game) (string, bool)botMove lets the bot play if it is its turn in an active solo game.
- OID
- 0ae888…c23d:35
botMove details
listLimit
untyped bigintValue
(10 <untyped> bigint)
Render
func(path string) stringRender 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
- OID
- 0ae888…c23d:36
Render details
actionLink
func(label string, fn string, args []string) stringactionLink builds a gnoweb link that opens a prefilled call form.
- OID
- 0ae888…c23d:38
actionLink details
gameLink
func(id int) string- OID
- 0ae888…c23d:39
gameLink details
short
func(a .uverse.address) string- OID
- 0ae888…c23d:40
short details
playerName
func(g *minichess.Game, a .uverse.address) string- OID
- 0ae888…c23d:41
playerName details
renderHome
func() string- OID
- 0ae888…c23d:42
renderHome details
statusText
func(g *minichess.Game) string- OID
- 0ae888…c23d:43
statusText details
renderGame
func(g *minichess.Game) string- OID
- 0ae888…c23d:44
renderGame details
glyphs
[7]string- OID
- 0ae888…c23d:46
glyphs details
renderMoveLinks
func(g *minichess.Game) stringrenderMoveLinks lists legal moves grouped by the piece that moves.
- OID
- 0ae888…c23d:47
renderMoveLinks details
sqPx
untyped bigintValue
(56 <untyped> bigint)
margin
untyped bigintValue
(22 <untyped> bigint)
renderBoardSVG
func(g *minichess.Game) stringrenderBoardSVG draws the board as an inline SVG image (white at bottom).
- OID
- 0ae888…c23d:48
renderBoardSVG details
renderPlayer
func(a .uverse.address) string- OID
- 0ae888…c23d:49
renderPlayer details
renderRules
func() string- OID
- 0ae888…c23d:50