Test seems positive, although still running, anyhow this is the patch to apply in case you are interested. More or less it follows your ideas, only implementation is slightly different.mcostalba wrote:Hi Eelco,Eelco de Groot wrote:
Complete evaluate.cpp did not fit so just the passed pawns routine![]()
thanks a lot !
In the mean time I have written something myself that I am testing now, it is along your ideas but code is a bit different. If tests are good I will post the code.
Code: Select all
diff --git a/src/evaluate.cpp b/src/evaluate.cpp
index 9fd4040..c5f5835 100644
--- a/src/evaluate.cpp
+++ b/src/evaluate.cpp
@@ -933,28 +933,31 @@ namespace {
&& (squares_behind(us, s) & pos.rooks_and_queens(them)))
b3 = b2;
- if ((b2 & pos.pieces_of_color(them)) == EmptyBoardBB)
+ // Squares attacked or occupied by enemy pieces
+ b3 |= (b2 & pos.pieces_of_color(them));
+
+ if ((b2 & pos.pieces_of_color_and_type(them, PAWN)) == EmptyBoardBB)
{
- // There are no enemy pieces in the pawn's path! Are any of the
- // squares in the pawn's path attacked by the enemy?
+ // There are no enemy pawns in the pawn's path! Are any of the
+ // squares in the pawn's path attacked or occupied by the enemy?
if (b3 == EmptyBoardBB)
- // No enemy attacks, huge bonus!
+ // No enemy attacks or pieces, huge bonus!
ebonus += Value(tr * (b2 == b4 ? 17 : 15));
else
- // OK, there are enemy attacks. Are those squares which are
- // attacked by the enemy also attacked by us? If yes, big bonus
- // (but smaller than when there are no enemy attacks), if no,
- // somewhat smaller bonus.
+ // OK, there are enemy attacks or pieces (but not pawns). Are those
+ // squares which are attacked by the enemy also attacked by us?
+ // If yes, big bonus (but smaller than when there are no enemy attacks),
+ // if no, somewhat smaller bonus.
ebonus += Value(tr * ((b3 & b4) == b3 ? 13 : 8));
}
else
{
- // There are some enemy pieces in the pawn's path. While this is
+ // There are some enemy pawns in the pawn's path. While this is
// sad, we still assign a moderate bonus if all squares in the path
// which are either occupied by or attacked by enemy pieces are
// also attacked by us.
- if (((b3 | (b2 & pos.pieces_of_color(them))) & ~b4) == EmptyBoardBB)
- ebonus += Value(tr * 6);
+ if ((b3 & b4) == b3)
+ ebonus += Value(tr * 5);
}
// At last, add a small bonus when there are no *friendly* pieces
// in the pawn's path.