About king safety

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: About king safety

Post by Ferdy »

Kempelen wrote:The more I experiment, the more problems I see. I dont know others, but a fat score with king safety routine can make lazy eval to be wrong many times. The only solution I see is to increase LE margin to not be wrong, but doing so you loose the strong point of doing LE.
How other has solve this?
Do you mean to say that you will not welcome new features because the power of your LE will diminish?

I would suggest to develop 2 programs, one with LE and the other without. Let's see which one is better after 3 years of development.

I no longer practice LE, but one observation I had was it is not always good to do LE even if you control the margin. There are certain positions that LE will not work. Some conditions have to be used (aside from the margin) before using LE. For example if last move of opp is a capture or promote move or a threat move pxN. You can also use the info you gather from search as a criteria.
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: About king safety

Post by Kempelen »

Ferdy wrote:
Do you mean to say that you will not welcome new features because the power of your LE will diminish?
No. I say one must be carefully when tunning LE as king safety can have big evaluations that your LE avoid, so you can miss winning/lossed positions easily. Maybe a big margin or not using LE in certain conditions, as you said, could be a good idea.
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: About king safety

Post by Don »

Kempelen wrote:Hi,

Rodin has a primitive king safety routine with tropism, number of attacker, a scale factor and a trigger when there are enought material to do mate. I based it at first in a few ideas I see in simple programs like CPW or TSCP. It has been working well, altought it is not perfect. I see now I need a better one. i.e. it does not look at squares above the pawn shield (King_file + 2), or it does not count other features. During last month I have noted this could be a improvement area because at the strenght of Rodin it looses many games because an improper king safety eval.

So far I have developed two or three systems to try, in original and creative ways, where I have included new features like holes, defending pieces, pawn storm and so on. I have made one like the Rebel method of table[] and defects & attacks counter, and also another method of apply bonus and malus for each term evaluated. These systems look good at first, they seems very logical, but I have encounter I big problem to tune so many parameters, not only about the eval, but make search to take adventage of the new routine.

Any test I have done with those algorithms and probes changing values lead to a decrease of near 100 ELO points after 400/500 games played.

My problem so looks in how to make all (value, routines and search) work together. This is not like evaluating a typical eval term where you only change a value and test it, because king safety is a sum of various eval terms which need to work together. I see the part of finding the exact king safety eval terms is very difficult.

This post is asking for help, about how other has dealed with this issue, opinions or tips. I have read other' source code and all they look to me very difficul to tune (i.e. crafty or stockfish). Also there are not two routines the same. All engines seem to have its own and original routine, - which is a good thing :). -

I think a good king safety is a need for having a strong engine. Any tip or advice in how to improve my king safety would be much appreciate.

Thanks.
Fermín
A word of caution, something I noticed with Komodo and Larry also noticed with Rybka. King safety actually makes the program play weaker until you have some modest depth, then it kicks in with a vengeance if done right. So if you are relying on really fast play to test king safety it might be a mistake. I don't remember where the break even point was, but I think it was something in the 5-7 ply or equivalent time control range.

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

Re: About king safety

Post by Kempelen »

Don wrote: A word of caution, something I noticed with Komodo and Larry also noticed with Rybka. King safety actually makes the program play weaker until you have some modest depth, then it kicks in with a vengeance if done right. So if you are relying on really fast play to test king safety it might be a mistake. I don't remember where the break even point was, but I think it was something in the 5-7 ply or equivalent time control range.

Don
Hello Don,

Thank you very much for your advise. In fact I was suspecting that because any change I made in king safety looked like it was nothing new. In fast game seems it is more important to recognize when the attack is coming (maybe tropism) that the attack itself.

Fermin
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
User avatar
marcelk
Posts: 348
Joined: Sat Feb 27, 2010 12:21 am

Re: About king safety

Post by marcelk »

Kempelen wrote:The more I experiment, the more problems I see. I dont know others, but a fat score with king safety routine can make lazy eval to be wrong many times. The only solution I see is to increase LE margin to not be wrong, but doing so you loose the strong point of doing LE.
How other has solve this?
In my current engine I have put the big terms of king safety in the fast part of lazy eval. And after parameter tuning I also dropped one of the two early-exit points, causing overall eval to become slower but much better compared to the old program. In the end node speed is third behind good eval and effective search.