liground icon indicating copy to clipboard operation
liground copied to clipboard

Last move of 3check game in pgn does not get imported

Open magehrke opened this issue 4 years ago • 3 comments

  • Loading a pgn file of 3check games, does not import the last move of every game

magehrke avatar May 10 '21 12:05 magehrke

  • For atomic pgns aren't loaded correctly as well. It is even more sever.
  • Not only the last move is missing, but arbitrarily many last moves

magehrke avatar May 10 '21 14:05 magehrke

This seems to be related to ffish.js. I assume we need to fix it there.

QueensGambit avatar May 10 '21 14:05 QueensGambit

I don't know about the 3check issue, but for atomic it is basically expected that PGN parsing can't work properly right now, sorry if I missed to point that out.

The reason is that atomic is implemented as an extinction variant with a non-royal king in Fairy-Stockfish, and the requirement to move the "king" out of check ("pseudoRoyal") is implemented independently from the normal check/checkmate logic. Therefore no generated SAN will have a +, and since we use the very strict parsing logic, checking moves won't be recognized. This should also apply to generated SAN/PGN by ffishjs, as well as to general detection of check situations (e.g., to highlight the king), but these might not be as critical as in the parsing.

Finding out if a pseudo-royal piece is under attack in atomic rules unfortunately is not completely trivial and therefore slow, but I already have the code for checkmate detection https://github.com/ianfab/Fairy-Stockfish/blob/57681a7d40d3cd6a297aae6a45ef8f0b961e16ee/src/position.h#L749-L761 which does exactly that. We could consider to either take this into account in the SAN generation (and even in is_check), or only restrict it to the parsing code, or maybe more generally allow to skip + in the PGN. Feel free to raise a bug and/or PR in my repo.

@gbtami FYI, as it might also be relevant for pychess.

ianfab avatar Jun 23 '21 15:06 ianfab