Chego implements chessboard state management and legal move generation.
Piece positions are stored as bitboards.
Move generation is implemented using the Magic Bitboards method.
It is assigned to use in the web-servers (for example, justchess.org),
hence it does not provide any GUI or CLI.
To install chego, run go get
:
go get github.com/treepeck/chego
Here is a simple example:
package main
import (
"fmt"
"github.com/treepeck/chego"
)
func main() {
// It is important to call InitAttackTables as close to the program
// start as possible, otherwise the move generation won't work.
chego.InitAttackTables()
g := chego.NewGame()
// Scholar's mate.
g.PushMove(chego.NewMove(chego.SF3, chego.SF2, chego.MoveNormal))
g.PushMove(chego.NewMove(chego.SE5, chego.SE7, chego.MoveNormal))
g.PushMove(chego.NewMove(chego.SG4, chego.SG2, chego.MoveNormal))
g.PushMove(chego.NewMove(chego.SH4, chego.SD8, chego.MoveNormal))
// Prints "Is checkmate: true"
fmt.Printf("Is checkmate: %t\n", g.IsCheckmate())
}
First install the Go compiler version 1.24.1 or newer (see https://go.dev/dl).
Once the compiler is installed, clone this repository:
git clone https://github.com/treepeck/chego
cd chego
To execute the performance test, run this command in the chego folder:
go run ./internal/perft.go -depth {IntValue}
Chego generates 119060324 moves at depth 6 in approximately 6 seconds
on an Intel i7-10750H CPU.
Copyright (c) 2025 Artem Bielikov
This project is available under the Mozilla Public License, v. 2.0.
See the LICENSE file for details.