1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! # 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.
extern crate alloc;
pub use crateError;
pub use crate;
pub use cratePlayer;
pub use crateQi;