added pgntouci script | bench 1857933
This commit is contained in:
1 parent
44af851081
commit
250347dbab
2 files changed
+109
No files matched your search
@@ -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)
|
||||
Reference in new issue
Block a user