I am trying to get the evaluations for a series of fen positions using the Python stockfish library. When the solution is mate in x, my code runs quickly. When the solution is x centipawns it runs for a very long time. How do I get stockfish to limit the amount of time it has to think about the evaluation? Here's my code:
fish = Stockfish()
evals = []
fen = 'r1bqk2r/pp1pbppp/2n1pn2/2p5/2B1N3/4PN2/PPPP1PPP/R1BQ1RK1 b kq - 1 1'
fish.set_fen_position(fen)
fish.get_evaluation()
I looked at the code and getting the score using time is not supported at the moment.
I created a function where you can control the time limit. The function will return score in cp and mate as well as the bestmove.
Code
Sample application
Output