SindreSvendby / pgnToFen

Takes PGN as input and returns FEN
MIT License
32 stars 10 forks source link

wrong order of segments #6

Open tsoj opened 5 years ago

tsoj commented 5 years ago

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
scubaguy commented 4 years ago

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.

tsoj commented 4 years ago

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