pub enum StateEvaluation<const N: usize> {
Active(f32, [f32; N]),
Terminal(f32),
}Expand description
Represents the evaluation of a game state, usually provided by a heuristic function or a neural network (e.g., in AlphaZero/MuZero architectures).
This enum strictly binds the game’s termination status with its corresponding data, preventing the representation of invalid states (like a terminal state having future policies).
§Note on Score Perspective
The score value provided here (both in Active and Terminal states) must
always be expressed from the perspective of the player who just made the move
that led to this state. This ensures correct backpropagation in alternating-turn games
when using the engine’s score_updater logic.
Variants§
Active(f32, [f32; N])
The game is ongoing. Contains the current board evaluation score and the prior
probabilities (policies) for the next N possible actions.
Terminal(f32)
The game has ended. Contains only the final fixed score (e.g., 1.0 for win, -1.0 for loss).
Implementations§
Trait Implementations§
Source§impl<const N: usize> Clone for StateEvaluation<N>
impl<const N: usize> Clone for StateEvaluation<N>
Source§fn clone(&self) -> StateEvaluation<N>
fn clone(&self) -> StateEvaluation<N>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<const N: usize> Copy for StateEvaluation<N>
Source§impl<const N: usize> Debug for StateEvaluation<N>
impl<const N: usize> Debug for StateEvaluation<N>
Source§impl<const N: usize> PartialEq for StateEvaluation<N>
impl<const N: usize> PartialEq for StateEvaluation<N>
Source§fn eq(&self, other: &StateEvaluation<N>) -> bool
fn eq(&self, other: &StateEvaluation<N>) -> bool
self and other values to be equal, and is used by ==.