Crates.io | haitaka |
lib.rs | haitaka |
version | |
source | src |
created_at | 2025-04-05 04:38:40.065054+00 |
updated_at | 2025-05-07 18:28:26.90432+00 |
description | Rust Shogi move generation library |
homepage | https://github.com/tofutofu/haitaka |
repository | https://github.com/tofutofu/haitaka |
max_upload_size | |
id | 1621524 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
haitaka
is a Shogi move generation library written in Rust that aims to support fast move generation.
It is inspired by the beautifully designed cozy-chess
library written by analog-hors
.
The layout of the modules and the overall design is largely the same as in cozy-chess
. Many low-level functions were copied from cozy-chess
, with only trivial modifications, but since there are significant differences between Shogi and International Chess, I also modified some of the higher-level functions and added extra functionality.
"Haitaka" or "taka" means "sparrowhawk" in Japanese. "Taka" is a haiku kigo (season word) associated with winter.
鷹の眼にこぼれて雁のたち騒ぐ
Taka no me ni koborete kari no tachisawagu
Escaping the hawk's eye,
the wild geese
rise in tumult.
-— 加賀千代女 (Kaga no Chiyojo)
no_std
compatiblecozy-chess
BitBoard
uses u128
instead of u64
as backing to handle the 9x9 Shogi boardstd
: Enable features that require std
. Currently only used for the Error
trait.Add haitaka
to your Cargo.toml
:
[dependencies]
haitaka = "0.2.1" # or use the latest version on crates.io
use haitaka::*;
// Start position
let board = Board::startpos();
let mut move_list = Vec::new();
board.generate_moves(|moves| {
// Unpack into move list
move_list.extend(moves);
false
});
assert_eq!(move_list.len(), 30);
cargo run --release --example perft -- 5
This code has been tested on an Apple M2, using the stable-aarch64-apple-darwin toolchain. In GitHub workflows it has also been tested on Ubuntu.
The code has not yet been used in a Shogi engine, so should still be seen as experimental.
To run all tests use:
cargo test
Contributions are very welcome! Please open an issue or submit a pull request on GitHub.
Portions of this library are derived from the cozy-chess
project by analog-hors
. The cozy-chess
project is licensed under the MIT license, and its license text is included in this repository under third_party/cozy-chess/LICENSE
.