[position] Remove the to_move_factor from symmetric evaluation
Just use material balance.
This commit is contained in:
parent
1ae6d5df48
commit
74c0e4144f
1 changed files with 9 additions and 6 deletions
|
@ -1,17 +1,20 @@
|
||||||
// Eryn Wells <eryn@erynwells.me>
|
// Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
|
use crate::Position;
|
||||||
use chessfriend_board::Board;
|
use chessfriend_board::Board;
|
||||||
use chessfriend_core::{Color, Piece, Shape, score::Score};
|
use chessfriend_core::{Color, Piece, Shape, score::Score};
|
||||||
|
|
||||||
struct Evaluator;
|
struct Evaluator;
|
||||||
|
|
||||||
impl 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 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
|
/// Evaluate a board using the symmetric evaluation algorithm defined by
|
||||||
|
@ -53,10 +56,10 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn starting_position_is_even() {
|
fn starting_position_is_even() {
|
||||||
let board = Board::starting(None);
|
let position = Position::new(Board::starting(None));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Evaluator::evaluate_symmetric_unwrapped(&board, Color::White),
|
Evaluator::evaluate_symmetric_unwrapped(&position, Color::White),
|
||||||
Evaluator::evaluate_symmetric_unwrapped(&board, Color::Black)
|
Evaluator::evaluate_symmetric_unwrapped(&position, Color::Black)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue