# atomic-movegen
A Rust library for legal move generation in [atomic chess](https://en.wikipedia.org/wiki/Atomic_chess).
## Features
- Legal move generation (pseudo-legal + legality filtering)
- FEN parsing and output
- Perft (performance test) recursion
- Blast-on-capture, COMMONER pseudo-royalty, pawn blast immunity
## Usage (library)
```rust
use atomic_movegen::board::Board;
use atomic_movegen::perft;
let mut board = Board::new();
let nodes = perft(&mut board, 3);
assert_eq!(nodes, 8902);
```
## Usage (CLI perft)
```sh
cargo run --example perft "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" 4
```
Output: `197326`
## Verify against known perft values
The repository ships with 41 test positions and their expected node counts at
depths 1–6 in [`perft_values.md`](./perft_values.md). Use the
`verify_perft` example to run all of them:
```sh
# Quick check at depth 3 (~5 s)
cargo run --example verify_perft 3
# Full verification at depth 6 — use --release for acceptable runtime
cargo run --example verify_perft --release
```
The tool exits with status 0 if every position matches, or 1 on any mismatch.
Depth 6 traverses billions of nodes; the `--release` flag is essential for a
timely result at that depth.
## License
MIT