Closed dlbbld closed 2 years ago
I hope the print screen for the fifty-moves example is clear:
I think the issue is in this: https://github.com/lichess-org/lila/blob/master/modules/importer/src/main/ImporterForm.scala#L113
game.situation.status match {
case Some(situationStatus) => dbGame.finish(situationStatus, game.situation.winner).game
case None =>
parsed.tags.resultColor
.map {
case Some(color) => TagResult(status, color.some)
case None if status == Status.Outoftime => TagResult(status, none)
case None => TagResult(Status.Draw, none)
}
.filter(_.status > Status.Started)
.fold(dbGame) { res =>
dbGame.finish(res.status, res.winner).game
}
}
}
We prioritize our game logic over the result from the pgn. The solution is always use the result from pgn. If there is none then use our logic to decide the result of the game. What do you think?
Sounds reasonable. Though what about mates with a differing result, e.g. maybe bc the result was later reversed due to cheating? I guess maybe just always going by the PGN would still be fine though.
In the case of conflict I agree that we should still always prefer PGN.
this can be closed now because of #10665
Even if checkmate or stalemate, the result can still be "*", for the players might overlook it... (or forget to set the result in the PGN).
I don't see that the PGN specification requires the game result to match with checkmate or stalemate on the board.
Therefore, I think always taking the PGN result is correct, allowing even the most bizarre case of having "*" in the result and checkmate or stalemate on the board.
I think the fix for this issue has been deployed. Can you verify it pls @dlbbld? thanks!
Thanks, but it does not work. Already imported games are not recreated, so for this reason, the result does not change. But for fresh imports, the first case (draw) does not work, only the second (win).
Swiercz vs Karjakin does not work: When importing, the import creates no new entry, it links to the previously imported game, so the result is still "Threefold repetition • Draw" instead of "Draw".
It creates a new import entry when changing a tag value before importing, but the result is still "Threefold repetition • Draw" instead of "Draw".
Carlsen vs Quang Liêm works partly: When importing, the import creates no new entry, it links to the previously imported game, so the result is still "Fifty moves without progress • Draw" instead of "Black resigned • White is victorious".
It creates a new import entry when changing a tag value before importing, and the result is "Black resigned • White is victorious", as expected.
The fix is only apply for new import. So if you paste
the same pgn again the result will not be changed. I don't know if we should do anything about it.
The text Threefold repetition • Draw
seems to be generated in the fly. If you download the annotated pgn, you'll see that there is no tag for that.
To say Threefold repetition • Draw
is wrong because the PGN only says it's a draw. It does not specify the reason. The reason can be any of mutual agreement, claim for threefold, arbiter decision or who knows what.
To enforce the previous. In the last World Championships, for example, between Carlsen and Nepomniachtchi, one could observe that. When they repeat in a drawish position about half the time, they agree to a draw, without one player claiming the draw for threefold. And at this point, there is often also a threefold on the board.
So threefold on the board does not mean the game ended with a threefold repetition claim; half of the time, there is mutual agreement.
When importing the drawn game example (PGN result is 1/2-1/2
), by changing tag values, a new import is created, it still prints Threefold repetition • Draw
for the result.
The agreement here is to print the result as per the PGN, which is Draw
. If there is a threefold repetition or not with the last move has no relevance, and must not be printed. It is misleading and unnecessary information.
Threefold: When importing a game that ends with a threefold repetition and result of 1/2-1/2, the import changes the result to "Threefold repetition • Draw", which is incorrect. One cannot know if the game ended for a threefold claim or mutual draw agreement. Therefore, the result should be only "Draw" as per the PGN. In fact, in most situations with a drawish position, the players draw per mutual agreement without involving a threefold claim.
Example: The following game ends with a threefold repetition and result of 1/2-1/2. After the import, the result is "Threefold repetition • Draw" instead of "Draw".
Fifty-moves: When importing a game that ends with fifty moves without a pawn move and capture and any result, the import changes it to "Fifty moves without progress • Draw", which is incorrect. The result can be any, also 1-0, or 0-1 and even if 1/2-1/2, one cannot know if the game ended for a fifty-move claim or mutual draw agreement. Therefore, the result should be as per the PGN.
Example: The following game ends with fifty moves without a pawn move and capture, but 1-0 because Black flagged. But after the import, the result is "Fifty moves without progress • Draw" instead of "Black resigned • White is victorious". By the way, to say Black resigned when importing 1-0 is incorrect, Black might also have flagged as here (#10519).
It is possibly related to #8681 and #8793.