Ejemplo 1: generar pgn de python de juego de ajedrez
>>> import chess.pgn
>>>
>>> pgn = open("data/pgn/kasparov-deep-blue-1997.pgn")
>>>
>>> first_game = chess.pgn.read_game(pgn)
>>> second_game = chess.pgn.read_game(pgn)
>>>
>>> first_game.headers["Event"]
'IBM Man-Machine, New York USA'
>>>
>>> # Iterate through all moves and play them on a board.
>>> board = first_game.board()
>>> for move in first_game.mainline_moves():
... board.push(move)
...
>>> board
Board('4r3/6P1/2p2P1k/1p6/pP2p1R1/P1B5/2P2K2/3r4 b - - 0 45')
Ejemplo 2: Python de análisis de juego de ajedrez
with engine.analysis(...) as analysis:
for info in analysis:
print(info.get("score"))
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)