Reputation: 307
Our chess game project uses chess.uci
and the stockfish engine. We used engine = chess.uci.popen_engine("/some_address/stockfish")
to start an engine. However, I want to know if there is a way to change this engine's skill level. Could I achieve that by passing parameters to engine.go()
? I saw there are options such as movetime and depth. Some Stack Overflow post says that there is a "skill level" option in stockfish but I didn't find it. What I want to achieve is to match the engine's skill to the player's skill. Thanks!
Upvotes: 1
Views: 2036
Reputation: 1866
Have you read the documentation? It is all in there.
Here is an example from the documentation on how to limit the level given it a fixed amount of search time:
Playing
Example: Let Stockfish play against itself, 100 milliseconds per move.
import chess import chess.engine engine = chess.engine.SimpleEngine.popen_uci("/usr/bin/stockfish") board = chess.Board() while not board.is_game_over(): result = engine.play(board, chess.engine.Limit(time=0.1)) board.push(result.move) engine.quit()
Upvotes: 1