SindreSvendby / pgnToFen

Takes PGN as input and returns FEN

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong order of segments

tsoj opened this issue · comments

enpassant field needs to be behind the castling availability.
for me this worked:

def getFullFen(self):
        return self.getFen() + ' ' + ('w ' if self.whiteToMove else 'b ') + (self.castlingRights if self.castlingRights else '-') + ' ' + self.enpassant
commented

FENS notation is 6 fields. See https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation
Proposed code mod to fix the output, and new counters to the class for half move clock and full move number.

I would suggest using python chess which supports easy pgn parsing. It seems like this library isn't maintained anymore.