StockFish LS with LimitStrength feature

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

Moderators: hgm, Rebel, chrisw

Alexander Schmidt
Posts: 1203
Joined: Thu May 10, 2007 2:49 pm

StockFish LS with LimitStrength feature

Post by Alexander Schmidt »

http://www.mediafire.com/?rvs5lli0cx523br

Stockfish LS v1
---------------

This is a hacked version of StockFish 2.1.1. The only difference is the implemented UCI_LimitStrength feature and changes of the default values. It is possible to adjust the playing strength between 1000 and 2800 ELO.

In the range between 1950 and 2800 ELO the strength is limited with a reduction of the nodes/seconds. That means StockFish LS shouldn't do stupid blunders. This range is quite good tuned and the ELO values are compareable to the SSDF ELO. In the range between 1000 and 1949 ELO StockFish LS uses beside a reduction of the nps the internal SkillLevels. That means StockFish plays positional weaker moves, and on low levels it can also do blunders. This range is not much tuned and I would be happy about feedback.

I turned down the default value for agressivity and erased the value for cowardice. I am satisfied with the style because StockFish plays quite balanced, more fitting to the weakened strength. But you can also switch to the old values of 100.

The limited StockFish LS will play at the same strength on different machines as long as it can reach the nps limit.

If you look at the sources please note that I am not a professional programmer. ;)

My compile is 3 times slower than the original StockFish. That doesn't matter for the weak levels but maybe an expert want to try his luck.

Alex
Engin
Posts: 918
Joined: Mon Jan 05, 2009 7:40 pm
Location: Germany
Full name: Engin Üstün

Re: StockFish LS with LimitStrength feature

Post by Engin »

Hi Alexander,
the UCI_LimitStrength is not new, this comes first from Shredder, and i am tried that with Tornado too in the past, but the adjustements of real ELO strength depends on human players is very difficult, i done that also with limit the nodes to search, but how can you know what nodes/sec to search for an ELO about 1800 ?

The base Idea is good, but prepare of near real strength for human players is very hard to find, because if later the engine is changed, you dont know how much the ELO are being changed too.

So it is much easier to make some handfull playing levels for novice players they can try to play, and if they won they can try high levels.

estimation strength with ELO is not a good Idea in my opinion.
Alexander Schmidt
Posts: 1203
Joined: Thu May 10, 2007 2:49 pm

Re: StockFish LS with LimitStrength feature

Post by Alexander Schmidt »

Hi Engin,

I prefer a concrete value when I use easy levels. I don't have to tune the values after a new release because this will be the one and only version by me :)

BTW: There seems to be a problem with ponder on and long timecontrols. I'll try to fix that. Better use the Fruit Hack for now...

http://www.mediafire.com/?5dc5pn0cqkuoepf

Alex
Alexander Schmidt
Posts: 1203
Joined: Thu May 10, 2007 2:49 pm

Bugfix

Post by Alexander Schmidt »

Alexander Schmidt wrote:Stockfish LS v1
---------------

This is a hacked version of StockFish 2.1.1. The only difference is the implemented UCI_LimitStrength feature and changes of the default values. It is possible to adjust the playing strength between 1000 and 2800 ELO.

In the range between 1950 and 2800 ELO the strength is limited with a reduction of the nodes/seconds. That means StockFish LS shouldn't do stupid blunders. This range is quite good tuned and the ELO values are compareable to the SSDF ELO. In the range between 1000 and 1949 ELO StockFish LS uses beside a reduction of the nps the internal SkillLevels. That means StockFish plays positional weaker moves, and on low levels it can also do blunders. This range is not much tuned and I would be happy about feedback.

I turned down the default value for agressivity and erased the value for cowardice. I am satisfied with the style because StockFish plays quite balanced, more fitting to the weakened strength. But you can also switch to the old values of 100.

The limited StockFish LS will play at the same strength on different machines as long as it can reach the nps limit.

If you look at the sources please note that I am not a professional programmer. ;)

My compile is 3 times slower than the original StockFish. That doesn't matter for the weak levels but maybe an expert want to try his luck.

Alex
StockFish LS v2 is available: http://www.mediafire.com/?eh8hjqq1hj1tt53

Problems with pondering fixed. Seems to run pretty stable now.

Alex
stevenaaus
Posts: 608
Joined: Wed Oct 13, 2010 9:44 am
Location: Australia

Linux

Post by stevenaaus »

It sounds an interesting idea. But linux build fails

$ make profile-build ARCH=x86-32

search.cpp:40:21: error: windows.h: No such file or directory
search.cpp: In function ‘Value<unnamed>::search(Position&, SearchStack*, Value, Value, Depth)’:
search.cpp:955: error: there are no arguments to ‘Sleep’ that depend on a template parameter, so a declaration of ‘Sleep’ must be available
search.cpp:955: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
search.cpp: In function ‘Value<unnamed>::search(Position&, SearchStack*, Value, Value, Depth) [with <unnamed>::NodeType PvNode = PV, bool SpNode = false, bool Root = true]’:
search.cpp:556: instantiated from here
search.cpp:947: warning: converting to ‘int’ from ‘double’
search.cpp:955: error: ‘Sleep’ was not declared in this scope
search.cpp: In function ‘Value<unnamed>::search(Position&, SearchStack*, Value, Value, Depth) [with <unnamed>::NodeType PvNode = PV, bool SpNode = true, bool Root = false]’:
search.cpp:2200: instantiated from here
search.cpp:947: warning: converting to ‘int’ from ‘double’
UncombedCoconut
Posts: 319
Joined: Fri Dec 18, 2009 11:40 am
Location: Naperville, IL

Re: Linux

Post by UncombedCoconut »

Sleep() is a Windows API function that sleeps a specified number of milliseconds. On Linux you can call nanosleep() instead. For instance, the msleep function at the end of this page implements Sleep(). You should include <time.h> instead of <windows.h>.
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Linux

Post by mar »

UncombedCoconut wrote:Sleep() is a Windows API function that sleeps a specified number of milliseconds. On Linux you can call nanosleep() instead. For instance, the msleep function at the end of this page implements Sleep(). You should include <time.h> instead of <windows.h>.
Also note that Sleep() on Windows has (like GetTickCount) a granularity of ~15ms (might vary depending on system). So Sleep(1) or Sleep(15) will do esentially the same thing. Which sucks of course :)

Martin
Alexander Schmidt
Posts: 1203
Joined: Thu May 10, 2007 2:49 pm

Re: Linux

Post by Alexander Schmidt »

Hi,

I have no Linux and I am not a programmer. You can try to replace the search.cpp with this one, maybe it works: http://www.mediafire.com/?adutf1f6t10qn5q

Alex
stevenaaus
Posts: 608
Joined: Wed Oct 13, 2010 9:44 am
Location: Australia

Scidvspc UCI feature

Post by stevenaaus »

Alexander Schmidt wrote:I have no Linux and I am not a programmer.
Well spoken :P
You can try to replace the search.cpp with this one, maybe it works: http://www.mediafire.com/?adutf1f6t10qn5q

Alex
No...
StockFishLS/src/main.cpp:57: undefined reference to `init_search()'
thread.o: In function `start_routine':

I wonder if no-one simply has approximations of the skill levels as ELO.
They are meant to be CPU indendpendent i think.

I think i'm going to include Stockfish with Scid vs. PC one day, and kill off Scidlet.

Anyway, I've given Scid's stupid Player vs. UCI Engine feature a tune up todey. It has pause/resume, draw and mate detection now.
Oh yeah, and the time clocks have been made to half work too. God knows how Pascal could write quite
complicated features like this and then not spend the few hours to make them
- you know - useable. :idea: Been fixing this thing for years now.

svn co https://scidvspc.svn.sourceforge.net/svnroot/scidvspc

I'll try to remember to put a new windows beta gui up in the morning when my internet is going a bit faster.
Alexander Schmidt
Posts: 1203
Joined: Thu May 10, 2007 2:49 pm

Re: Scidvspc UCI feature

Post by Alexander Schmidt »

stevenaaus wrote:No...
StockFishLS/src/main.cpp:57: undefined reference to `init_search()'
thread.o: In function `start_routine':
I think it should be easy for an expert to create a linux version.

I only added a few lines of code in search.cpp:

Code: Select all

  //Limit nps&#58; Enable skill level for UCI_Limitstrength feature ELO 1000-1949

  if &#40;Options&#91;"UCI_LimitStrength"&#93;.value<bool>() == true&#41;
  &#123;
	  if &#40;Options&#91;"UCI_Elo"&#93;.value<int>() <= 1949&#41;
	  &#123;
	      SkillLevel = ((&#40;Options&#91;"UCI_Elo"&#93;.value<int>())/50&#41; - 19&#41;;
	  &#125;
	  else SkillLevel = 20; // Reset SkillLevel in UCI_LimitStrength mode
  &#125;
and:

Code: Select all

	     // limit nps
	     int t = current_search_time&#40;)+1;
	     int npslimit;

         if (&#40;Options&#91;"UCI_LimitStrength"&#93;.value<bool>()) == true&#41;
	     &#123;
	         if &#40;depth <=4&#41; &#123; nodes = 0;&#125;
		     if &#40;Options&#91;"UCI_Elo"&#93;.value<int>() >= 1950&#41;
	         &#123;
	            npslimit = 500*pow&#40;int&#40;2&#41;,float&#40;Options&#91;"UCI_Elo"&#93;.value<int>()-1950&#41;/110&#41;;
	         &#125;
		     else npslimit = 1750; // nps limit for all SkillLevels below 1950 ELO

		     while ( !StopRequest && ( nodes * 1000 / &#40;t&#41;) > npslimit )
	         &#123;
	            t = current_search_time&#40;)+1;
		        poll &#40;pos&#41;;
			    Sleep &#40;10&#41;;
		     &#125;	 
	      &#125;
And of course:

Code: Select all

  o&#91;"UCI_LimitStrength"&#93; = UCIOption&#40;false&#41;;
  o&#91;"UCI_Elo"&#93; = UCIOption&#40;2000, 1000, 2800&#41;;
stevenaaus wrote:I wonder if no-one simply has approximations of the skill levels as ELO.
They are meant to be CPU indendpendent i think.
I don't think so. They simply used the MultiPV feature to chose bad moves. With higher nps they still calculate deeper.

My estimation is that SkillLevel 19 is 150 ELO weaker than SkillLevel 20.

Alex