Skip to content

Commit

Permalink
when parsing FEN, ignore '/' and do the file change automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Dec 13, 2023
1 parent 6720165 commit fc3b090
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/format/FenReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ trait FenReader:
var error = none[String]
while iter.hasNext && error.isEmpty
do
if file >= 8 then
file = 0
rank -= 1
iter.next match
case '/' if file == 8 =>
file = 0
rank -= 1
if rank < 0 then error = true
case '/' => // ignored, optional. Rank switch is automatic
case ch if numberSet.contains(ch) =>
file += (ch - '0')
if file > 8 then error = Some(s"file = $file")
Expand Down

0 comments on commit fc3b090

Please sign in to comment.