Stockfish strength level

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Dann Corbit, Harvey Williamson

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

Stockfish strength level

Post by tomitank » Tue Aug 22, 2017 2:18 pm

Hi!

I found this:
https://github.com/niklasf/stockfish.js

This is used by "lichess".

My question is: what parameter does the "lichess" use to set engine level?

-Tamas

Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 10:41 am

Re: Stockfish strength level

Post by Lyudmil Tsvetkov » Tue Aug 22, 2017 2:25 pm

tomitank wrote:Hi!

I found this:
https://github.com/niklasf/stockfish.js

This is used by "lichess".

My question is: what parameter does the "lichess" use to set engine level?

-Tamas
whatever the level, it is very weak, as one is able to beat it even at level 8.

seemingly, for levels 1-6 they are using some randomisation, while levels 7 and 8 only significantly limit the time usage, to fraction of a second.

tomitank
Posts: 258
Joined: Sat Mar 04, 2017 11:24 am
Location: Hungary

Re: Stockfish strength level

Post by tomitank » Tue Aug 22, 2017 4:20 pm

That's okay.

I'm interested, for example, at level 7, what is the minimum depth and the maximum search time.

Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 10:41 am

Re: Stockfish strength level

Post by Lyudmil Tsvetkov » Tue Aug 22, 2017 4:36 pm

tomitank wrote:That's okay.

I'm interested, for example, at level 7, what is the minimum depth and the maximum search time.
that will depend on the computers.

as different users will be served by different cpus, depth will vary.

tomitank
Posts: 258
Joined: Sat Mar 04, 2017 11:24 am
Location: Hungary

Re: Stockfish strength level

Post by tomitank » Tue Aug 22, 2017 4:44 pm

I do not think so.

On weaker devices, it searched longer.

tomitank
Posts: 258
Joined: Sat Mar 04, 2017 11:24 am
Location: Hungary

Re: Stockfish strength level

Post by tomitank » Tue Aug 22, 2017 5:11 pm

From stockfish source code:

Code: Select all

#ifdef SKILL
  // Skill structure is used to implement strength limit
  struct Skill {
    Skill(int l) : level(l) {}
    bool enabled&#40;) const &#123; return level < 20; &#125;
    bool time_to_pick&#40;Depth depth&#41; const &#123; return depth / ONE_PLY == 1 + level; &#125;
    Move best_move&#40;size_t multiPV&#41; &#123; return best ? best &#58; pick_best&#40;multiPV&#41;; &#125;
    Move pick_best&#40;size_t multiPV&#41;;

    int level;
    Move best = MOVE_NONE;
  &#125;;
#endif

Code: Select all

      // If skill level is enabled and time is up, pick a sub-optimal best move
#ifdef SKILL
      if &#40;skill_.enabled&#40;) && skill_.time_to_pick&#40;rootDepth&#41;)
          skill_.pick_best&#40;multiPV_);
#endif
Accordingly, is the set level + 1 equal to the maximum search depth?

Fabian Fichter
Posts: 46
Joined: Mon Dec 12, 2016 1:14 pm
Contact:

Re: Stockfish strength level

Post by Fabian Fichter » Tue Aug 22, 2017 5:53 pm

You can find the relevant code for the settings of movetime, depth limit, and skill level here:
https://github.com/niklasf/fishnet/blob ... #L109-L110
https://github.com/niklasf/fishnet/blob ... #L774-L782

Vinvin
Posts: 4919
Joined: Thu Mar 09, 2006 8:40 am
Full name: Vincent Lejeune

Re: Stockfish strength level

Post by Vinvin » Tue Aug 22, 2017 6:03 pm

tomitank wrote:From stockfish source code:

Code: Select all

#ifdef SKILL
  // Skill structure is used to implement strength limit
  struct Skill &#123;
    Skill&#40;int l&#41; &#58; level&#40;l&#41; &#123;&#125;
    bool enabled&#40;) const &#123; return level < 20; &#125;
    bool time_to_pick&#40;Depth depth&#41; const &#123; return depth / ONE_PLY == 1 + level; &#125;
    Move best_move&#40;size_t multiPV&#41; &#123; return best ? best &#58; pick_best&#40;multiPV&#41;; &#125;
    Move pick_best&#40;size_t multiPV&#41;;

    int level;
    Move best = MOVE_NONE;
  &#125;;
#endif

Code: Select all

      // If skill level is enabled and time is up, pick a sub-optimal best move
#ifdef SKILL
      if &#40;skill_.enabled&#40;) && skill_.time_to_pick&#40;rootDepth&#41;)
          skill_.pick_best&#40;multiPV_);
#endif
Accordingly, is the set level + 1 equal to the maximum search depth?
Yes, SF level on Lichess is 1 to 8. "1" is the strongest level, I think it search for 2 millions nodes or so.
Other levels are simply a constant progression to map "1 to 8" to "1 to 20 SF levels".

tomitank
Posts: 258
Joined: Sat Mar 04, 2017 11:24 am
Location: Hungary

Re: Stockfish strength level

Post by tomitank » Tue Aug 22, 2017 6:30 pm

Is correct?

At Level 8: Max depth = 62, movetime = 370ms / thread (default 3)
At Level 7: Max depth = 37, movetime = 185ms / thread (default 3)

Post Reply