Closed programarivm closed 2 years ago
Hello @programarivm , I gave a look at IsolatedPawnEvaluation.php
which seems ok to me since it just returns the number of isolated pawns for each player. The problem is that when we go evaluating the proportion to print the heuristics, the more the better for each statistics so the algorithm thinks that it's better to have 2 isolated pawns than 1, so it says that the the advantage is held by the player which has more isolated pawn (the same thing for #151 ).
We can change the logic of the return value of the evaluations in such a way this won't happen (which I think would decrease the readability if we return a number that does not correspond to the number of isolated pawns that the player has), or we could invent something that will be triggered when calculating the heuristics for each type of heuristic (like a boolean associated to each statistics that says if it the advantage of one player on the other is inversely or not inversely proportional to the particular statistic). In case this boolean says that for example IsolatedPawn is a "bad" statistic (something that is better to not have) we should invert the proportion of the players when creating the heuristics.
Thanks for looking at this issue.
If I'm not very much mistaken, this one is similar to https://github.com/chesslablab/php-chess/issues/114 in that the evaluation feature is being calculated the other way around. After playing 1.d4 d5 2.e4 e5 3.f4 f5 4.exd5 exd4 5.c3 dxc3 6.Nxc3
the IsolatedPawn chart in the heuristic picture should be -1
rather than 1
because Black's position is better in terms of isolated pawns.
Figure 1. White has an isolated pawn on d4
.
Remember:
A chess game can be plotted in terms of balance. +1 is the best possible evaluation for White and -1 the best possible evaluation for Black. Both forces being set to 0 means they're actually offset and, therefore, balanced.
Keep it up and happy coding and learning.
At the present moment, the isolated pawn evaluation is being calculated the other way around as shown in the example below.
Figure 1. White has an isolated pawn on d5.
Figure 2. The isolated pawn is evaluated the other way around.
Remember, +1 is the best possible evaluation for White and -1 the best possible evaluation for Black.
Thus
src/Evaluation/IsolatedPawnEvaluation.php
should be refactored with all tests passing accordingly.Keep it up, and happy learning and coding!