Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: No ! Fischer is (nt)

Author: Dann Corbit

Date: 13:26:23 11/18/03

Go up one level in this thread


On November 18, 2003 at 15:47:39, Tord Romstad wrote:

>On November 18, 2003 at 15:27:22, Dann Corbit wrote:
>
>>You have an array that lists count of attacks by type for each square on the
>>board.
>>
>>From this, you know if any square is "won, equal or lost" and by which side.
>>
>>You also know (for instance) if it is safe to put a pawn on a square but not a
>>knight.  Instantly.
>>
>>It's also very nice for move ordering.
>
>It is also tremendously useful when making forward pruning, extension and
>reduction decisions, when deciding which moves to include in the qsearch,
>when deciding whether or not to do a null move search, in the evaluation
>function, for static mate detection, and probably a bunch of other
>purposes I either don't remember at the moment or haven't thought of
>yet.
>
>If I only knew how to make it all work without big lookup tables ...
>

I don't know of you use bitmaps, but they come into play very nicely for this.

I keep track of not only all the attacks, but also pinned pieces and shadow
attacks of empty squares.

For any ray on the board, there are at most 256 distinct patterns.  Since a
piece is sitting somewhere on the ray, that leaves 128.  So now, we consider a
sample ray:


+-+-+-+-+-+-+-+-+
|o|O|a|M|a|a|F|s|
+-+-+-+-+-+-+-+-+
'M' is some piece that can attack along a ray.
The blank squares under direct fire are attacked 'a'
The Friendly piece F is defended
The Opponent piece O is attacked
The opponent piece o is shadow attacked (putting a pin on O)
Bitmaps:

+-+-+-+-+-+-+-+-+
|o|O|a|M|a|a|F|s|
+-+-+-+-+-+-+-+-+

+-+-+-+-+-+-+-+-+
| | |x| |x|x| | | attacked empty squares
+-+-+-+-+-+-+-+-+

+-+-+-+-+-+-+-+-+
| |A| | | | | | | attacked enemy pieces
+-+-+-+-+-+-+-+-+

+-+-+-+-+-+-+-+-+
| |A| | | | | | | pinned enemy pieces (pin type depends on what 'a' is)
+-+-+-+-+-+-+-+-+

+-+-+-+-+-+-+-+-+
|a| | | | | | | | shadow attacked enemy pieces
+-+-+-+-+-+-+-+-+

+-+-+-+-+-+-+-+-+
| | | | | | |F| | defended friendly pieces
+-+-+-+-+-+-+-+-+

+-+-+-+-+-+-+-+-+
| | | | | | | |s| shadowed squares
+-+-+-+-+-+-+-+-+


Now, for every pattern of bits on a ray (at most 128 in all) each set like the
above is unique.

So you precompute everything and it becomes a simple table lookup.

The function can also contain the complete move list!  Given the data for counts
of attacks, etc. you can even do some good move ordering stuff.






This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.