bitstackchess 0.1.1

A bitboard‐based chess game engine with 10 × u128 move history
Documentation
// src/engine/evaluator.rs

//! Evaluator: separate interface for any static or dynamic position evaluation logic.
//! Keeps evaluation concerns out of GameCore or MoveGenerator.

use crate::board::PieceMapping;
use crate::core::MovePlanes;
use crate::rules::checkmate::Color;

/// A simple trait for evaluating a given board position for a side.
/// Returns a signed integer (“score”) where positive favors White, negative favors Black.
pub trait Evaluator {
    /// Given a piece mapping, occupancy bitboard, side to move, move-planes, and ply count,
    /// return an integer score. Higher = White advantage, lower = Black advantage.
    fn evaluate(
        mapping: &PieceMapping,
        occupied: u64,
        side_to_move: Color,
        planes: &MovePlanes,
        ply: usize,
    ) -> i32;
}

/// A trivial “material‐only” evaluator, to be extended in future.
pub struct MaterialEval;

impl Evaluator for MaterialEval {
    fn evaluate(
        mapping: &PieceMapping,
        _occupied: u64,
        _side_to_move: Color,
        _planes: &MovePlanes,
        _ply: usize,
    ) -> i32 {
        // TODO: implement a real material‐count heuristic.
        // Placeholder returns 0 (i.e. “equal”) for all positions.
        0
    }
}