// If the stronger side's king is in front of the pawn, it's a win
if (wksq < psq && file_of(wksq) == file_of(psq))
// If the stronger side's king is in front of the pawn, it's a win
if (wksq < psq && file_of(wksq) == file_of(psq))
// If the weaker side's king is too far from the pawn and the rook,
// it's a win.
else if ( square_distance(bksq, psq) >= 3 + (pos.side_to_move() == weakSide)
&& square_distance(bksq, rsq) >= 3)
// If the weaker side's king is too far from the pawn and the rook,
// it's a win.
else if ( square_distance(bksq, psq) >= 3 + (pos.side_to_move() == weakSide)
&& square_distance(bksq, rsq) >= 3)
// If the pawn is far advanced and supported by the defending king,
// the position is drawish
// If the pawn is far advanced and supported by the defending king,
// the position is drawish
&& square_distance(bksq, psq) == 1
&& rank_of(wksq) >= RANK_4
&& square_distance(wksq, psq) > 2 + (pos.side_to_move() == strongSide))
&& square_distance(bksq, psq) == 1
&& rank_of(wksq) >= RANK_4
&& square_distance(wksq, psq) > 2 + (pos.side_to_move() == strongSide))
- result = Value(200)
- - Value(square_distance(wksq, psq + DELTA_S) * 8)
- + Value(square_distance(bksq, psq + DELTA_S) * 8)
- + Value(square_distance(psq, queeningSq) * 8);
+ result = Value(200) - 8 * ( square_distance(wksq, psq + DELTA_S)
+ - square_distance(bksq, psq + DELTA_S)
+ - square_distance(psq, queeningSq));