Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,41 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

## [1.6.0] - 2026-10-21

`moved_piece_before` と `moved_piece_before_move`、通常の着手結果 `MoveApplyFacts`、
`clone_for_search`、反復判定、容量確保 API は引き続き提供する。
二歩の照会 `has_pawn_on_file` と利きの primitive `rook_rank_attacks` も維持する。

### Deprecated

- 探索用のキー予測、着手前メタデータ、探索スタック用の型、予約領域専用の着手、
履歴保持上限の設定と、未使用の補助 API を非推奨にした。
すべて 1.x 中は従来のシグネチャと動作を維持し、2.0.0 で削除予定とする。
対象と移行方法は [1.6.0 の移行ガイド](docs/book/src/getting-started/migration-1.6.md) を参照する。

### Performance

- `Position::clone()` の履歴チャンクの複製方法を改善した。
全履歴の独立した所有権と、事前確保済みの容量を維持する。
- `Position::clone_from()` が複製先の履歴領域を再利用する。
全履歴と複製元の予約容量を維持し、複製先に余る領域は保持する。
同じ保存先へ局面を繰り返し複製する場合に利用できる。
- `Position::clone_for_search()` が根履歴の board key 索引を準備する。
一致候補がない場合だけ根以前の千日手走査を省き、一致候補がある場合は従来の詳細判定を行う。
連続王手と持ち駒の優劣を含む判定の意味は変えない。
索引構築と照会には費用があり、すべての局面で高速化するものではない。
- `rook_rank_attacks()` を専用実装から `rook_attacks()` と段マスクの合成に変更した。
戻り値は維持するが、従来実装との速度の同等性は保証しない。

### Maintenance

- bindings 内部の未使用 getter 3 件と開発用依存 `shogi_core` を削除した。
- 計測、配置実験、外部データ照合用の example は source と再現手順を維持し、crates.io 配布から除外した。
`sfen_roundtrip` は配布に含める。
- Python の配布物から `__pycache__` と `.pyc` を除外した。
- 探索連携の文書を `MoveApplyFacts` と `current_state_cache()` の実装に合わせて修正した。

## [1.5.1] - 2026-10-19

### Fixed
Expand Down Expand Up @@ -619,7 +654,8 @@ identical to 1.0.0.

- The standard and AVX2 Python distributions are mutually exclusive because both provide the same import package.

[Unreleased]: https://github.com/nyoki-mtl/rsshogi/compare/v1.5.1...HEAD
[Unreleased]: https://github.com/nyoki-mtl/rsshogi/compare/v1.6.0...HEAD
[1.6.0]: https://github.com/nyoki-mtl/rsshogi/compare/v1.5.1...v1.6.0
[1.5.1]: https://github.com/nyoki-mtl/rsshogi/compare/v1.5.0...v1.5.1
[1.5.0]: https://github.com/nyoki-mtl/rsshogi/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/nyoki-mtl/rsshogi/compare/v1.3.1...v1.4.0
Expand Down
11 changes: 2 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# rsshogi

この文書は rsshogi 1.5.1 を対象とする。
Native Book は独立圧縮ブロックを持つ wire version 4 を使用する。
旧定跡 API の削除を含むため、更新時は移行手順を確認する。

[![crates.io](https://img.shields.io/crates/v/rsshogi?style=flat-square&logo=rust&logoColor=white)](https://crates.io/crates/rsshogi) [![docs.rs](https://img.shields.io/docsrs/rsshogi?style=flat-square&logo=rust&logoColor=white)](https://docs.rs/rsshogi) [![Documentation](https://img.shields.io/badge/docs-mdBook-1f6feb?style=flat-square&logo=readthedocs&logoColor=white)](https://nyoki-mtl.github.io/rsshogi/) [![PyPI](https://img.shields.io/pypi/v/rsshogi?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/rsshogi/) [![Python](https://img.shields.io/pypi/pyversions/rsshogi?style=flat-square&logo=python&logoColor=white)](https://nyoki-mtl.github.io/rsshogi/getting-started/installation.html) [![MIT License](https://img.shields.io/badge/license-MIT-blue?style=flat-square&logo=opensourceinitiative&logoColor=white)](https://github.com/nyoki-mtl/rsshogi/blob/main/LICENSE)

`rsshogi` は、将棋局面の表現、合法手生成、1 手詰め判定、棋譜や定跡の入出力、深層学習データの操作を行う MIT ライセンスの Rust ライブラリおよび Python パッケージである。
Expand All @@ -16,19 +12,22 @@ Native Book は独立圧縮ブロックを持つ wire version 4 を使用する

```toml
[dependencies]
rsshogi = "1.5.1"
rsshogi = "1.6.0"
```

デフォルトでは探索エンジン向けの最小コア(`board`、`mate`、`types`、`movegen`)のみが有効になる。
棋譜(`records`)、定跡(`book`)、Policy ラベル(`policy-labels`)、256-bit 局面圧縮(`position-serialization`)、SVG 出力(`svg`)、局面検証(`validation`)、128-bit Zobrist ハッシュ(`hash-128`)は Cargo の `features` で選択できる。

```toml
[dependencies]
rsshogi = { version = "1.5.1", features = ["records", "book"] }
rsshogi = { version = "1.6.0", features = ["records", "book"] }
```

各 Feature の詳細は [rsshogi マニュアルの全体アーキテクチャ](https://nyoki-mtl.github.io/rsshogi/architecture.html) および [docs.rs の Feature flags](https://docs.rs/crate/rsshogi/latest/features) を参照。

1.6.0 は公開済み API の互換性を維持する。
非推奨 API は 2.0.0 で削除予定であり、対象と移行方法は [移行ガイド](docs/book/src/getting-started/migration-1.6.md) を参照。

### Python

Python 3.10 以降で利用できる。
Expand Down Expand Up @@ -79,10 +78,6 @@ print(board.to_sfen())
- **[Rust API リファレンス(docs.rs)](https://docs.rs/rsshogi)**:Rust クレートの全公開型と関数の仕様。
- **[CHANGELOG](CHANGELOG.md)**:バージョンごとの変更履歴。

## 利用例

- [rsshogi-nnue-mini](https://github.com/nyoki-mtl/rsshogi-nnue-mini):`rsshogi` を基盤とした USI 将棋エンジンの実装例。

## ライセンス

MIT
2 changes: 1 addition & 1 deletion crates/rsshogi-py/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rsshogi-py"
version = "1.5.1"
version = "1.6.0"
edition = "2024"
publish = false
license = "MIT"
Expand Down
2 changes: 0 additions & 2 deletions crates/rsshogi-py/README-avx2.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# rsshogi-avx2

Native Book は独立圧縮ブロックを持つ wire version 4 を使用する。

`rsshogi-avx2` は、AVX2 対応 x86_64 CPU 向けに最適化した `rsshogi` パッケージです。
import 名は標準版と同じ `rsshogi` で、公開 API は共通です。

Expand Down
2 changes: 0 additions & 2 deletions crates/rsshogi-py/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# rsshogi Python パッケージ

Native Book は独立圧縮ブロックを持つ wire version 4 を使用する。

`rsshogi` は、将棋局面の操作、合法手生成、1 手詰め判定、棋譜や定跡の入出力、深層学習データの操作を提供する Python パッケージである。
Rust コアライブラリ `rsshogi` の PyO3 バインディングとして実装されている。

Expand Down
4 changes: 2 additions & 2 deletions crates/rsshogi-py/pyproject-avx2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "rsshogi-avx2"
version = "1.5.1"
version = "1.6.0"
description = "Python bindings for the rsshogi core library (AVX2 build)."
readme = "README-avx2.md"
requires-python = ">=3.10"
Expand All @@ -25,4 +25,4 @@ module-name = "rsshogi._rsshogi"
python-source = "python"
manifest-path = "Cargo.toml"
rustc-args = ["-C", "target-feature=+avx2"]
exclude = ["python/rsshogi/*.pyd", "python/rsshogi/*.so"]
exclude = ["python/rsshogi/*.pyd", "python/rsshogi/*.so", "**/__pycache__/**", "**/*.pyc"]
4 changes: 2 additions & 2 deletions crates/rsshogi-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "rsshogi"
version = "1.5.1"
version = "1.6.0"
description = "Python tools for shogi board handling, move legality, records, and training-data formats."
readme = "README.md"
requires-python = ">=3.10"
Expand All @@ -23,4 +23,4 @@ urls = { "Repository" = "https://github.com/nyoki-mtl/rsshogi" }
[tool.maturin]
module-name = "rsshogi._rsshogi"
python-source = "python"
exclude = ["python/rsshogi/*.pyd", "python/rsshogi/*.so"]
exclude = ["python/rsshogi/*.pyd", "python/rsshogi/*.so", "**/__pycache__/**", "**/*.pyc"]
2 changes: 1 addition & 1 deletion crates/rsshogi-py/python/rsshogi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from . import book, core, initial_positions, numpy, policy, record, sazpack, svg, types, usi

# Version
__version__ = "1.5.1"
__version__ = "1.6.0"

__all__ = [
# Submodules
Expand Down
5 changes: 0 additions & 5 deletions crates/rsshogi-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,6 @@ impl PyMove {
pub(crate) fn from_move(inner: Move) -> Self {
Self { inner }
}

#[allow(dead_code)]
pub(crate) fn inner(&self) -> Move {
self.inner
}
}

#[pyclass(from_py_object, name = "AperyMove")]
Expand Down
10 changes: 0 additions & 10 deletions crates/rsshogi-py/src/python_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,20 +863,10 @@ impl PyMoveType {
pub(crate) fn from_move_type(inner: MoveType) -> Self {
Self { inner }
}

#[allow(dead_code)]
pub(crate) fn inner(&self) -> MoveType {
self.inner
}
}

impl PyRepetitionState {
pub(crate) fn from_state(inner: RepetitionState) -> Self {
Self { inner }
}

#[allow(dead_code)]
pub(crate) fn inner(&self) -> RepetitionState {
self.inner
}
}
2 changes: 1 addition & 1 deletion crates/rsshogi-py/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions crates/rsshogi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
[package]
name = "rsshogi"
version = "1.5.1"
version = "1.6.0"
edition = "2024"
rust-version = "1.95"
license = "MIT"
description = "Reusable Rust shogi primitives for board state, move generation, legality, and record parsing."
repository = "https://github.com/nyoki-mtl/rsshogi"
keywords = ["shogi"]
categories = ["games"]
exclude = ["src/bin/**"]
exclude = [
"src/bin/**",
"examples/native_book_layout_probe.rs",
"examples/native_book_measure.rs",
"examples/native_book_ybb_verify.rs",
"examples/sazpack_measure.rs",
"examples/sbinpack_size_breakdown.rs",
"examples/sbk_open_measure.rs",
]

# We intend to publish only this crate to crates.io (B案).
# Python bindings are provided separately via crates/rsshogi-py.
# crates.io には本クレートを公開し、Python bindings は別パッケージで配布する。
publish = true

[dependencies]
thiserror = "2"
log = "0.4"
# data-only crates: records feature 専用(非 data 利用ゼロを grep 確認済み)。
# optional 化して `records` の dep: でのみ引くことで、エンジンビルド(data 系 off)では
# これらの crate を一切コンパイルしない(task 0421 / Decision 4 の compile 削減の要)。
# 棋譜処理用の依存は、records feature を有効にした場合だけコンパイルする。
encoding_rs = { version = "0.8", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
Expand All @@ -30,11 +35,9 @@ zstd = { version = "0.13", optional = true, default-features = false }
default = []
hash-128 = []

# ─── Data ecosystem features (task 0421 / Decision 4: Option B-split) ───
# エンジン consumer(nnue/dfpn/az)は default(data 系 off)でビルドし、
# py が必要分を opt-in する。粒度は consumer の実利用に合わせる。
# 棋譜、定跡、学習データ用の機能は用途に応じて個別に有効化する。

# policy-labels: labels::policy::CompactMoveLabel 等。py + az が使用(az 単独有効化のため独立)。
# policy-labels: labels::policy::CompactMoveLabel 等の Policy ラベル変換。
policy-labels = []

# position-serialization: packed_sfen / huffman_coded_pos / bit_io。records が require。
Expand Down Expand Up @@ -73,7 +76,6 @@ python-data = ["book", "records", "position-serialization", "svg", "validation"]

[dev-dependencies]
criterion = { version = "0.5", default-features = false, features = ["cargo_bench_support"] }
shogi_core = "0.1.5"
proptest = { version = "1.4", default-features = false, features = ["std"] }
# 統合テスト(tests/perft.rs・tests/movegen_integration.rs)が JSON 期待値の
# deserialize で使う。lib の serde は records feature の optional dep だが、テストは
Expand Down
2 changes: 0 additions & 2 deletions crates/rsshogi/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# rsshogi

Native Book は独立圧縮ブロックを持つ wire version 4 を使用する。

`rsshogi` は、将棋局面の操作、合法手生成、1 手詰め判定、棋譜や定跡の入出力を提供する Rust ライブラリである。

```rust
Expand Down
6 changes: 0 additions & 6 deletions crates/rsshogi/benches/apply_undo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,6 @@ fn bench_key_probe(c: &mut Criterion) {
c.bench_function("key_probe", |b| {
b.iter(|| std::hint::black_box(std::hint::black_box(&pos).key()));
});

c.bench_function("key_after_probe", |b| {
let mv = moves[0];
let probe = base.clone();
b.iter(|| std::hint::black_box(std::hint::black_box(&probe).key_after(mv)));
});
}

/// perft を apply / undo の総合指標として測る。
Expand Down
Loading
Loading