Approaches to king safety?

Discussion of chess software programming and technical issues.

Moderator: Ras

Uri Blass
Posts: 11179
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Approaches to king safety?

Post by Uri Blass »

kbhearn wrote:Was thinking about this some this morning - there's not a really a lot of good examples where your defense is ok because of a piece - theres' the N on f8 when the obvious attack is on h7

knights are clearly good defendors.

See the following position from my last tournament game(I won with black):

[d]3n2k1/p2n1pp1/1p2p3/3pP1N1/1P1P4/P2Q3P/3N1PK1/2q5 b - - 0 28

Nf8 is good for black and the second knight defends f7
black is better.

Compare with the following position

[d]6k1/p1n2pp1/np2p3/3pP1N1/1P1P4/P2Q3P/3N1PK1/2q5 b - - 0 28

black is losing

or even the following position

[d]6k1/p1n2pp1/npq1p3/3pP1N1/1P1P4/P2Q3P/3N1PK1/8 b - - 0 28

white probably has enough advantage to win the game.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Approaches to king safety?

Post by Don »

Uri Blass wrote:
kbhearn wrote:Was thinking about this some this morning - there's not a really a lot of good examples where your defense is ok because of a piece - theres' the N on f8 when the obvious attack is on h7

knights are clearly good defendors.
Nobody disputes that pieces can defend against attacks. The problem is how to code this up in a way that does more good than damage. Since the principle of defending is a good principle I know that it CAN be coded into an evaluation function, I just have not found a reliably way to do it. As has been pointed out here there are a lot of considerations that make it less than perfectly straightforward.

Of course you can also show a position where a really simply rule can help but you have to prove that the rule is general and correct enough to make the program stronger. Having a bunch of pieces clustered around your king does not indicate that you have a good position, even if they are knights, otherwise Ne2 would always be a better move than Nf3.

I think you have a point about knights. We know that pawn shelter is a very good thing successfully used in all strong chess programs, so I suspect that the higher valued pieces are poor defenders and the lower valued pieces are the best defenders (probably because high valued pieces have to think twice about moving to squares defended by the low valued pieces.)

See the following position from my last tournament game(I won with black):

[d]3n2k1/p2n1pp1/1p2p3/3pP1N1/1P1P4/P2Q3P/3N1PK1/2q5 b - - 0 28

Nf8 is good for black and the second knight defends f7
black is better.

Compare with the following position

[d]6k1/p1n2pp1/np2p3/3pP1N1/1P1P4/P2Q3P/3N1PK1/2q5 b - - 0 28

black is losing

or even the following position

[d]6k1/p1n2pp1/npq1p3/3pP1N1/1P1P4/P2Q3P/3N1PK1/8 b - - 0 28

white probably has enough advantage to win the game.
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: Approaches to king safety?

Post by BubbaTough »

I have fiddled with controlled squares near king, and/or pieces in the area, and never got an objective improvement using it. I tried solutions that are independent, and also ones that interact with non-linear features such as pawn shelter, and overall king attack scores. It seems obvious that there must be a good solution, but I never found it.

-Sam