feat: NCS-6 Implementing FEN & PGN #7

Merged
Janis merged 7 commits from feat/NCS-6-Parsing-FEN-&-PGN into main 2026-03-29 14:02:25 +02:00
Showing only changes of commit 9b857f93ae - Show all commits
@@ -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)