Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for draw when parsing a pgn before assuming resignation #16965

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

yafred
Copy link
Contributor

@yafred yafred commented Feb 12, 2025

fixes #16951

@yafred yafred marked this pull request as ready for review February 12, 2025 04:12
@@ -48,7 +48,9 @@ val parseImport: PgnStr => Either[ErrorStr, ImportResult] = pgn =>
.map(Fen.write)

val status = parsed.tags(_.Termination).map(_.toLowerCase) match
case Some("normal") => game.situation.status | Status.Resign
case Some("normal") =>
game.situation.status | (if parsed.tags(_.Result).getOrElse("") === "1/2-1/2" then Status.Draw
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.getOrElse("") === "1/2-1/2" == .contains("1/2-1/2")

Copy link
Collaborator

@ornicar ornicar Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this is not the place to hardcode the draw notation, scalachess has parsers and they account for many other draw notations such as ½-½ or 0.5-0.5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean that the issue is that game.situation.status should be Status.Draw and that should be fixed in scalachess ?

@ornicar ornicar merged commit aefd92b into lichess-org:master Feb 12, 2025
3 checks passed
@yafred yafred deleted the issue-16951 branch February 12, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Imported drawn game shows resignation as result
2 participants