How to reduce playing strenght to play against humans

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

How to reduce playing strenght to play against humans

Post by Kempelen »

Last week I have been trying to implement a feature in my engine to let me weaken its strength, so I can play with it with more fun. I have tried a few ideas. Mainly I have weaken the eval and the search. In the eval I have not many problem but when weakening the search I don’t get my engine to have tactical blunders. I prune some moves based on skill level and how much the move is a kind of blunder. The prune runs ok but the search continue searching and get always pv which are not the best, but good enough. It looks like making a blunder here and there is not enough.

Any ideas how to accomplish this?

thanks
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
Aaron Becker
Posts: 292
Joined: Tue Jul 07, 2009 4:56 am

Re: How to reduce playing strenght to play against humans

Post by Aaron Becker »

Tord started an interesting thread on this subject some time ago: http://talkchess.com/forum/viewtopic.php?t=21264
LiquidNitrogenOverclocker

Re: How to reduce playing strenght to play against humans

Post by LiquidNitrogenOverclocker »

Kempelen wrote:
Any ideas how to accomplish this?
Edit Board -> Delete Queen's Knight

:)
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: How to reduce playing strenght to play against humans

Post by Kempelen »

Aaron Becker wrote:Tord started an interesting thread on this subject some time ago: http://talkchess.com/forum/viewtopic.php?t=21264
I read it and also look into Glaurung code, and I did not see any adjust elo or skill feature, which let me to conclude Tord did not get anything.
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: How to reduce playing strenght to play against humans

Post by bob »

Kempelen wrote:
Aaron Becker wrote:Tord started an interesting thread on this subject some time ago: http://talkchess.com/forum/viewtopic.php?t=21264
I read it and also look into Glaurung code, and I did not see any adjust elo or skill feature, which let me to conclude Tord did not get anything.
Look at crafty, search for SKILL in the source, it works, and works well...
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: How to reduce playing strenght to play against humans

Post by Kempelen »

bob wrote:
Kempelen wrote:
Aaron Becker wrote:Tord started an interesting thread on this subject some time ago: http://talkchess.com/forum/viewtopic.php?t=21264
I read it and also look into Glaurung code, and I did not see any adjust elo or skill feature, which let me to conclude Tord did not get anything.
Look at crafty, search for SKILL in the source, it works, and works well...
Thanks Bob. Now I have looked into code and have a doubt. In option.c is this code for skill option:

Code: Select all

      null_depth = null_depth * skill / 100;
      check_depth = check_depth * skill / 100;
      LMR_depth = LMR_depth * skill / 100;
This look OK, but initial values are:

Code: Select all

int check_depth = 1;
int null_depth = 3;               /* R=3 */
int LMR_depth = 1;                /* reduce 1 ply */
It looks due to divisions (of 1 value) like skill is all or nothing for tactics instead of a value adjustable of skill. isn't it? This sounds like tactics is only weaken if skill<100 which is idem for skill levels.
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: How to reduce playing strenght to play against humans

Post by bob »

Kempelen wrote:
bob wrote:
Kempelen wrote:
Aaron Becker wrote:Tord started an interesting thread on this subject some time ago: http://talkchess.com/forum/viewtopic.php?t=21264
I read it and also look into Glaurung code, and I did not see any adjust elo or skill feature, which let me to conclude Tord did not get anything.
Look at crafty, search for SKILL in the source, it works, and works well...
Thanks Bob. Now I have looked into code and have a doubt. In option.c is this code for skill option:

Code: Select all

      null_depth = null_depth * skill / 100;
      check_depth = check_depth * skill / 100;
      LMR_depth = LMR_depth * skill / 100;
This look OK, but initial values are:

Code: Select all

int check_depth = 1;
int null_depth = 3;               /* R=3 */
int LMR_depth = 1;                /* reduce 1 ply */
It looks due to divisions (of 1 value) like skill is all or nothing for tactics instead of a value adjustable of skill. isn't it? This sounds like tactics is only weaken if skill<100 which is idem for skill levels.
You can actually leave that out and just do the eval changes. That breaks the eval up into two components. Part 1 is normal score. Part 2 is a pure random value. The "skill" setting varies how much each contributes to the final score. Skill 100 says 100% eval, 0% random. Skill 50 says 50% of final score is normal score, 50% is pure random.

I chose to tone down the tactics as well. And you are right, any skill < 100 does disable check extensions and LMR reductions. But null-move will still be working. The random component of the evaluation is really good enough for this weakening without bothering with the tactical part at all.
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: How to reduce playing strenght to play against humans

Post by Kempelen »

bob wrote:
Kempelen wrote:
bob wrote:
Kempelen wrote:
Aaron Becker wrote:Tord started an interesting thread on this subject some time ago: http://talkchess.com/forum/viewtopic.php?t=21264
I read it and also look into Glaurung code, and I did not see any adjust elo or skill feature, which let me to conclude Tord did not get anything.
Look at crafty, search for SKILL in the source, it works, and works well...
Thanks Bob. Now I have looked into code and have a doubt. In option.c is this code for skill option:

Code: Select all

      null_depth = null_depth * skill / 100;
      check_depth = check_depth * skill / 100;
      LMR_depth = LMR_depth * skill / 100;
This look OK, but initial values are:

Code: Select all

int check_depth = 1;
int null_depth = 3;               /* R=3 */
int LMR_depth = 1;                /* reduce 1 ply */
It looks due to divisions (of 1 value) like skill is all or nothing for tactics instead of a value adjustable of skill. isn't it? This sounds like tactics is only weaken if skill<100 which is idem for skill levels.
You can actually leave that out and just do the eval changes. That breaks the eval up into two components. Part 1 is normal score. Part 2 is a pure random value. The "skill" setting varies how much each contributes to the final score. Skill 100 says 100% eval, 0% random. Skill 50 says 50% of final score is normal score, 50% is pure random.

I chose to tone down the tactics as well. And you are right, any skill < 100 does disable check extensions and LMR reductions. But null-move will still be working. The random component of the evaluation is really good enough for this weakening without bothering with the tactical part at all.
Thanks again. I have been playing a few games against Crafty lowering the skill, and it is certainly very good, quite a realistic human like game.
I will tried in my engine.....
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: How to reduce playing strenght to play against humans

Post by bob »

Kempelen wrote:
bob wrote:
Kempelen wrote:
bob wrote:
Kempelen wrote:
Aaron Becker wrote:Tord started an interesting thread on this subject some time ago: http://talkchess.com/forum/viewtopic.php?t=21264
I read it and also look into Glaurung code, and I did not see any adjust elo or skill feature, which let me to conclude Tord did not get anything.
Look at crafty, search for SKILL in the source, it works, and works well...
Thanks Bob. Now I have looked into code and have a doubt. In option.c is this code for skill option:

Code: Select all

      null_depth = null_depth * skill / 100;
      check_depth = check_depth * skill / 100;
      LMR_depth = LMR_depth * skill / 100;
This look OK, but initial values are:

Code: Select all

int check_depth = 1;
int null_depth = 3;               /* R=3 */
int LMR_depth = 1;                /* reduce 1 ply */
It looks due to divisions (of 1 value) like skill is all or nothing for tactics instead of a value adjustable of skill. isn't it? This sounds like tactics is only weaken if skill<100 which is idem for skill levels.
You can actually leave that out and just do the eval changes. That breaks the eval up into two components. Part 1 is normal score. Part 2 is a pure random value. The "skill" setting varies how much each contributes to the final score. Skill 100 says 100% eval, 0% random. Skill 50 says 50% of final score is normal score, 50% is pure random.

I chose to tone down the tactics as well. And you are right, any skill < 100 does disable check extensions and LMR reductions. But null-move will still be working. The random component of the evaluation is really good enough for this weakening without bothering with the tactical part at all.
Thanks again. I have been playing a few games against Crafty lowering the skill, and it is certainly very good, quite a realistic human like game.
I will tried in my engine.....
That was the intent. If you just lobotomize the search, the program doesn't feel "natural" in that it still has a ton of positional knowledge that a low-rated player won't have (passed pawns, candidates, pawn weaknesses, king safety, etc. If you lobotomize the eval, and keep the search, you get a tactical genius that will still beat most weaker players. By introducing the random factor into the eval, it still takes the normal amount of time to move, and does some pretty deep searches, but since the eval numbers are more random as you lower the skill setting, it is searching toward endpoints that don't represent really good chess. however, a purely random eval still plays somewhat decently, hence my decision to also weaken the search at the same time. It made more sense when I was using fractional plies, but I removed that a while back.