I'd been considering using python-shogi to automate the task of converting a few thousand tsumeshogi problems (in KIF) format to SFEN for use elsewhere (namely an Anki plugin). Each tsumeshogi problem consists of a kifu with the initial state of the problem, and the main solution line(s), though I'm currently ignoring the (much harder) problem of automatically extracting the solutions.
It seems there are some issues with my idea. After some initial problems with KIF import (renaming them to .kifu seems to have solved that issue), I find that no matter which kifu I import, via something like:
I always get an SFEN corresponding to the initial game state, not of the tsumeshogi problem at all!
I asked around and so far it looks as if the following line (and the logic behind it) are responsible:
https://github.com/gunyarakun/python-shogi/blob/60c997a1213475628bb0b53481eb5c860369d2dd/shogi/KIF.py#L128
Essentially, it seems that python-shogi has a hardcoded assumption that a kifu will be a "full game record" and thus always initialises the board in a "game start" state, not the state explicitly given in the kifu.
Is this understanding correct; and either way, is it possible for this to be handled properly in a future release?
The current implementation has a problem as you pointed, that should be fixed especially to use python-shogi for tsume-shogi.
I'm waiting for pull requests to handle the situation properly.
I'd been considering using python-shogi to automate the task of converting a few thousand tsumeshogi problems (in KIF) format to SFEN for use elsewhere (namely an Anki plugin). Each tsumeshogi problem consists of a kifu with the initial state of the problem, and the main solution line(s), though I'm currently ignoring the (much harder) problem of automatically extracting the solutions.
It seems there are some issues with my idea. After some initial problems with KIF import (renaming them to
.kifu
seems to have solved that issue), I find that no matter which kifu I import, via something like:I always get an SFEN corresponding to the initial game state, not of the tsumeshogi problem at all!
I asked around and so far it looks as if the following line (and the logic behind it) are responsible: https://github.com/gunyarakun/python-shogi/blob/60c997a1213475628bb0b53481eb5c860369d2dd/shogi/KIF.py#L128 Essentially, it seems that python-shogi has a hardcoded assumption that a kifu will be a "full game record" and thus always initialises the board in a "game start" state, not the state explicitly given in the kifu.
Is this understanding correct; and either way, is it possible for this to be handled properly in a future release?
Content of my
.kifu
file: