bedard/hexchess

2.4.0 2025-08-18 04:49 UTC

README

Build Coverage Crates.io NPM Packagist Bundlephobia License

A cross-language library for GliƄski's hexagonal chess, and the brain of hexchess.club.

Libraries

Game libraries are available in Rust, PHP, and TypeScript / JavaScript. These libraries have similar APIs and abilities, but are designed for different purposes.

For game logic, use the PHP or TypeScript / JavaScript libraries. They use a position-centric game state, and are not optimized for performance. In other words, the board is stored as a flat array of values, which provides better ergonomics for gameplay and rendering.

For engines, use the Rust crate. It uses bitboards, and is optimized for performance. Fast board queries can be performed using u128 bitmasks.

Versioning

Each library is tested against a shared test suite, and are versioned together with respect to these tests. Because of this, if a change is made in one library, it will cause the version numbers for all libraries to increment.

Put simply, the libraries are versioned together to to ensure they support the same test suite, and are compatible with one another.

Local development

Depending on which library you're working on, you'll need to install a few dependencies.

First, clone the repository, and setup the CLI.

git clone git@github.com:scottbedard/hexchess.git

cd hexchess

pnpm install

Next run node hexchess to see the following commands.

Usage: hexchess [options] [command]

Options:
  -h, --help                   display help for command

Commands:
  build                        Build all projects
  build:js                     Build NPM package
  build:rs                     Build Rust crate
  lint:php                     Run linting
  release [options] [version]  Set the version of the project
  test                         Run all tests
  test:js [options]            Run JavaScript tests
  test:php [options]           Run PHP tests
  test:rs [options]            Run Rust tests
  versions [options]           Check the versions of the dependencies
  help [command]               display help for command

License

MIT

Copyright (c) 2024-present, Scott Bedard