Skip to content

treepeck/chego

Repository files navigation

License: MPL 2.0 Go Reference

Chego is a Go module that implements the rules of chess (board representation,
legal move generator, game state management, etc.).

Usage

To use chego in your chess server, run go get:

go get github.com/treepeck/chego

Here is a simple example:

package main

import (
	"fmt"

	"github.com/treepeck/chego"
)

func main() {
	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())
}

License

Copyright (c) 2025-2026 Artem Bielikov

This project is available under the Mozilla Public License, v. 2.0.
See the LICENSE file for details.

More

Releases

No releases published

Packages

 
 
 

Contributors