Change condition to use relative rank
[stockfish] / src / evaluate.cpp
index 340a342fc62f0148bdcd2b108d309ba8545bbb9c..c7fec9131e11ceeef0b1499c92b2ea1c012c0d83 100644 (file)
@@ -818,7 +818,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
             ebonus -= Value(square_distance(pos.king_square(Us), blockSq) * 2 * rr);
 
             // If blockSq is not the queening square then consider also a second push
-            if (rank_of(blockSq) != (Us == WHITE ? RANK_8 : RANK_1))
+            if (relative_rank(Us, blockSq) != RANK_8)
                 ebonus -= Value(square_distance(pos.king_square(Us), blockSq + pawn_push(Us)) * rr);
 
             // If the pawn is free to advance, increase bonus