Open rpdelaney opened 6 years ago
I attempted something along these lines in a very early version, but IIRC the functionality was lost during a big rewrite. If memory serves, it was possible to add a variation to the end node by adding the engine's PV to the end node as the main line, and then demoting that main line to a variation using GameNode.demote()
.
Still need to research whether that is legal PGN, though.
I think it's legal; certainly I've seen chess blogs add variations after the final move.
The only cases where evaluation/PV is not necessary is checkmate, which is the best possible move.
Sometimes it's not obvious why a player resigned or a draw was agreed, especially when one's elo is much lower than the players in the game one is analyzing. Also, if one uses chess-annotator to blunder check one's own games, it would be useful to know if someone resigned in a position that was actually winning or drawn, or accepted a draw in a position that was actually winning.
To achieve this, chess-annotator should add a numeric evaluation to the last node in the game regardless of whether the last played move was a mistake or not. Additionally, it would add the engine's PV in the final position as a variation to that node.
Now, it will be easy to introduce a step to add the engine's numeric evaluation of the final position to the last node in the game. But I'm not sure if it's legal PGN, as well as technically possible in python-chess, to add a variation to an end node. Some investigation and testing into that will be necessary.