gunyarakun / python-shogi

A pure Python shogi library with move generation and validation and handling of common formats.
GNU General Public License v3.0
179 stars 43 forks source link

CSA parser does not support "PI" command #27

Closed mizar closed 3 years ago

mizar commented 3 years ago
  File "C:\Python38\lib\site-packages\shogi\CSA.py", line 127, in parse_str
    position = Parser.parse_position(position_lines)
  File "C:\Python38\lib\site-packages\shogi\CSA.py", line 231, in parse_position
    raise ValueError('Invalid rank/piece in hand: {0}'.format(line))
ValueError: Invalid rank/piece in hand: PI

examples of files that can cause problems: http://www2.computer-shogi.org/kifu/wcso1_kifu.zip

CSA file format spec:

http://www2.computer-shogi.org/protocol/record_v22.html

2.5 開始局面

"P"で始まる文字列(以前に決めたもの)。
(1) 平手初期配置と駒落ち
平手初期配置は、"PI"とする。駒落ちは、"PI"に続き、落とす駒の位置と種類を必要なだけ記述する。
例:二枚落ちPI82HI22KA
gunyarakun commented 3 years ago

@mizar san, thank you for reporting the issue. I've fixed it and released version 1.0.10 on PyPI.