Osipov Jury wrote:Perhaps the best realization of this issue (from one very strong engine):
stage = majors * 2 + minors;
phase = ((double)stage) / 24.0;
SideToMoveBonus = (int)((1.0 - phase) * 0.0 + phase * 9.0);
I leave it to the moderators if this can be discussed.
My attempt at a contribution:
♦ First, if this is from Rybka, apparently if I read this code right, for Rybka the SideToMoveBonus goes
down towards the endgame, not up. In Crafty it is the opposite?
♦ Second, it is strange to see such a coarse resolution of phase in Rybka. Maybe this is only done for the SideToMoveBonus? I don't see why Vas would have to do that, unless it is done to smoothen the bonus over the phase of the game and this is somehow important. But at an exchange of pieces you have a major discontinuity anyhow, there is nothing you can do about it, I don't see a jump in the side to move bonus is going to make that any worse and why you would not use a more detailed calculation of phase.
♦ Mr. Rajlich, once more you seem to be underestimating the potential material value of the Bishop Pair. Of course this is never going to work
Now I know that for Rybka that involves at least three additions, the dark-squared bishop, the light squared bishop and the bishop pair material values but this is critical stuff Mr. Rajlich
In Ancalagon I don't have different material values for the dark squared bishop and the light squared bishop, but I have tried to include the value of the Bishop Pair in Tord's calculation of the game phase. It is not perfect because there can be potential conflicts in other places where it is assumed the phase only calculates the midgame material values. But so far I did not spot a major conflict in the rest of Glaurung's code or that of Stockfish when I do this. I don't think Glaurung or Stockfish scale their SideToMoveBonus yet.
This is new Ancalagon code with 'minor' changes from Glaurung:
Code: Select all
/// Position::compute_non_pawn_material() computes the total non-pawn middle
/// game material score for the given side. Material scores are updated
/// incrementally during the search, this function is only used while
/// initializing a new Position object.
Value Position::compute_non_pawn_material(Color c) const {
Value result = Value(0);
for (PieceType pt = KNIGHT; pt <= QUEEN; pt++)
{
Bitboard b = pieces_of_color_and_type(c, pt);
int Bishopcount = 0;
while (b)
{
assert(piece_on(first_1(b)) == piece_of_color_and_type(c, pt));
pop_1st_bit(&b);
result += piece_value_midgame(pt);
if (pt == BISHOP) Bishopcount++;
}
if (Bishopcount >= 2) result += Value(100);
}
return result;
}
Eelco