Here we successfully parse a PGN game:
import chess, chess.svg, chess.pgn, io
game = chess.pgn.read_game(io.StringIO("1. e4 e5 2. Nf3 *"))
print(game)
Unfortunately, board()
is still the initial position. How to get the final position instead?
print(game.board())
# r n b q k b n r
# p p p p p p p p
# . . . . . . . .
# . . . . . . . .
# . . . . . . . .
# . . . . . . . .
# P P P P P P P P
# R N B Q K B N R