Skip to main content

sashite_pin/
state.rs

1//! Piece state: the optional enhancement marker.
2
3/// The state of a piece, encoded by the optional `+` / `-` prefix.
4///
5/// PIN standardizes only the *encoding*; what an enhanced or diminished state
6/// means in play is defined by the rule system (e.g. promotion, double-step
7/// eligibility, check status). The mapping is:
8///
9/// - no prefix → [`State::Normal`] (the baseline),
10/// - `+` prefix → [`State::Enhanced`],
11/// - `-` prefix → [`State::Diminished`].
12///
13/// The total ordering runs along the natural spectrum
14/// `Diminished < Normal < Enhanced`.
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
16#[repr(u8)]
17pub enum State {
18    /// Diminished state, encoded by the `-` prefix.
19    Diminished = 0,
20    /// Baseline state, encoded by the absence of any prefix.
21    #[default]
22    Normal = 1,
23    /// Enhanced state, encoded by the `+` prefix.
24    Enhanced = 2,
25}