Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class JVMGameSpec extends FlatSpec with MustMatchers with GeneratorDrivenPropert
g003.moves.length mustBe 117
g003.branches.map(_.offset) mustBe Seq(69, 69, 49, 33)
g003.branches.map(_.moves.length) mustBe Seq(9, 7, 13, 9)
g003.trunk.hasComment(0) mustBe true
g003.trunk.comments.size mustBe 17
g003.trunk.comments.keySet mustBe Set(0, 32, 33, 46, 49, 56, 64, 69, 72, 76, 83, 100, 105, 109, 111, 113, 117)
g003.branches(2).comments mustBe Map(
52 -> Seq("[Taichi_NAKAMURA] 次に53銀打の狙いがあります。",
"\"You are threatening Silver drop to 53 ",
Expand All @@ -42,6 +45,8 @@ class JVMGameSpec extends FlatSpec with MustMatchers with GeneratorDrivenPropert
).mkString("\n")
)

Game.parseKifString(g003.toKifString).toUsenString mustBe g003.toUsenString

Game.parseKifString(loadFile("kif/game/004.kif")).moves.length mustBe 223

val g005: Game = Game.parseKifString(loadFile("kif/game/005.kif"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ trait KifBranchWriter extends KifLike {
} yield "*" + line

val lines: Seq[String] = for {
(m, i) <- (descriptiveMoves ++ finalAction).map(_.toKifString).zipWithIndex
(m, i) <- ((descriptiveMoves ++ finalAction).map(_.toKifString) :+ "").zipWithIndex
index = offset + i
ln <- commentToSeq(index) :+ f"${index + 1}%4d ${m}"
} yield ln

(lines ++ commentToSeq(offset + moves.length)).mkString("\n")
// remove the last element (dummy)
lines.init.mkString("\n")
}
}

Expand Down