Skip to content

Commit

Permalink
Merge pull request #16965 from yafred/issue-16951
Browse files Browse the repository at this point in the history
Test for draw when parsing a pgn before assuming resignation
  • Loading branch information
ornicar authored Feb 12, 2025
2 parents 3e5ac24 + f944525 commit aefd92b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/tree/src/main/ParseImport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.outcome.exists(_.winner.isEmpty) then Status.Draw else Status.Resign)
case Some("abandoned") => Status.Aborted
case Some("time forfeit") => Status.Outoftime
case Some("rules infraction") => Status.Cheat
Expand Down

0 comments on commit aefd92b

Please sign in to comment.