# Computer Chess Club Archives

## Messages

### Subject: Re: Static evaluation after the "Positional/Real Sacrifice"

Author: Dusan Dobes

Date: 14:25:05 12/03/99

Go up one level in this thread

```On December 03, 1999 at 13:23:04, Vincent Diepeveen wrote:
>On December 03, 1999 at 10:15:58, Robert Hyatt wrote:
>>On December 03, 1999 at 09:21:29, Ulrich Tuerke wrote:
>>>On December 03, 1999 at 09:13:48, Dusan Dobes wrote:
>>>>On December 03, 1999 at 08:49:19, Andrew Williams wrote:
>>>>>
>>>>>r3q1k1/ppp1rp2/2n1b2Q/8/2P5/3B4/PPP2RPP/5RK1 b - - 0 2
>>>>
>>>>Phalanx XXI static evaluation scores this position as +3.05 for white.
>>>>Material gives -1.5, black king safety +5.76.
>>>
>>>You say that this large value is given without search and without static
>>>exchange evaluation. I think that this is a very daring evaluation. Isn't it ?
>>>
>>>Uli
>>
>>I don't think "daring" is the word for it.  :)
>
>I've heart past years a good term for it by Frans Morsch: "anti-kasparov"

I'm just looking into my king safety code. Well, it's quite
difficult to read even for me :).

This is how i compute the king safety:

1) Count number of attacks to squares where the king can move.
Add an extra point for every attacked and undefended square.
Add extra two points for every undefended square that is
attacked with queen and one more piece (=possibility of
close and safe check by queen)

2) Count number of safe checks available (an idea from gnuchess!).
Safe = the checking piece must be on a square that is not attacked
by enemy piece (excepting king, where the check may be also safe
if the checking piece is protected). Multiply this number 2x.

3) Some points can be removed from the "king danger value" for pawns
near friendly king or for certain pawns+bishop configurations
(e.g. fianchetto or Bf1+Pf2+Kg1)

Take the resulting number (N), and if it is greater than 1,
add N*N*4 to total static evaluation (with appropriate value sign,
of course). This can give huge values, often more than a piece.

I have never seen Phalanx losing due to incorrect sacrifice
for mating attack. Note that it never wants to try incorrect
sacrifice in 'bishop for 2 pawns' examples posted here. I have
seen many nice wins with this evaluation.

The main problem with this code is speed. But it really makes
the playing style much more interesting.

Dusan

```