Stockfish Skill-Level

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
tomitank
Posts: 198
Joined: Sat Mar 04, 2017 11:24 am
Location: Hungary

Stockfish Skill-Level

Post by tomitank » Tue Mar 12, 2019 3:51 pm

Hi!

Which is the most popular method to setting the skill level in Stockfish?

(I want to make it independent of time.)

i found this:

Code: Select all

    function make_set_level(player)
    {
        function set_level(level)
        {
            var depth,
                err_prob,
                max_err;
            
            if (level < 0) {
                level = 0;
            }
            if (level > 20) {
                level = 20;
            }
            
            /// Nothing to change.
            if (level === player.engine.level) {
                return false;
            }
            
            /// Change thinking depth allowance.
            if (level < 2) {
                depth = "1";
            } else if (level < 4) {
                depth = "2";
            } else if (level < 6) {
                depth = "3";
            } else if (level < 8) {
                depth = "4";
            }
            
            player.engine.level = level;
            player.engine.depth = depth;
            
            change_selected(player.els.level, level);
            
            if (player.engine) {
                player.engine.send("setoption name Skill Level value " + level);
                
                ///NOTE: Stockfish level 20 does not make errors (intentially), so these numbers have no effect on level 20.
                /// Level 0 starts at 1
                err_prob = Math.round((level * 6.35) + 1);
                /// Level 0 starts at 5
                max_err = Math.round((level * -0.25) + 5);
                
                player.engine.err_prob = err_prob;
                player.engine.max_err  = max_err;
                
                player.engine.send("setoption name Skill Level Maximum Error value " + max_err);
                player.engine.send("setoption name Skill Level Probability value " + err_prob);
                
                ///NOTE: Could clear the hash to make the player more like it's brand new.
                /// player.engine.send("setoption name Clear Hash");
            }
        }

Post Reply