diff --git a/modules/core/src/main/scala/de/nowchess/chess/notation/PgnParser.scala b/modules/core/src/main/scala/de/nowchess/chess/notation/PgnParser.scala index 214a396..a362daf 100644 --- a/modules/core/src/main/scala/de/nowchess/chess/notation/PgnParser.scala +++ b/modules/core/src/main/scala/de/nowchess/chess/notation/PgnParser.scala @@ -43,11 +43,9 @@ object PgnParser: parseAlgebraicMove(token, board, history, color) match case None => state // unrecognised token — skip silently case Some(move) => - val newBoard = - if move.castleSide.isDefined then - board.withCastle(color, move.castleSide.get) - else - board.withMove(move.from, move.to)._1 + val newBoard = move.castleSide match + case Some(side) => board.withCastle(color, side) + case None => board.withMove(move.from, move.to)._1 val newHistory = history.addMove(move) (newBoard, newHistory, color.opposite, acc :+ move)