user33187: I have a list of PGN files that are games between top grandmasters where one player resigned at the end of the game. I am looking to find solutions to those position using stockfish/or another chess engine(programmatically). Ideally - I should be able to pass a PGN or FEN string and get the solution as the output.
How can I do that?

user12873: In Python this can be done as follows:
Using the python-chess module, iterate through the games in your pgn database. Docs: https://python-chess.readthedocs.io/en/latest/pgn.html
https://python-chess.readthedocs.io/en/latest/core.html#board
Now to use Stockfish, download the Stockfish engine, and then use the stockfish python module: https://pypi.org/project/stockfish/. python-chess can also be used to interact with Stockfish, but I'm not familiar myself with how to do this.
For each position in a game (that you want to find the best move for), get its FEN (using python-chess), and then set the stockfish module object's position to it (using the set_fen_position method). Finally, you can call the get_best_move function of the stockfish module.

33187: <p>I have a list of PGN files that are games between top grandmasters where one player resigned at the end of the game. I am looking to find solutions to those position using stockfish/or another chess engine(programmatically). Ideally - I should be able to pass a PGN or FEN string and get the solution as the output.</p>
<p>How can I do that?</p>
 12873: <p>In Python this can be done as follows:</p>
<p>Using the python-chess module, iterate through the games in your pgn database. Docs: <a href="https://python-chess.readthedocs.io/en/latest/pgn.html" rel="nofollow noreferrer">https://python-chess.readthedocs.io/en/latest/pgn.html</a></p>
<p><a href="https://python-chess.readthedocs.io/en/latest/core.html#board" rel="nofollow noreferrer">https://python-chess.readthedocs.io/en/latest/core.html#board</a></p>
<p>Now to use Stockfish, download the Stockfish engine, and then use the stockfish python module: <a href="https://pypi.org/project/stockfish/" rel="nofollow noreferrer">https://pypi.org/project/stockfish/</a>. python-chess can also be used to interact with Stockfish, but I'm not familiar myself with how to do this.</p>
<p>For each position in a game (that you want to find the best move for), get its FEN (using python-chess), and then set the stockfish module object's position to it (using the set_fen_position method). Finally, you can call the <code>get_best_move</code> function of the stockfish module.</p>
