Skip to content

Commit 8710eba

Browse files
authored
Merge pull request #192 from Mind-Sports-Games/pla-1035-issue-loading-go-games-into-analysisstudy-with-passes-in
account for old style go fen format without pass info
2 parents f20ba58 + 56b80d0 commit 8710eba

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name := "strategygames"
22

33
organization := "org.playstrategy"
44

5-
version := "10.2.1-pstrat158"
5+
version := "10.2.1-pstrat159"
66

77
scalaVersion := "2.13.10"
88

src/main/scala/go/format/FEN.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ final case class FEN(value: String) extends AnyVal {
2222

2323
def komi: Double = intFromFen(7).getOrElse(0) / 10.0
2424

25+
// need to account for old style of fen without pass info due to studies and setup info
26+
def oldFenSytle: Boolean = value.split(' ').length == 9
27+
2528
// Consecutive Pass count. Capped at 2, 3 is reserved for end game (after "ss:")
26-
def fenPassCount: Int = intFromFen(8).getOrElse(0)
29+
def fenPassCount: Int = if (oldFenSytle) 0 else intFromFen(8).getOrElse(0)
2730

28-
def fullMove: Option[Int] = intFromFen(9)
31+
def fullMove: Option[Int] = if (oldFenSytle) intFromFen(8) else intFromFen(9)
2932

3033
def ply: Option[Int] =
3134
fullMove map { fm =>

src/main/scala/go/format/Forsyth.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ object Forsyth {
2626
variant = variant,
2727
pocketData = apiPosition.pocketData,
2828
uciMoves = fen.fenPassCount match {
29-
case 0 => List()
3029
case 1 => List("pass")
3130
case 2 => List("pass", "pass")
3231
case 3 => List("ss:")
32+
case _ => List()
3333
},
3434
position = apiPosition.some
3535
),

0 commit comments

Comments
 (0)