aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/board/engine.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs
index a4b72eb..06369f5 100644
--- a/src/board/engine.rs
+++ b/src/board/engine.rs
@@ -88,8 +88,30 @@ impl Board {
} else {
-1.
};
- let multiplier = piece_type.static_eval();
- eval += sign * multiplier * pop_count(*bitboard) as f32;
+
+ eval += sign * match piece_type {
+ PieceType::Pawn => {
+ serialize_bitboard(*bitboard).iter().fold(0., |acc, square| {
+ acc + match (*square).rank() {
+ 6 => 3.,
+ 5 => 2.,
+ _ => 1.,
+ }
+ })
+ }
+ PieceType::PawnBlack => {
+ serialize_bitboard(*bitboard).iter().fold(0., |acc, square| {
+ acc + match (*square).rank() {
+ 1 => 3.,
+ 2 => 2.,
+ _ => 1.,
+ }
+ })
+ }
+ _ => {
+ piece_type.static_eval() * pop_count(*bitboard) as f32
+ }
+ };
}
eval
}