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
90 changes: 90 additions & 0 deletions jvm/src/test/resources/kif/mate/001.kif
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ---- 柿木将棋Ⅷ V7.80 棋譜ファイル ----
開始日時:2004/04/01(木) 21:43:11
終了日時:2004/04/01(木) 21:46:07
作品番号:kinen003a
作品名:驚愕の曠野
作者:岡村孝雄
発表誌:詰パラ
発表年月:2004年4月
手数:59
手合割:平手  
後手の持駒:飛二 角 銀二 桂四 香四 歩九 
9 8 7 6 5 4 3 2 1
+---------------------------+
| ・ ・ ・ ・v玉 ・ ・ ・ ・|一
| ・ ・ ・ ・ ・ ・ ・ ・ ・|二
| ・ ・ ・ ・ ・ ・ ・ ・ ・|三
| ・ ・ ・ ・ ・ ・ ・ ・ ・|四
| ・ ・ ・ ・ ・ ・ ・ ・ ・|五
| ・ ・ ・ ・ ・ ・ ・ ・ ・|六
| ・ ・ ・ ・ ・ ・ ・ ・ ・|七
| ・ ・ ・ ・ ・ ・ ・ ・ ・|八
| ・ ・ ・ ・ ・ ・ ・ ・ ・|九
+---------------------------+
先手の持駒:角 金四 銀二 歩九 
先手:
後手:
手数----指手---------消費時間--
*岡村孝雄 詰パラ2004年4月「驚愕の曠野」(改良図)
*原図 詰パラ2003年11月
1 3三角打 ( 0:01/00:00:01)
2 4二角打 ( 0:02/00:00:02)
3 同 角成(33) ( 0:02/00:00:03)
4 同 玉(51) ( 0:01/00:00:03)
5 6四角打 ( 0:03/00:00:06)
6 5三角打 ( 0:02/00:00:05)
7 4三歩打 ( 0:02/00:00:08)
8 3二玉(42) ( 0:01/00:00:06)
9 3三歩打 ( 0:02/00:00:10)
10 2二玉(32) ( 0:01/00:00:07)
11 2三歩打 ( 0:02/00:00:12)
12 1二玉(22) ( 0:01/00:00:08)
13 1三歩打 ( 0:02/00:00:14)
14 2三玉(12) ( 0:05/00:00:13)
15 2四歩打 ( 0:03/00:00:17)
16 同 玉(23) ( 0:01/00:00:14)
17 2五歩打 ( 0:01/00:00:18)
18 同 玉(24) ( 0:03/00:00:17)
19 3六銀打 ( 0:12/00:00:30)
20 同 玉(25) ( 0:00/00:00:17)
21 3七金打 ( 0:05/00:00:35)
22 2五玉(36) ( 0:02/00:00:19)
23 2六歩打 ( 0:02/00:00:37)
24 3四玉(25) ( 0:02/00:00:21)
25 4五銀打 ( 0:02/00:00:39)
26 同 玉(34) ( 0:01/00:00:22)
27 4六金(37) ( 0:03/00:00:42)
28 3四玉(45) ( 0:02/00:00:24)
29 4五金打 ( 0:02/00:00:44)
30 2四玉(34) ( 0:02/00:00:26)
31 3五金(46) ( 0:03/00:00:47)
32 同 角(53) ( 0:02/00:00:28)
33 2五金打 ( 0:01/00:00:48)
34 1三玉(24) ( 0:06/00:00:34)
35 3一角成(64) ( 0:03/00:00:51)
36 2二歩打 ( 0:02/00:00:36)
37 1四歩打 ( 0:02/00:00:53)
38 1二玉(13) ( 0:01/00:00:37)
39 1三金打 ( 0:01/00:00:54)
40 同 角(35) ( 0:01/00:00:38)
41 同 歩成(14) ( 0:03/00:00:57)
42 同 玉(12) ( 0:01/00:00:39)
43 1四歩打 ( 0:02/00:00:59)
44 1二玉(13) ( 0:02/00:00:41)
45 2三角打 ( 0:03/00:01:02)
46 1一玉(12) ( 0:04/00:00:45)
47 2二馬(31) ( 0:09/00:01:11)
48 同 玉(11) ( 0:01/00:00:46)
49 1三歩成(14) ( 0:04/00:01:15)
50 同 玉(22) ( 0:05/00:00:51)
51 1四金(25) ( 0:01/00:01:16)
52 2二玉(13) ( 0:01/00:00:52)
53 3二角成(23) ( 0:02/00:01:18)
54 1一玉(22) ( 0:01/00:00:53)
55 1二歩打 ( 0:01/00:01:19)
56 同 玉(11) ( 0:01/00:00:54)
57 2三金(14) ( 0:03/00:01:22)
58 1一玉(12) ( 0:01/00:00:55)
59 2二金(23) ( 0:01/00:01:23)
60 詰み ( 0:08/00:01:03)
まで59手で詰み
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ class JVMGameSpec extends FlatSpec with MustMatchers with GeneratorDrivenPropert

val s8 = loadFile("kif/game/008.kif")
Game.parseKifString(s8).trunk.moves.length mustBe 168

val s9 = loadFile("kif/mate/001.kif")
Game.parseKifString(s9).trunk.moves.length mustBe 59
}

"Game#parseKi2String" must "create games from files" in StateCache.withCache { implicit cache =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,14 @@ trait KifBranchReader extends KifGameIO {
sofar
case ((n, Some((_, x)), _) :: ys, None) if !isNormalMoveKif(x) && ys.forall(_._3.isDefined) => // ends with a special move (+comments)
val special = MoveBuilderKif.parseTime((x, n)) match {
case ((Resign.kifKeyword, _), tm) => Resign(tm)
case ((TimeUp.kifKeyword, _), tm) => TimeUp(tm)
case ((TimeUp.kifKeyword2, _), tm) => TimeUp(tm)
case ((Pause.kifKeyword, _), _) => Pause
case ((Resign.kifKeyword, _), tm) => Some(Resign(tm))
case ((TimeUp.kifKeyword, _), tm) => Some(TimeUp(tm))
case ((TimeUp.kifKeyword2, _), tm) => Some(TimeUp(tm))
case ((Pause.kifKeyword, _), _) => Some(Pause)
case ((s, _), _) if s.contains('詰') => None // ignore
case _ => throw new RecordFormatException(n, s"unknown special move: ${x}")
}
sofar.copy(finalAction = Some(special))
special.map(sp => sofar.copy(finalAction = Some(sp))).getOrElse(sofar)
case ((_, Some((_, x)), _) :: Nil, Some((_, mv))) if x.startsWith(IllegalMove.kifKeyword) => // ends with explicit illegal move
sofar.copy(finalAction = Some(IllegalMove(mv)))
case ((n, Some((_, x)), _) :: xs, None) =>
Expand Down Expand Up @@ -276,7 +277,7 @@ trait KifGameReader extends KifBranchReader with KifGameIO with KifGameFactory[G
}

private[this] def sectionSplitterKif(nel: NonEmptyLines): (Lines, NonEmptyLines, Lines, Option[Line]) = {
val (gi, st, body) = sectionSplitterCommon(nel, { s => !s.startsWith("手数") })
val (gi, st, body) = sectionSplitterCommon(nel, { s => !s.startsWith("手数-") })
(gi, st, body.drop(1), None)
}

Expand Down Expand Up @@ -308,7 +309,7 @@ trait KifGameReader extends KifBranchReader with KifGameIO with KifGameFactory[G
val (x, n) = nel.lines.last
presetStates.getOrElse(x.drop(4), throw new RecordFormatException(n, s"unknown preset state: ${x.drop(4)}"))
} else {
State.parseKifString(nel)
State.parseKifString(nel.copy(lines = nel.lines.filterNot(_._1.startsWith("手合割:"))))
}
}

Expand Down