I want, with Python-chess, to evaluate any movement of some game and generate the PGN with analysis, as Chess.com does in its analysis.
For example, i played one game with fools mate and they generate that PGN:
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "1-0"]
1. e4 f6 {INACCURACY (+1.03)} ({(+0.16) The best move was} 1... e6 2. d4 d5 3.
exd5 exd5 4. Bd3 Nf6 5. Nf3 Bd6 6. O-O O-O 7. Re1 Be6 8. h3 Re8 9. Nc3 c6 10.
Ne2 Qc7 11. Be3 Nbd7 12. Qc1 c5 13. c3 c4 14. Bc2 Ne4 15. Bf4 f6 16. Bxd6 Qxd6
17. Nd2 Nxd2 18. Qxd2 Nb6 19. Ng3 Bd7 20. Rxe8+ Rxe8 21. Re1 Rxe1+ 22. Qxe1) 2.
d4 g5?? ± {BLUNDER (♔ Mate in 1)} ({(+0.93) The best move was} 2... e6 3. Bb5
Ne7 4. Nc3 g6 5. Nf3 Bg7 6. h4 a6 7. Be2 d5 8. h5 gxh5 9. Rxh5 dxe4 10. Nxe4 f5
11. Nc5 Nbc6 12. c3 e5 13. dxe5) 3. Qh5# 1-0
I like to show the evaluation of any move (if its an good move, or excellent, blunder, book-move ...), like they do.
I know how to load any PGN game and process it, generating String from PGN, like:
import chess
import chess.pgn
pgn = open("game path")
board = game.board()
for move in game.mainline_moves():
board.push(move)
exporter = chess.pgn.StringExporter(headers=True)
pgn_string = game.accept(exporter)
print(pgn_string) ## Here is the string with the pgn!
Basically: i want to generate a String PGN from an evaluated chess game.