This chess engine is a compact chess engine written in Go with two front ends: a local browser UI and a UCI mode for chess GUIs. It uses a bitboard-based engine, iterative deepening alpha-beta search, and built-in perft support for engine validation.
- Go 1.21 project with no third-party runtime dependencies
- Bitboard board representation with incremental make/unmake
- UCI protocol support for external GUI integration
- Built-in web UI served by the engine over HTTP
main.goselectsweborucimodeengine/contains board logic, move generation, evaluation, search, and UCI handlingweb/contains the HTTP server and embedded single-page interface
- Go 1.21 or newer
go build -o chessengine .On Windows the output binary will be chessengine.exe.
Start the browser UI on the default port:
go run . -mode webStart the browser UI on a custom port:
go run . -mode web -port 9090Then open http://localhost:8080 or your chosen port.
Start UCI mode:
go run . -mode uciBuild once, then run the binary:
./chessengine -mode web
./chessengine -mode uciMinimal manual session:
uci
isready
ucinewgame
position startpos
go depth 8
quit
Supported commands in the current implementation include:
uciisreadyucinewgameposition startposposition fen <fen> moves <...>go depth <n>go movetime <ms>go wtime <ms> btime <ms> [winc <ms>] [binc <ms>] [movestogo <n>]stopperft <depth>deval
The web mode exposes:
GET /for the UIGET /api/statefor current board statePOST /api/moveto play a movePOST /api/newgameto start a game with selected color and depthPOST /api/undoto undo the last full move pairGET /api/legalmoves?square=<sq>for square-specific legal moves
The UI lets you:
- play as White or Black
- set engine depth from 1 to 20
- view move list, evaluation, nodes, depth, and NPS
- undo the last move pair and flip the board
This project is licensed under the MIT License. See LICENSE.