When I modify the line 264 of material.cpp, I would think that this would only affect the game phase. However it seems that it also affects "PAWN". Here's why:
The modification I did in the code was to change this:
Code: Select all
Phase game_phase(const Position& pos) {
Value npm = pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK);
return npm >= MidgameLimit ? PHASE_MIDGAME
: npm <= EndgameLimit ? PHASE_ENDGAME
: Phase(((npm - EndgameLimit) * 128) / (MidgameLimit - EndgameLimit));
}Code: Select all
Phase game_phase(const Position& pos) {
Value npm = pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK);
return npm >= MidgameLimit ? PHASE_MIDGAME
: npm <= EndgameLimit ? PHASE_ENDGAME
: Phase( 155.8*erf ( (1.0/(MidgameLimit-EndgameLimit))*((double)npm-MidgameLimit) ) +128 );
}
.Now, when npm is below EndgameLimit, the game phase is worth 100% Endgame. This is what happens for example in the follow FEN: 4KR2/2PP1P1P/8/8/3p4/3p4/2kp4/2q5.
The command "eval" returns
Code: Select all
Eval term | White | Black | Total
| MG EG | MG EG | MG EG
---------------------+-------------+-------------+---------------
Material, PST, Tempo | --- --- | --- --- | -5.92 -5.13
Material imbalance | --- --- | --- --- | -0.17 -0.17
Pawns | --- --- | --- --- | +2.01 +2.52
Knights | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
Bishops | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
Rooks | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
Queens | 0.00 0.00 | 0.02 0.10 | -0.02 -0.10
Mobility | -0.03 0.00 | 0.09 0.23 | -0.12 -0.23
King safety | 0.00 -0.08 | 0.00 -0.08 | +0.00 +0.00
Threats | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
Passed pawns | 11.42 21.75 | 3.31 8.49 | +8.11 +13.26
Space | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
---------------------+-------------+-------------+---------------
Total | --- --- | --- --- | +3.59 +9.55
Scaling: 0.00% MG, 100.00% * 100.00% EG.
Total evaluation: -9.55
Code: Select all
Eval term | White | Black | Total
| MG EG | MG EG | MG EG
---------------------+-------------+-------------+---------------
Material, PST, Tempo | --- --- | --- --- | -5.92 -5.13
Material imbalance | --- --- | --- --- | -0.17 -0.17
Pawns | --- --- | --- --- | +1.80 +2.41
Knights | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
Bishops | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
Rooks | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
Queens | 0.00 0.00 | 0.02 0.10 | -0.02 -0.10
Mobility | -0.03 0.00 | 0.09 0.23 | -0.12 -0.23
King safety | 0.00 -0.08 | 0.00 -0.08 | +0.00 +0.00
Threats | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
Passed pawns | 11.42 21.75 | 3.31 8.49 | +8.11 +13.26
Space | 0.00 0.00 | 0.00 0.00 | +0.00 +0.00
---------------------+-------------+-------------+---------------
Total | --- --- | --- --- | +3.40 +9.47
Scaling: 0.00% MG, 100.00% * 100.00% EG.
Total evaluation: -9.47
However look at the table returned by the "eval" command. We can see that everything is equal, except for Pawns | --- --- | --- --- | values. I don't understand why they would differ.
What's going on here?
So I decided to check exactly what is returned in the table for that row, I found this in evaluate.cpp, line 993:
Code: Select all
format_row(ss, "Pawns", PAWN);If I understand well, the value of PAWN is different for the normal Stockfish and the modified one.
But I see no reason why they would differ for the change I have made in the code.
I would appreciate if someone could shed some light.
Thank you.