[position] Remove the to_move_factor from symmetric evaluation

Just use material balance.
This commit is contained in:
Eryn Wells 2025-06-24 20:04:41 -07:00
parent 1ae6d5df48
commit 74c0e4144f

View file

@ -1,17 +1,20 @@
// Eryn Wells <eryn@erynwells.me>
use crate::Position;
use chessfriend_board::Board;
use chessfriend_core::{Color, Piece, Shape, score::Score};
struct Evaluator;
impl Evaluator {
pub fn evaluate_symmetric_unwrapped(board: &Board, color: Color) -> Score {
pub fn evaluate_symmetric_unwrapped(position: &Position, color: Color) -> Score {
let board = &position.board;
let material_balance = Self::material_balance(board, color);
let to_move_factor = color.score_factor();
let score = material_balance;
to_move_factor * material_balance
score
}
/// Evaluate a board using the symmetric evaluation algorithm defined by
@ -53,10 +56,10 @@ mod tests {
#[test]
fn starting_position_is_even() {
let board = Board::starting(None);
let position = Position::new(Board::starting(None));
assert_eq!(
Evaluator::evaluate_symmetric_unwrapped(&board, Color::White),
Evaluator::evaluate_symmetric_unwrapped(&board, Color::Black)
Evaluator::evaluate_symmetric_unwrapped(&position, Color::White),
Evaluator::evaluate_symmetric_unwrapped(&position, Color::Black)
);
}
}