I'm using this library and I couldn't find how to modify that value (skill). In any case, what I want is to be able to vary the level of difficulty of stockfish using python chess.
3 Answers
Send an UCI command Skill Level
. Something like setoption name Skill Level value 10
.
EDIT:
https://python-chess.readthedocs.io/en/v0.25.0/uci.html. Please look at setoption
.
-
HI. Yes i know that syntax but i dont know how implement it on python chess. :-(– 9acca9Mar 15, 2021 at 16:57
-
Thanks. With this syntax you can set the skill level:
engine.configure({"Skill Level": 7})
https://python-chess.readthedocs.io/en/latest/engine.html#options
The simplest way I can think of is through a dilution method. You either get a weaker chess AI that you have created yourself or someone else has created and use that bot to dilute the stockfish bot.
for example a 35% stockfish 12 (~3500 elo) and 65% my custom chess ai (~1500 elo) would theoretically be 0.35 * 3500 + 0.65 * 1500 elo or 2200. This is just an estimate of level as chess elo progression isn't linear (i.e the difference between a 1000 and 1200 isn't the same as a 2000 and 2200)
The way the dilution occurs is by randomly picking which bot will make which moves. So 35% of moves will be made by stockfish 12 and 65% will be made by my bot.
if you want to increase or decrease the difficulty just adjust the the concentration of the two bots.