]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Fix a small bug in rook pawn evaluation
[stockfish] / src / evaluate.cpp
index 3be9939b7c8d0c89d9ca1225e14c4d912fc4f497..4b98a13c5fc5cfe0f26f0e52798f45db9547882c 100644 (file)
@@ -937,7 +937,7 @@ namespace {
             ebonus += Value(square_distance(theirKingSq, blockSq) * 6 * tr);
 
             // If the pawn is free to advance, increase bonus
-            if (pos.square_is_empty(blockSq))
+            if (tr != 0 && pos.square_is_empty(blockSq))
             {
                 b2 = squares_in_front_of(us, s);
                 b3 = b2 & ei.attacked_by(them);
@@ -1018,8 +1018,8 @@ namespace {
             // value if the other side has a rook or queen.
             if (square_file(s) == FILE_A || square_file(s) == FILE_H)
             {
-                if(   pos.non_pawn_material(them) == KnightValueMidgame // FIXME should be <= ???
-                   && pos.piece_count(them, KNIGHT) == 1)
+                if(   pos.non_pawn_material(them) <= KnightValueMidgame
+                   && pos.piece_count(them, KNIGHT) <= 1)
                     ebonus += ebonus / 4;
                 else if(pos.rooks_and_queens(them))
                     ebonus -= ebonus / 4;