cheesse

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 6 Imported by: 0

README

cheesse

Simple package, server, CLI tool and WebAssembly binary for all things chess.

Please note that this library is NOT YET ready for mainstream use. Its API is not final, two of its API methods are not fully implemented, and it hasn't yet been battle-tested against a massive corpus of games (only about 300).

API

DefaultGame() OutputGame
ParseGame(game InputGame) (OutputGame, error)
DoAction(game InputGame, action InputAction) (OutputGame, OutputAction, error)

// Auto-detects the notation: Algebraic (incl. figurine and PGN), Coordinate, Descriptive, ICCF, Smith
ParseNotation(game InputGame, notationString string) (OutputGame, OutputParseResult, error)

// Auto-detects the source notation and re-renders every move in the target notation:
// one of {Algebraic|Figurine|Descriptive|Coordinate|ICCF|Smith}
ConvertNotation(game InputGame, notationString string, targetNotation string) (OutputGame, OutputParseResult, error)

Server example

$ ./cheesse -serve 8080
$ curl localhost:8080/defaultGame | jq .game.board.board
[
  "♜♞♝♛♚♝♞♜",
  "♟♟♟♟♟♟♟♟",
  "        ",
  "        ",
  "        ",
  "        ",
  "♙♙♙♙♙♙♙♙",
  "♖♘♗♕♔♗♘♖"
]

CLI example

$ ./cheesse -defaultGame | jq .game.board.board
[
  "♜♞♝♛♚♝♞♜",
  "♟♟♟♟♟♟♟♟",
  "        ",
  "        ",
  "        ",
  "        ",
  "♙♙♙♙♙♙♙♙",
  "♖♘♗♕♔♗♘♖"
]

Package import example

package main

import (
  "fmt"

  "github.com/marianogappa/cheesse/api"
)

func main() {
	for _, s := range a.DefaultGame().Board.Board {
		fmt.Println(s)
	}
}
♜♞♝♛♚♝♞♜
♟♟♟♟♟♟♟♟
        
        
        
        
♙♙♙♙♙♙♙♙
♖♘♗♕♔♗♘♖

WebAssembly

Build:

$ GOOS=js GOARCH=wasm go build -tags tinygo -o cheesse.wasm .

The binary exposes the full API as synchronous JS globals. Every function takes a Uint8Array containing a JSON request and returns a Uint8Array containing a JSON response (same shapes as the HTTP endpoints; {"error": "..."} on failure):

const enc = new TextEncoder(), dec = new TextDecoder();
const call = (fn, obj) => JSON.parse(dec.decode(fn(enc.encode(JSON.stringify(obj)))));

JSON.parse(dec.decode(cheesseDefaultGame()));
call(cheesseParseGame,       {game: {fenString: "..."}});
call(cheesseDoAction,        {game: {}, action: {fromSquare: "e2", toSquare: "e4"}});
call(cheesseParseNotation,   {game: {}, notationString: "1. e4 e5"});
call(cheesseConvertNotation, {game: {}, notationString: "1. e4 e5", targetNotation: "ICCF"});
call(cheesseAIMove,          {game: {}, mode: "random"}); // random|easy|medium|hard

Auto-play example

Why is it called "cheesse"?

That's roughly how kiwi people pronounce chess.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pgn

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL