Skip to content

Commit 2dee851

Browse files
committed
fix: several evel terms
1 parent 86554d1 commit 2dee851

File tree

2 files changed

+26
-32
lines changed

2 files changed

+26
-32
lines changed

src/eval.cpp

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,15 @@ class Evaluator {
150150
total += OUTPOST_BONUS[PT == Bishop][supported];
151151
}
152152

153-
if (PT == Bishop) {
154-
// Penalty for having too many pawns on the same color
155-
// square as the bishop
156-
Bitboard pawns = pos.pieces(TYPE_PAWN, C);
157-
int counter = 0;
158-
while (pawns) { counter += Square::same_color(Square(pawns.pop()), sq); }
159-
total -= BISHOP_PAWN_PENALTY * counter;
160-
}
153+
// todo this hurts performance too
154+
// if (PT == Bishop) {
155+
// // Penalty for having too many pawns on the same color
156+
// // square as the bishop
157+
// Bitboard pawns = pos.pieces(TYPE_PAWN, C);
158+
// int counter = 0;
159+
// while (pawns) { counter += Square::same_color(Square(pawns.pop()), sq); }
160+
// total -= BISHOP_PAWN_PENALTY * counter;
161+
// }
161162
}
162163

163164
if (PT == Rook) {
@@ -170,17 +171,22 @@ class Evaluator {
170171
total += OPEN_ROOK_BONUS[0];
171172
}
172173
}
173-
// Penalty for being trapped by the king, and even more
174-
// if the king cannot castle
175-
if (attackMap.count() <= 3) {
176-
chess::File f = sq.file();
177-
chess::File kingFile = pos.kingSq(C).file();
178-
if ((f > chess::File::FILE_E && kingFile >= chess::File::FILE_E) ||
179-
(f < chess::File::FILE_D && kingFile <= chess::File::FILE_D)) {
180-
total -= TRAPPED_ROOK_PENALTY;
181-
if (!pos.castlingRights().has(C)) { total -= TRAPPED_ROOK_PENALTY; }
182-
}
183-
}
174+
// todo this drags down performance, investigate some time
175+
// // Penalty for being trapped by the king, and even more
176+
// // if the king cannot castle
177+
// if (attackMap.count() <= 3) {
178+
// chess::File f = sq.file();
179+
// chess::File kingFile = pos.kingSq(C).file();
180+
// if ((f > chess::File::FILE_E && kingFile >= chess::File::FILE_E) ||
181+
// (f < chess::File::FILE_D && kingFile <= chess::File::FILE_D)) {
182+
// total -= TRAPPED_ROOK_PENALTY;
183+
// if (!pos.castlingRights().has(C)) { total -= TRAPPED_ROOK_PENALTY; }
184+
// }
185+
// }
186+
}
187+
if (PT == Queen) {
188+
Bitboard potentialPinners = pos.pieces(TYPE_ROOK, _C) | pos.pieces(TYPE_BISHOP, _C);
189+
if ((bool) (attackMap & potentialPinners)) { total -= WEAK_QUEEN_PENALTY; }
184190
}
185191
}
186192

@@ -299,15 +305,3 @@ class Evaluator {
299305
Value evaluate(Position& pos) {
300306
return Evaluator(pos)();
301307
}
302-
303-
/**
304-
* info depth 2 score cp 25 nodes 118 seldepth 2 time 3 pv g1f3
305-
info depth 3 score cp 85 nodes 660 seldepth 4 time 7 pv g1f3
306-
info depth 4 score cp 36 nodes 1802 seldepth 5 time 14 pv g1f3
307-
info depth 5 score cp 86 nodes 2671 seldepth 11 time 21 pv d2d4
308-
info depth 5 score cp 90 nodes 8213 seldepth 11 time 38 pv d2d4
309-
info depth 6 score cp 55 nodes 17236 seldepth 15 time 57 pv d2d4
310-
info depth 7 score cp 65 nodes 55653 seldepth 16 time 130 pv d2d4
311-
info depth 8 score cp 57 nodes 145371 seldepth 17 time 271 pv d2d4
312-
info depth 9 score cp 70 nodes 347627 seldepth 18 time 613 pv d2d4
313-
*/

src/evalconstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ constexpr S MINOR_KING_PROTECTOR = S(3, 4);
119119
constexpr S WEAK_QUEEN_PENALTY = S(27, 5);
120120
constexpr S TRAPPED_ROOK_PENALTY = S(30, 2);
121121
constexpr S OPEN_ROOK_BONUS[2] = {S( 9, 4), S( 22, 10)};
122-
constexpr S BISHOP_PAWN_PENALTY = S( 3, 10);
122+
constexpr S BISHOP_PAWN_PENALTY = S( 2, 10);
123123

124124
constexpr S PASSED_PAWN_BONUS[] = {
125125
S( 0, 0),S(148,130),S( 84, 88),S( 31, 36),S( 8, 20),S( 5, 16),S( 0, 8),S( 0, 0)

0 commit comments

Comments
 (0)