简体   繁体   中英

Stockfish does the same moves everytime for a given postition

Using stockfish for a chess program. It gives the same moves every time for any position. It even opens with the same moves.

I'm using the python-chess library for communicating with stockfish I'm not sure if that's where the issue lies or if it's something else.

engine = chess.engine.SimpleEngine.popen_uci(
        r"engine/stockfish_14.1_win_x64_popcnt/stockfish_14.1_win_x64_popcnt.exe")

Stockfish plays the move it thinks is best in any given position. That is why it will always give you the same move if you feed it the same position and give it the same amount to think.

In engine vs engine tournaments they often play according to given opening positions. The first X moves are therefore given and then the engines will play on from there by themselves. This way the games will be different most of the times, otherwise the games would look the same no matter how many times they played.

Chess engines like Stockfish try to play the best move for a given position. The move found by an engine depends mainly on time constraints and number of threads searching - if those parameters are the same, you can expect the returned best move to be the same - especially when the engine is searching on a single thread.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM