sashite-qi 0.1.0

Qi: an immutable, format-agnostic position model for two-player board games (chess, shogi, xiangqi, and beyond).
Documentation
//! # Qi — a position model for two-player board games
//!
//! `Qi` is an immutable, format-agnostic model of a board-game **position** as
//! defined by the [Sashité Game Protocol](https://sashite.dev/game-protocol/).
//! A position encodes exactly four things: a **board** of squares, two **hands**
//! of off-board pieces, a **style** per player, and the **turn**.
//!
//! ## Generic over pieces and styles
//!
//! Pieces and styles are type parameters, so `Qi` is independent of any
//! notation: the caller chooses how a piece and a style are represented (a typed
//! identifier, an interned id, a string, …). The Sashité notation crates plug in
//! their own token types; nothing here depends on them.
//!
//! ## Immutable, move-based transformations
//!
//! Transformations consume the position and return a new one, so they chain like
//! the protocol's value semantics while *moving* — not cloning — the underlying
//! storage. Clone a position explicitly to keep a snapshot.
//!
//! ## Bounded by construction
//!
//! Every board is bounded — at most [`MAX_DIMENSIONS`] dimensions, each at most
//! [`MAX_DIMENSION_SIZE`], at most [`MAX_SQUARE_COUNT`] squares — and the piece
//! count can never exceed the square count. These invariants are checked when a
//! position is built or transformed, so a `Qi` is safe to construct from
//! untrusted input.
//!
//! ## Guarantees
//!
//! - **`no_std`.** The crate links only `core` and `alloc`.
//! - **No `unsafe`.** Built under a forbid-`unsafe` lint policy.
//! - **No required dependencies.** `serde` is an optional, off-by-default add-on.

#![no_std]

extern crate alloc;

mod error;
mod limits;
mod player;
mod qi;

#[cfg(feature = "serde")]
mod serde_impl;

pub use crate::error::Error;
pub use crate::limits::{MAX_DIMENSIONS, MAX_DIMENSION_SIZE, MAX_SQUARE_COUNT};
pub use crate::player::Player;
pub use crate::qi::Qi;