Difference between revisions of "Sliding Piece Attacks"

From Chessprogramming wiki
Jump to: navigation, search
Line 85: Line 85:
 
* [http://www.open-aurec.com/wbforum/viewtopic.php?f=4&t=51996 Low memory usage attack bitboard generation] by crystalclear, [[Computer Chess Forums|Winboard Forum]], October 06, 2011
 
* [http://www.open-aurec.com/wbforum/viewtopic.php?f=4&t=51996 Low memory usage attack bitboard generation] by crystalclear, [[Computer Chess Forums|Winboard Forum]], October 06, 2011
 
* [http://www.talkchess.com/forum/viewtopic.php?p=446380 Re: Bitboard implementation, how much time?] by [[Michael Hoffmann]], [[CCC]], January 26, 2012
 
* [http://www.talkchess.com/forum/viewtopic.php?p=446380 Re: Bitboard implementation, how much time?] by [[Michael Hoffmann]], [[CCC]], January 26, 2012
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=49562 Simplest bitboard attack generation] by [[Russell Reagan]], [[CCC]], October 03, 2013
 
* [http://www.talkchess.com/forum/viewtopic.php?t=49611 152k rook and bishop attacks using PEXT and PDEP] by [[Lasse Hansen]], [[CCC]], October 06, 2013 » [[BMI2]]
 
* [http://www.talkchess.com/forum/viewtopic.php?t=49611 152k rook and bishop attacks using PEXT and PDEP] by [[Lasse Hansen]], [[CCC]], October 06, 2013 » [[BMI2]]
 
==2015 ...==
 
==2015 ...==

Revision as of 09:40, 9 April 2020

Home * Board Representation * Bitboards * Sliding Piece Attacks

Carina Jørgensen, Queen's Star [1]

This is basically about how to calculate attack-sets of sliding pieces for evaluation and move-generation purposes. While the attack-sets of pawn, king and knight are only dependent on their origin square, sliding pieces like rook, bishop or queen have to consider occupancy, as pieces may block the attack-ray in one particular direction.

Move targets

Move target sets from attack-sets require intersection

Single Sliding Piece Attacks

The single sliding piece, a rook, bishop or queen is determined by square index, likely from a bitscan of a piece-wise bitboard serialization of a sliding piece bitboard from a standard board-definition.

On an empty Board

Sliding piece attack sets or their disjoint subsets on lines or rays on an otherwise empty board are that simple than none sliding pieces. They are often base of further attack calculations.

Tinker's Approach

Brian Richardson proposed a move generation approach as used in Tinker based on rook or bishop attacks on the otherwise empty board [2]. While serializing all potential targets, he tests for legality inside the loop body, that is whether the inbetween squares of origin and target are empty. This is not in the "real" bitboard spirit to determine attack sets in advance rather than to test individual elements of a superset belonging to a set, but at least it allows traversing disjoint target sets i.e. for captures in quiescence search.

By Calculation

Some bit-twiddling ray-wise and line-wise approaches, unfortunately not always for all directions.

Bitfoot - A/B Bitboards

By Occupancy Lookup

Covering line-attacks in one run, magic bitboards even covers rook- and bishop-attacks in one run.

Sliding Piece Attacks in OliThink
BMI2 - PEXT Bitboards
SISSY Bitboards

Miscellaneous

Multiple Sliding Pieces

For bitsets with multiple sliding pieces one can apply a fill algorithm in each of the eight ray-directions to determine attacks. Since we keep disjoint directions, there is still a unique 1:1 relation from each bit of the target set to it's source square. This approach is great to determine target sets we may reach in two or more moves. One may use the union of rooks and queen(s), respectively bishops or queen(s) though.

AVX2 Dumb7Fill

If applied for move generation we better traverse directions rather than sliding pieces. Naturally this approach becomes less efficient, the less sliders are processed in parallel. Of course, one should avoid processing empty sets.

See also

Forum Posts

1999

2000 ...

2005 ...

Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits by Harald Lüßen, CCC, August 24, 2007

2010 ...

2015 ...

2020 ...

External Links

References

Up one Level