added pgntouci script | bench 1857933

This commit is contained in:
rektdie committed 2025-04-01 04:55:30 +02:00
1 parent 44af851081
commit 250347dbab
2 files changed
+109

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
##########################################
# convert pgn to uci
##########################################
import chess
import chess.pgn
pgn = open("game.pgn")
game = chess.pgn.read_game(pgn)
board = game.board()
moves = "position fen " + board.fen() + " moves"
for move in game.mainline_moves():
board.push(move)
moves += " " + move.uci()
print(moves)