Page 1 of 1

King Safety area

Posted: Fri Jun 18, 2010 11:36 pm
by vladstamate
Hi all,

I am retouching a bit the king safety area for my engine. This is the area that is inspected for enemy attacks and own defenses. It is a small area around the king.

Until now I had a 3x3 square area around the king. But I changed that slightly so that if the king is in a castled position, I take the 3 squares in the rank of the king and 3 squares ahead, and 3 squares ahead again. So for example for a White king castled short the king safety area is:

00000000
00000000
00000000
00000000
00000000
00000111
00000111
00000111

So f1, g1, h1, f2, g2, h2, f3, g3, and h3.

Similar for the other castled positions. If the King is not castled then I use the old 3x3 area around the king.

Is this correct? Can there be a better area that I can look at? What areas other engines use?

Regards,
Vlad.

Re: King Safety area

Posted: Sat Jun 19, 2010 5:38 am
by Pawel Koziol
Stockfish uses 3x3 area, Rebel uses area sumilar to Yours, only the additional squares have different weights and are subject to some additional conditions. In Glass, which is no good exmple, we use algorithm almost like Yours. "Almost" means adding a couple of squares on "f" file when the king is on h1.