<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"  xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:access="http://www.bloglines.com/about/specs/fac-1.0">
  <access:restriction relationship="allow" />
  <channel>
    <title>Wikispaces : chessprogramming - items matching description</title>
    <link>https://chessprogramming.wikispaces.com/space/view</link>
    <description>Filtered items at Wikispaces : chessprogramming</description>
    
    <webMaster>help@wikispaces.com (Wikispaces)</webMaster>
    <generator>https://www.wikispaces.com/</generator>
    <ttl>60</ttl>
    <atom:link href="https://chessprogramming.wikispaces.com/space/xmlo?v=rss_2_0" rel="self" type="application/rss+xml" />
    <image>
      <title>Wikispaces : chessprogramming - items matching description</title>
      <url>https://www.wikispaces.com/i/l.png</url>
      <link>https://chessprogramming.wikispaces.com/space/view</link>
      <width>140</width>
      <height>48</height>
      <description>Wikispaces</description>
    </image>

    <item>
      <title>Attack and Defend Maps</title>
      <link>https://chessprogramming.wikispaces.com/Attack+and+Defend+Maps</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Attack+and+Defend+Maps</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Attack+and+Defend+Maps</comments>
      <pubDate>Sat, 05 Nov 2016 09:18:44 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Programming&quot;&gt;Programming&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Data&quot;&gt;Data&lt;/a&gt; * Attack and Defend Maps&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:149:&amp;lt;a href=&amp;quot;http://www.puckergallery.com/artists/bak_chess/bak_chess_all.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/ShelteringMyths.jpg/157857425/309x238/ShelteringMyths.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;height: 238px; width: 309px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://www.puckergallery.com/artists/bak_chess/bak_chess_all.html&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/ShelteringMyths.jpg/157857425/309x238/ShelteringMyths.jpg&quot; alt=&quot;ShelteringMyths.jpg&quot; title=&quot;ShelteringMyths.jpg&quot; style=&quot;height: 238px; width: 309px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:149 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;&lt;strong&gt;Attack and Defend Maps&lt;/strong&gt;,&lt;br /&gt;
also called &lt;strong&gt;Attack Tables&lt;/strong&gt;, refer to data-structures, most often &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;arrays&lt;/a&gt;, containing attack or defend information for every pawn or piece and/or the transposed information for each square, which pieces &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Control&quot;&gt;control&lt;/a&gt;, that is either attack or defend it. These Maps are useful for &lt;a class=&quot;wiki_link&quot; href=&quot;/Evaluation&quot;&gt;evaluation&lt;/a&gt; purposes such as safe &lt;a class=&quot;wiki_link&quot; href=&quot;/Mobility&quot;&gt;mobility&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Static%20Exchange%20Evaluation&quot;&gt;SEE&lt;/a&gt; and of course &lt;a class=&quot;wiki_link&quot; href=&quot;/Move%20Generation&quot;&gt;move generation&lt;/a&gt;. While the piece centric attack information, a set of attacked squares per piece, is often encoded as &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;bitboard&lt;/a&gt;, there are more alternatives for storing the square centric information, about attacking pieces.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#Bak&quot;&gt;Samuel Bak&lt;/a&gt; - Sheltering Myths, 1998 &lt;!-- ws:start:WikiTextRefRule:5:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.puckergallery.com/artists/bak_chess/bak_chess_all.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;The Game of War&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.puckergallery.com/artists/bak_index/bak_publications.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Samuel Bak - represented by Pucker Gallery since 1969&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:5 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:71:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:71 --&gt;&lt;!-- ws:start:WikiTextTocRule:72: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Maintaining Attacks&quot;&gt;Maintaining Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:72 --&gt;&lt;!-- ws:start:WikiTextTocRule:73: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Maintaining Attacks-Incremental Update&quot;&gt;Incremental Update&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:73 --&gt;&lt;!-- ws:start:WikiTextTocRule:74: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Maintaining Attacks-On the Fly&quot;&gt;On the Fly&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:74 --&gt;&lt;!-- ws:start:WikiTextTocRule:75: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Implementations&quot;&gt;Implementations&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:75 --&gt;&lt;!-- ws:start:WikiTextTocRule:76: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Classical Approach&quot;&gt;Classical Approach&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:76 --&gt;&lt;!-- ws:start:WikiTextTocRule:77: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Alternatives&quot;&gt;Alternatives&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:77 --&gt;&lt;!-- ws:start:WikiTextTocRule:78: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Implementations-Alternatives-Piece-Sets&quot;&gt;Piece-Sets&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:78 --&gt;&lt;!-- ws:start:WikiTextTocRule:79: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Implementations-Alternatives-Ed&#039;s lookup&quot;&gt;Ed&#039;s lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:79 --&gt;&lt;!-- ws:start:WikiTextTocRule:80: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Implementations-Alternatives-Direction wise&quot;&gt;Direction wise&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:80 --&gt;&lt;!-- ws:start:WikiTextTocRule:81: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:81 --&gt;&lt;!-- ws:start:WikiTextTocRule:82: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forums Posts&quot;&gt;Forums Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:82 --&gt;&lt;!-- ws:start:WikiTextTocRule:83: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forums Posts-1995 ...&quot;&gt;1995 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:83 --&gt;&lt;!-- ws:start:WikiTextTocRule:84: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forums Posts-2000 ...&quot;&gt;2000 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:84 --&gt;&lt;!-- ws:start:WikiTextTocRule:85: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forums Posts-2005 ...&quot;&gt;2005 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:85 --&gt;&lt;!-- ws:start:WikiTextTocRule:86: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forums Posts-2010 ...&quot;&gt;2010 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:86 --&gt;&lt;!-- ws:start:WikiTextTocRule:87: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:87 --&gt;&lt;!-- ws:start:WikiTextTocRule:88: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:88 --&gt;&lt;!-- ws:start:WikiTextTocRule:89: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:89 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:37:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Maintaining Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:37 --&gt;Maintaining Attacks&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextHeadingRule:39:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Maintaining Attacks-Incremental Update&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:39 --&gt;Incremental Update&lt;/h2&gt;
 The piece centric and/or square centric information is often initialized at the &lt;a class=&quot;wiki_link&quot; href=&quot;/Root&quot;&gt;root&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Incremental%20Updates&quot;&gt;updated incrementally&lt;/a&gt; during the &lt;a class=&quot;wiki_link&quot; href=&quot;/Search&quot;&gt;search&lt;/a&gt; while &lt;a class=&quot;wiki_link&quot; href=&quot;/Make%20Move&quot;&gt;making&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Unmake%20Move&quot;&gt;unmaking&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Moves&quot;&gt;moves&lt;/a&gt;. The idea is that a move has often only a local influence on the attack tables, and that it is usually cheaper to change only those squares which changed from- or to-attacks, rather than all squares from scratch. This is especially true during the &lt;a class=&quot;wiki_link&quot; href=&quot;/Opening&quot;&gt;opening&lt;/a&gt; or early &lt;a class=&quot;wiki_link&quot; href=&quot;/Middlegame&quot;&gt;middlegame&lt;/a&gt; phase, but does become more expensive in the late middlegame or &lt;a class=&quot;wiki_link&quot; href=&quot;/Endgame&quot;&gt;endings&lt;/a&gt; with sliding pieces, especially queens.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:41:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Maintaining Attacks-On the Fly&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:41 --&gt;On the Fly&lt;/h2&gt;
 Programmers like &lt;a class=&quot;wiki_link&quot; href=&quot;/Jo%C3%ABl%20Rivat&quot;&gt;Joël Rivat&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:9:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/71f7b5ee3764f082&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Chess programming using bitboards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Jo%C3%ABl%20Rivat&amp;quot;&amp;gt;Joël Rivat&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;rgcc&amp;lt;/a&amp;gt;, August 18, 1995&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:9 --&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:15:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/33c57503391f3a89&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Speed of Move Generator&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Valavan%20Manohararajah&amp;quot;&amp;gt;Valavan Manohararajah&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;rgcc&amp;lt;/a&amp;gt;, August 15, 1995, post 5 by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Robert%20Hyatt&amp;quot;&amp;gt;Robert Hyatt&amp;lt;/a&amp;gt; where he mentions on the fly generation with &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Rotated%20Bitboards&amp;quot;&amp;gt;rotated bitboards&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:15 --&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Ed%20Schroder&quot;&gt;Ed Schröder&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt; avoid or have abandoned incrementally updated attack tables and rely on the paradigm to process information if needed. A lot of nodes don&#039;t need the attack information at all, or only a small part of it. With all the &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table&quot;&gt;hash tables&lt;/a&gt;, incremental update tends to do some unnecessary work, considering the update costs in &amp;quot;worst case&amp;quot; positions, f.i. queen endings, where one move change the attack information of many squares.&lt;br /&gt;
&lt;br /&gt;
On the other hand, if attack tables are available, one should utilize the information as much as possible for a smarter search and evaluation to gain exponentially. Anyway, one has to be careful with too complicated data structures and update code.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:43:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Implementations&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:43 --&gt;Implementations&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextHeadingRule:45:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Implementations-Classical Approach&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:45 --&gt;Classical Approach&lt;/h2&gt;
 The square centric classical approach with bitboards was used in &lt;a class=&quot;wiki_link&quot; href=&quot;/Chess%20%28Program%29&quot;&gt;Chess 4.5&lt;/a&gt; and descibed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Larry%20Atkin&quot;&gt;Larry Atkin&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/David%20Slate&quot;&gt;David Slate&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:27:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/David%20Slate&amp;quot;&amp;gt;David Slate&amp;lt;/a&amp;gt; and &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Larry%20Atkin&amp;quot;&amp;gt;Larry Atkin&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1977&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;CHESS 4.5 - The Northwestern University Chess Program.&amp;lt;/em&amp;gt; &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Chess%20Skill%20in%20Man%20and%20Machine&amp;quot;&amp;gt;Chess Skill in Man and Machine&amp;lt;/a&amp;gt; (ed. &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Peter%20W.%20Frey&amp;quot;&amp;gt;Peter W. Frey&amp;lt;/a&amp;gt;), pp. 82-118. Springer-Verlag, New York, N.Y. 2nd ed. 1983. ISBN 0-387-90815-3. Reprinted (&amp;lt;strong&amp;gt;1988&amp;lt;/strong&amp;gt;) in &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Compendium&amp;quot;&amp;gt;Computer Chess Compendium&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:27 --&gt; . The incrementally updated attack tables, from which most move generation is done, are called &lt;em&gt;ATKFR&lt;/em&gt; and &lt;em&gt;ATKTO&lt;/em&gt;. &lt;em&gt;ATKFR&lt;/em&gt; is a set of 64 bitboards which give, for each square, all the squares attacked by the piece, if any, that resides on the square. &lt;em&gt;ATKTO&lt;/em&gt; (&lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Attacked%20By&quot;&gt;Square Attacked By&lt;/a&gt;) is the transpose of &lt;em&gt;ATKFR&lt;/em&gt;, giving for each square, the locations of all pieces that attack that square. For instance the square E4 (T) is attacked by a black rook at E8, a black knight at F6, and defended by a white rook at E1 and a white pawn at D3 &lt;!-- ws:start:WikiTextRefRule:30:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.craftychess.com/hyatt/bitmaps.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Rotated bitmaps, a new twist on an old idea&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Robert%20Hyatt&amp;quot;&amp;gt;Robert Hyatt&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:30 --&gt; :&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;attacks_to[E4]&amp;lt;br/&amp;gt; . . . . 1 . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . . 1 . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . T . . .&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . 1 . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;attacks_to[E4]
 . . . . 1 . . .
 . . . . . . . .
 . . . . . 1 . .
 . . . . . . . .
 . . . . T . . .
 . . . 1 . . . .
 . . . . . . . .
 . . . . 1 . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:47:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Implementations-Alternatives&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:47 --&gt;Alternatives&lt;/h2&gt;
 There are several alternatives for keeping the square centric information what pieces attack each particular square.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:49:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Implementations-Alternatives-Piece-Sets&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:49 --&gt;Piece-Sets&lt;/h3&gt;
 A &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Attacked%20By&quot;&gt;Square Attacked By&lt;/a&gt; bitboard aka &lt;em&gt;ATKFR&lt;/em&gt; as possible union-set of multiple pawns and pieces of either side require intersections with piece bitboards, or &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan&quot;&gt;bitscanned&lt;/a&gt; square lookups, to determine which pieces and how many attack or defend.&lt;br /&gt;
&lt;br /&gt;
Based on a fixed piece-type and bit-position relation with usual material dispositions (for each side, no more than one queen, two rooks, one bishop per square color, two knights), 32-bit &lt;a class=&quot;wiki_link&quot; href=&quot;/Piece-Sets&quot;&gt;Piece-Sets&lt;/a&gt; already inherit the information which pieces (and how many of both sides) attack a particular square, one can even imagine a 16-bit lookup inside a 64KByte table to get an denser attack indicator/count byte for each color a lá &lt;a class=&quot;wiki_link&quot; href=&quot;/Attack%20and%20Defend%20Maps#EDsLookup&quot;&gt;Ed Schröder&lt;/a&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/MS-DOS&quot;&gt;MS-DOS&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/IsiChess&quot;&gt;IsiChess&lt;/a&gt; maintained an &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt; of 64 32-bit piece-sets for every square, and an array of up to 32 attack-to bitboards for every piece. However working with piece-sets requires an additional indirection via a &lt;a class=&quot;wiki_link&quot; href=&quot;/Piece-lists&quot;&gt;Piece-list&lt;/a&gt; to get the square of that piece.&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:90:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@EDsLookup&amp;quot; title=&amp;quot;Anchor: EDsLookup&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;EDsLookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:90 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:51:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Implementations-Alternatives-Ed&#039;s lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:51 --&gt;Ed&#039;s lookup&lt;/h3&gt;
 As described by &lt;a class=&quot;wiki_link&quot; href=&quot;/Ed%20Schroder&quot;&gt;Ed Schröder&lt;/a&gt; in &lt;em&gt;Evaluation in REBEL&lt;/em&gt; &lt;!-- ws:start:WikiTextRefRule:35:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.top-5000.nl/authors/rebel/chess840.htm#HW&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Evaluation in REBEL (hanging pieces)&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.top-5000.nl/authors/rebel/chess840.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;How Rebel Plays Chess&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Ed%20Schroder&amp;quot;&amp;gt;Ed Schröder&amp;lt;/a&amp;gt;, also available as &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://members.home.nl/matador/Inside%20Rebel.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;pdf&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-6&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-6&quot;&gt;[6]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:35 --&gt; , &lt;a class=&quot;wiki_link&quot; href=&quot;/Rebel&quot;&gt;Rebel&lt;/a&gt; uses two board tables for both sides, one &lt;a class=&quot;wiki_link&quot; href=&quot;/Byte&quot;&gt;byte&lt;/a&gt; entry each, the three lower bits contain an attack counter, while the five upper bits indicate the presence of least one pawn or piece attacking/defending:&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;br/&amp;gt;| BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7 |&amp;lt;br/&amp;gt;+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;br/&amp;gt;|      Number of     | PAWN |KNIGHT| ROOK | QUEEN| KING |&amp;lt;br/&amp;gt;|      ATTACKERS     |      |BISHOP|      |      |      |&amp;lt;br/&amp;gt;+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;+------+------+------+------+------+------+------+------+
| BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7 |
+------+------+------+------+------+------+------+------+
|      Number of     | PAWN |KNIGHT| ROOK | QUEEN| KING |
|      ATTACKERS     |      |BISHOP|      |      |      |
+------+------+------+------+------+------+------+------+&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;The information might be inaccurate in some cases since it loses some information if multiple pieces of one kind are involved. However, since &lt;a class=&quot;wiki_link&quot; href=&quot;/Static%20Exchange%20Evaluation&quot;&gt;SEE&lt;/a&gt; might be erroneous anyway due to &lt;a class=&quot;wiki_link&quot; href=&quot;/Pin&quot;&gt;pins&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/X-ray&quot;&gt;x-rays&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Overloading&quot;&gt;overloaded pieces&lt;/a&gt;, Ed&#039;s scheme seems sufficient for practical purposes - and it is fast. Each byte (for both sides) can act as index inside pre-calculated three-dimensional table to perform an SEE by looking up a target piece or square, attack- and defend-byte:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;char see_table [14][256][256];   // 14*64 K = 896 KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;see = see_table[Piece][attackByte][defendByte];&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;char see_table [14][256][256];   // 14*64 K = 896 KByte
&amp;nbsp;
see = see_table[Piece][attackByte][defendByte];&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;While the counter might be updated incrementally, the piece indicators as possible union of multiple pieces (i.e. two knights and one bishop) is not that simple to update, thus Ed generates those tables in evaluation on the fly by scanning the pieces of the board.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:53:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Implementations-Alternatives-Direction wise&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:53 --&gt;Direction wise&lt;/h3&gt;
 An other alternative to incremental updated attack tables is motivated by direction wise fill algorithms like &lt;a class=&quot;wiki_link&quot; href=&quot;/Kogge-Stone%20Algorithm&quot;&gt;Kogge-Stone&lt;/a&gt; for sliding pieces, and that one may hide memory latencies from probes of the &lt;a class=&quot;wiki_link&quot; href=&quot;/Transposition%20Table&quot;&gt;transposition table&lt;/a&gt;. Especially &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20Attacks%20%28Bitboards%29&quot;&gt;pawn attacks&lt;/a&gt; are cheap to determine on the fly, and likely reduce the set of capture targets of least valuable pieces defended by pawns, which are otherwise object of &lt;a class=&quot;wiki_link&quot; href=&quot;/Quiescence%20Search&quot;&gt;Quiescence Search&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Static%20Exchange%20Evaluation&quot;&gt;SEE&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:55:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc9&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:55 --&gt;See also&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Piece-Sets&quot;&gt;Piece-Sets&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Attacked%20By&quot;&gt;Square Attacked By&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces%20versus%20Directions&quot;&gt;Pieces versus Directions&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:57:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc10&quot;&gt;&lt;a name=&quot;Forums Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:57 --&gt;Forums Posts&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextHeadingRule:59:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc11&quot;&gt;&lt;a name=&quot;Forums Posts-1995 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:59 --&gt;1995 ...&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/71f7b5ee3764f082&quot; rel=&quot;nofollow&quot;&gt;Chess programming using bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Jo%C3%ABl%20Rivat&quot;&gt;Joël Rivat&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, August 18, 1995&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=30023&quot; rel=&quot;nofollow&quot;&gt;Attack Tables&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Roberto%20Waldteufel&quot;&gt;Roberto Waldteufel&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, October 20, 1998&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:61:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc12&quot;&gt;&lt;a name=&quot;Forums Posts-2000 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:61 --&gt;2000 ...&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=209546&quot; rel=&quot;nofollow&quot;&gt;Counting attacked squares: how?&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Leen%20Ammeraal&quot;&gt;Leen Ammeraal&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 24, 2002&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=260736&quot; rel=&quot;nofollow&quot;&gt;attacks_from[] and attacks_to[] info&lt;/a&gt; by Nagendra Singh Tomar, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, October 21, 2002&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=266390&quot; rel=&quot;nofollow&quot;&gt;Attack tables&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Andreas%20Herrmann&quot;&gt;Andreas Herrmann&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, November 20, 2002&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=363519&quot; rel=&quot;nofollow&quot;&gt;The Zappa Attack Table Code&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Anthony%20Cozzie&quot;&gt;Anthony Cozzie&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, May 05, 2004&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=373246&quot; rel=&quot;nofollow&quot;&gt;bitboards and incrementally updated attack tables&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Eric%20Oldre&quot;&gt;Eric Oldre&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, June 30, 2004&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=171&quot; rel=&quot;nofollow&quot;&gt;Attack table&lt;/a&gt; by Anonymous, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, October 06, 2004&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:63:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc13&quot;&gt;&lt;a name=&quot;Forums Posts-2005 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:63 --&gt;2005 ...&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=1626&quot; rel=&quot;nofollow&quot;&gt;Attack table musings&lt;/a&gt; by GeoffW, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, February 11, 2005&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=20370&quot; rel=&quot;nofollow&quot;&gt;Incremental updating for positional evaluation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steven%20Edwards&quot;&gt;Steven Edwards&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 27, 2008&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=267994&amp;amp;t=27965&quot; rel=&quot;nofollow&quot;&gt;Piece attacks count&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Marco%20Costalba&quot;&gt;Marco Costalba&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, May 18, 2009 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Population%20Count&quot;&gt;Population Count&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:65:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc14&quot;&gt;&lt;a name=&quot;Forums Posts-2010 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:65 --&gt;2010 ...&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=52085&quot; rel=&quot;nofollow&quot;&gt;Incrementally-updated attack map&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Harm%20Geert%20Muller&quot;&gt;Harm Geert Muller&lt;/a&gt;, April 21, 2014 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Incremental%20Updates&quot;&gt;Incremental Updates&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:67:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc15&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:67 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:293:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.puckergallery.com/artists/bak_chess/bak_chess_all.html&quot; rel=&quot;nofollow&quot;&gt;The Game of War&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.puckergallery.com/artists/bak_index/bak_publications.html&quot; rel=&quot;nofollow&quot;&gt;Samuel Bak - represented by Pucker Gallery since 1969&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/71f7b5ee3764f082&quot; rel=&quot;nofollow&quot;&gt;Chess programming using bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Jo%C3%ABl%20Rivat&quot;&gt;Joël Rivat&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, August 18, 1995&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/33c57503391f3a89&quot; rel=&quot;nofollow&quot;&gt;Speed of Move Generator&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Valavan%20Manohararajah&quot;&gt;Valavan Manohararajah&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, August 15, 1995, post 5 by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; where he mentions on the fly generation with &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;rotated bitboards&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/David%20Slate&quot;&gt;David Slate&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Larry%20Atkin&quot;&gt;Larry Atkin&lt;/a&gt; (&lt;strong&gt;1977&lt;/strong&gt;). &lt;em&gt;CHESS 4.5 - The Northwestern University Chess Program.&lt;/em&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Chess%20Skill%20in%20Man%20and%20Machine&quot;&gt;Chess Skill in Man and Machine&lt;/a&gt; (ed. &lt;a class=&quot;wiki_link&quot; href=&quot;/Peter%20W.%20Frey&quot;&gt;Peter W. Frey&lt;/a&gt;), pp. 82-118. Springer-Verlag, New York, N.Y. 2nd ed. 1983. ISBN 0-387-90815-3. Reprinted (&lt;strong&gt;1988&lt;/strong&gt;) in &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Compendium&quot;&gt;Computer Chess Compendium&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.craftychess.com/hyatt/bitmaps.html&quot; rel=&quot;nofollow&quot;&gt;Rotated bitmaps, a new twist on an old idea&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-6&quot;&gt;&lt;a href=&quot;#cite_ref-6&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.top-5000.nl/authors/rebel/chess840.htm#HW&quot; rel=&quot;nofollow&quot;&gt;Evaluation in REBEL (hanging pieces)&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.top-5000.nl/authors/rebel/chess840.htm&quot; rel=&quot;nofollow&quot;&gt;How Rebel Plays Chess&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Ed%20Schroder&quot;&gt;Ed Schröder&lt;/a&gt;, also available as &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://members.home.nl/matador/Inside%20Rebel.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:293 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:69:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc16&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:69 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:03:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Attack and Defend Maps&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;80&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Attack and Defend Maps&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;80&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Attack_and_Defend_Maps includeBody-Attack%20and%20Defend%20Maps includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Andreas+Herrmann&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Andreas Herrmann&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 7, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Arasan&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Arasan&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 8, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Attack+and+Defend+Maps&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Attack and Defend Maps&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bebe&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bebe&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/BlackBishop&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;BlackBishop&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 7, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Board+Representation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Board Representation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 11, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bruja&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bruja&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 3, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/CAPS&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;CAPS&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Check&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Check&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chess+%28Program%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chess (Program)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 22, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chess+0.5&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chess 0.5&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 20, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chest&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chest&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 3, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Combinatorial+Logic&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Combinatorial Logic&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 6, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Constellation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Constellation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 2, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/DanChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;DanChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 17, 2012&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Data&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Data&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Deflection&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Deflection&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 21, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Diablo&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Diablo&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 17, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dorpsgek&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dorpsgek&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 2, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Double+Attack&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Double Attack&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 22, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Encoding+Moves&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Encoding Moves&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Eugen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Eugen&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Eugenio+Castillo+Jim%C3%A9nez&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Eugenio Castillo Jiménez&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Eye+Movements&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Eye Movements&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 22, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Floyd&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Floyd&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 11, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Golch&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Golch&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 7, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gromit&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gromit&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hagrid&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hagrid&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 12, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Horizon&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Horizon&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 17, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Incremental+Updates&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Incremental Updates&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 6, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Interception&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Interception&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 21, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Interference&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Interference&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 20, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Joker+NL&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Joker NL&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 15, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Jos%C3%A9+Carlos+Mart%C3%ADnez+Gal%C3%A1n&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;José Carlos Martínez Galán&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 19, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/King+Safety&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;King Safety&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 14, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/KnightCap&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;KnightCap&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 6, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Legal+Move&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Legal Move&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 16, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/M-20&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;M-20&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 9, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mate+at+a+Glance&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mate at a Glance&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 24, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mediocre&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mediocre&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 27, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/MessChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;MessChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 6, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mikhail+Botvinnik&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mikhail Botvinnik&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 15, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mobility&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mobility&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 17, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Movei&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Movei&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/MVV-LVA&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;MVV-LVA&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Neural+Networks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Neural Networks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 12, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Node+Types&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Node Types&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 22, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Nullmover&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Nullmover&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 21, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Ostrich&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Ostrich&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 28, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Overloading&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Overloading&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pandix&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pandix&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 4, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Patzer&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Patzer&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Perceiver&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Perceiver&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 21, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Peter+Fendrich&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Peter Fendrich&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 19, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Piece-Sets&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Piece-Sets&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 9, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pioneer&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pioneer&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Population+Count&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Population Count&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 3, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/RDChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;RDChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 3, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rookie&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rookie&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SEE+-+The+Swap+Algorithm&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SEE - The Swap Algorithm&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SnailChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SnailChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 26, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Snitch&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Snitch&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SOMA&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SOMA&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 25, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Spartacus&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Spartacus&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 17, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Spector&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Spector&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 11, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Square+Attacked+By&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Square Attacked By&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 20, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Square+Control&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Square Control&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 15, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Static+Exchange+Evaluation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Static Exchange Evaluation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sunsetter&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sunsetter&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tao&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tao&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 8, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Vladimir+Butenko&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Vladimir Butenko&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 12, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Woodpusher&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Woodpusher&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 12, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Zach+Wegner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Zach Wegner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Zappa&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Zappa&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 24, 2017&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:03 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Data&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Blockers and Beyond</title>
      <link>https://chessprogramming.wikispaces.com/Blockers+and+Beyond</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Blockers+and+Beyond</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Blockers+and+Beyond</comments>
      <pubDate>Fri, 21 Mar 2014 11:23:01 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:43:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:43 --&gt;&lt;!-- ws:start:WikiTextTocRule:44: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#How it works&quot;&gt;How it works&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:44 --&gt;&lt;!-- ws:start:WikiTextTocRule:45: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Sample C Source&quot;&gt;Sample C Source&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:45 --&gt;&lt;!-- ws:start:WikiTextTocRule:46: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:46 --&gt;&lt;!-- ws:start:WikiTextTocRule:47: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:47 --&gt;&lt;!-- ws:start:WikiTextTocRule:48: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:48 --&gt;&lt;!-- ws:start:WikiTextTocRule:49: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:49 --&gt;&lt;!-- ws:start:WikiTextTocRule:50: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:50 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Blockers and Beyond&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Blockers and Beyond&lt;/strong&gt;,&lt;br /&gt;
a general bitboard technique to determine not only sliding piece attacks, but also &lt;a class=&quot;wiki_link&quot; href=&quot;/King%20Pattern#KingAttacks&quot;&gt;king&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Knight%20Pattern#KnightAttacks&quot;&gt;knight attacks&lt;/a&gt;. The technique was introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Fabien%20Letouzey&quot;&gt;Fabien Letouzey&lt;/a&gt; within his first release of the &lt;a class=&quot;wiki_link&quot; href=&quot;/Open%20Source%20Engines&quot;&gt;open source engine&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Senpai&quot;&gt;Senpai 1.0&lt;/a&gt; in March 2014 &lt;!-- ws:start:WikiTextRefRule:5:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=51637&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Senpai 1.0 (new engine)&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Fabien%20Letouzey&amp;quot;&amp;gt;Fabien Letouzey&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, March 17, 2014&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:5 --&gt; &lt;!-- ws:start:WikiTextRefRule:8:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.chessprogramming.net/senpai/&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Senpai Chess Engine - Computer Chess Programming&amp;lt;/a&amp;gt; hosted by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Steve%20Maughan&amp;quot;&amp;gt;Steve Maughan&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:8 --&gt;, but already devised in the mid 2000s, and applied in Fabien&#039;s private bitboard engine &lt;a class=&quot;wiki_link&quot; href=&quot;/Chess-64&quot;&gt;Chess-64&lt;/a&gt;  &lt;!-- ws:start:WikiTextRefRule:10:&amp;amp;lt;ref&amp;amp;gt;Personal communication with &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Fabien%20Letouzey&amp;quot;&amp;gt;Fabien Letouzey&amp;lt;/a&amp;gt;, March 20, 2014&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:10 --&gt;. He found it simple and elegant with the endgame in mind &lt;!-- ws:start:WikiTextRefRule:14:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=51637&amp;amp;amp;start=26&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Senpai 1.0 (new engine)&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Fabien%20Letouzey&amp;quot;&amp;gt;Fabien Letouzey&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, March 17, 2014&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:14 --&gt;, and dubbed it &amp;quot;blocker loop&amp;quot;, a term already coined by &lt;a class=&quot;wiki_link&quot; href=&quot;/Fritz%20Reul&quot;&gt;Fritz Reul&lt;/a&gt; in the context of  his  &lt;a class=&quot;wiki_link&quot; href=&quot;/Vector%20Attacks#NewArchitecture&quot;&gt;non bitboard architecture&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:22:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Fritz%20Reul&amp;quot;&amp;gt;Fritz Reul&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;2009&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;New Architectures in Computer Chess&amp;lt;/em&amp;gt;. Ph.D. Thesis, &amp;lt;em&amp;gt;Chapter 2 Non-Bitboard Architectures&amp;lt;/em&amp;gt;.&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:22 --&gt;, thus the editor&#039;s proposal of &amp;quot;Blockers and Beyond&amp;quot; &lt;!-- ws:start:WikiTextRefRule:26:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=51637&amp;amp;amp;start=39&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Senpai 1.0 (new engine)&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Gerd%20Isenberg&amp;quot;&amp;gt;Gerd Isenberg&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, March 17, 2014&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-6&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-6&quot;&gt;[6]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:26 --&gt; . &lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:31:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;How it works&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:31 --&gt;How it works&lt;/h1&gt;
The routine gets the pre-calculated &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board&quot;&gt;attack-set on the otherwise empty board&lt;/a&gt; by looking up a two-dimensional array indexed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces#PieceTypeCoding&quot;&gt;piece kind&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Origin%20Square&quot;&gt;origin square&lt;/a&gt;. Further, the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; of the whole board is &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Intersection&quot;&gt;intersected&lt;/a&gt; by a piece-kind and origin square specific blocker and beyond (b&amp;amp;b) mask, which is always empty for none sliding pieces. For sliders, the b&amp;amp;b mask almost equals the attack-set, except that the redundant most outer squares with no more ray-squares behind are cleared. &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboard%20Serialization&quot;&gt;Serializing&lt;/a&gt; the intersection with clearing all bits on the &lt;a class=&quot;wiki_link&quot; href=&quot;/Rays&quot;&gt;ray&lt;/a&gt; from the origin behind the potential blocker square finally determines the sliding attack set, whether it is a bishop, rook or queen.&lt;br /&gt;
&lt;br /&gt;
Of course, if there are multiple pieces on a ray, the routine performs multiple ray-resets with different lengths, which are redundant for the outer pieces beyond the first blocker without affecting the result. Despite the loop and branch issues, the routine has a tiny loop body, skips empty rays, has no conditional code on the (sign of) the &lt;a class=&quot;wiki_link&quot; href=&quot;/Rays#RayDirections&quot;&gt;ray-direction&lt;/a&gt;, and is quite competitive, specially in rook, bishop and queen endings with high mobility.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:33:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Sample C Source&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:33 --&gt;Sample C Source&lt;/h1&gt;
&lt;!-- ws:start:WikiTextRefRule:28:&amp;amp;lt;ref&amp;amp;gt;adapted to common CPW types and style from Senpai 1.0 source&amp;lt;br /&amp;gt;
bit_t piece_attacks_from(int pc, int f, const board::Board &amp;amp;amp; bd), senpai_10.cpp, line 1867&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-7&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-7&quot;&gt;[7]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:28 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 arrPieceAttacks[6][64];&amp;lt;br/&amp;gt;U64 arrBlockersAndBeyond[6][64];&amp;lt;br/&amp;gt;U64 arrBehind[64][64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 pieceAttacks(int pc, int f, U64 occupied) {&amp;lt;br/&amp;gt;   assert(pc != piece::PAWN);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   U64 ts = arrPieceAttacks[pc][f];&amp;lt;br/&amp;gt;   for (U64 b = occupied &amp;amp;amp; arrBlockersAndBeyond[pc][f]; b != 0; b &amp;amp;amp;= (b - 1)) {&amp;lt;br/&amp;gt;      int sq = bitScanForward(b);&amp;lt;br/&amp;gt;      ts &amp;amp;amp;= ~arrBehind[f][sq];&amp;lt;br/&amp;gt;   }&amp;lt;br/&amp;gt;   return ts;&amp;lt;br/&amp;gt;} &amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 arrPieceAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
U64 arrBlockersAndBeyond&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
U64 arrBehind&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 pieceAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; pc, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; f, U64 occupied&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw3&quot;&gt;assert&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pc &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; piece&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;PAWN&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   U64 ts &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; arrPieceAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;pc&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; occupied &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; arrBlockersAndBeyond&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;pc&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; b &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bitScanForward&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      ts &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~arrBehind&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; ts&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;br /&gt;
For a queen on d4, with up to 27 attacked squares, the blockers and beyond cardinality of all eight rays is 19:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt; pieceAttacks[q][d4]   blockers&amp;amp;amp;beyond[q][d4]&amp;lt;br/&amp;gt; . . . 1 . . . 1       . . . . . . . .&amp;lt;br/&amp;gt; 1 . . 1 . . 1 .       . . . 1 . . 1 .&amp;lt;br/&amp;gt; . 1 . 1 . 1 . .       . 1 . 1 . 1 . .&amp;lt;br/&amp;gt; . . 1 1 1 . . .       . . 1 1 1 . . .&amp;lt;br/&amp;gt; 1 1 1 Q 1 1 1 1       . 1 1 Q 1 1 1 .&amp;lt;br/&amp;gt; . . 1 1 1 . . .       . . 1 1 1 . . .&amp;lt;br/&amp;gt; . 1 . 1 . 1 . .       . 1 . 1 . 1 . .&amp;lt;br/&amp;gt; 1 . . 1 . . 1 .       . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt; pieceAttacks[q][d4]   blockers&amp;amp;beyond[q][d4]
 . . . 1 . . . 1       . . . . . . . .
 1 . . 1 . . 1 .       . . . 1 . . 1 .
 . 1 . 1 . 1 . .       . 1 . 1 . 1 . .
 . . 1 1 1 . . .       . . 1 1 1 . . .
 1 1 1 Q 1 1 1 1       . 1 1 Q 1 1 1 .
 . . 1 1 1 . . .       . . 1 1 1 . . .
 . 1 . 1 . 1 . .       . 1 . 1 . 1 . .
 1 . . 1 . . 1 .       . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:35:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:35 --&gt;See also&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Chess-64&quot;&gt;Chess-64&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Classical%20Approach&quot;&gt;Classical Approach&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Senpai&quot;&gt;Senpai&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:37:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:37 --&gt;External Links&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Blocker&quot; rel=&quot;nofollow&quot;&gt;Blocker from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Alpha_blocker&quot; rel=&quot;nofollow&quot;&gt;Alpha blocker from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Beta_blocker&quot; rel=&quot;nofollow&quot;&gt;Beta blocker from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Beyond&quot; rel=&quot;nofollow&quot;&gt;Beyond from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#MahavishnuOrchestra&quot;&gt;Mahavishnu Orchestra&lt;/a&gt; - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Birds_of_Fire&quot; rel=&quot;nofollow&quot;&gt;Miles Beyond&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.musicinn.org/&quot; rel=&quot;nofollow&quot;&gt;Music Inn&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Lenox,_Massachusetts&quot; rel=&quot;nofollow&quot;&gt;Lenox, Ma&lt;/a&gt; - July 21, 1973, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#JohnMcLaughlin&quot;&gt;John McLaughlin&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#BillyCobham&quot;&gt;Billy Cobham&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Rick_Laird&quot; rel=&quot;nofollow&quot;&gt;Rick Laird&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#JanHammer&quot;&gt;Jan Hammer&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Jerry_Goodman&quot; rel=&quot;nofollow&quot;&gt;Jerry Goodman&lt;/a&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:29:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/custom/25402860?h=0&amp;amp;w=0&amp;quot; class=&amp;quot;WikiMedia WikiMediaCustom&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;custom&amp;amp;quot; key=&amp;amp;quot;25402860&amp;amp;quot;&amp;quot; title=&amp;quot;Custom Media&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/CTybDy8xxGI?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:29 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:39:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:39 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:134:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=51637&quot; rel=&quot;nofollow&quot;&gt;Senpai 1.0 (new engine)&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Fabien%20Letouzey&quot;&gt;Fabien Letouzey&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 17, 2014&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chessprogramming.net/senpai/&quot; rel=&quot;nofollow&quot;&gt;Senpai Chess Engine - Computer Chess Programming&lt;/a&gt; hosted by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steve%20Maughan&quot;&gt;Steve Maughan&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; Personal communication with &lt;a class=&quot;wiki_link&quot; href=&quot;/Fabien%20Letouzey&quot;&gt;Fabien Letouzey&lt;/a&gt;, March 20, 2014&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=51637&amp;amp;start=26&quot; rel=&quot;nofollow&quot;&gt;Re: Senpai 1.0 (new engine)&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Fabien%20Letouzey&quot;&gt;Fabien Letouzey&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 17, 2014&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Fritz%20Reul&quot;&gt;Fritz Reul&lt;/a&gt; (&lt;strong&gt;2009&lt;/strong&gt;). &lt;em&gt;New Architectures in Computer Chess&lt;/em&gt;. Ph.D. Thesis, &lt;em&gt;Chapter 2 Non-Bitboard Architectures&lt;/em&gt;.&lt;/li&gt;
&lt;li id=&quot;cite_note-6&quot;&gt;&lt;a href=&quot;#cite_ref-6&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=51637&amp;amp;start=39&quot; rel=&quot;nofollow&quot;&gt;Re: Senpai 1.0 (new engine)&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 17, 2014&lt;/li&gt;
&lt;li id=&quot;cite_note-7&quot;&gt;&lt;a href=&quot;#cite_ref-7&quot;&gt;^&lt;/a&gt; adapted to common CPW types and style from Senpai 1.0 source&lt;br /&gt;
bit_t piece_attacks_from(int pc, int f, const board::Board &amp;amp; bd), senpai_10.cpp, line 1867&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:134 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:41:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:41 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:02:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Blockers and Beyond&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Blockers and Beyond&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Blockers_and_Beyond includeBody-Blockers%20and%20Beyond includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Blockers+and+Beyond&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Blockers and Beyond&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chess-64&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chess-64&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Classical+Approach&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Classical Approach&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 28, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Draughts&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Draughts&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 12, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/On+an+empty+Board&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;On an empty Board&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 18, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Senpai&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Senpai&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 10, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:02 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Classical Approach</title>
      <link>https://chessprogramming.wikispaces.com/Classical+Approach</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Classical+Approach</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Classical+Approach</comments>
      <pubDate>Sun, 28 Jan 2018 18:03:50 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:64:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:64 --&gt;&lt;!-- ws:start:WikiTextTocRule:65: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Ray Attacks&quot;&gt;Ray Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:65 --&gt;&lt;!-- ws:start:WikiTextTocRule:66: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Positive Rays&quot;&gt;Positive Rays&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:66 --&gt;&lt;!-- ws:start:WikiTextTocRule:67: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Positive Rays-Conditional&quot;&gt;Conditional&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:67 --&gt;&lt;!-- ws:start:WikiTextTocRule:68: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Positive Rays-Branchless&quot;&gt;Branchless&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:68 --&gt;&lt;!-- ws:start:WikiTextTocRule:69: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Negative Rays&quot;&gt;Negative Rays&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:69 --&gt;&lt;!-- ws:start:WikiTextTocRule:70: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Negative Rays-Conditional&quot;&gt;Conditional&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:70 --&gt;&lt;!-- ws:start:WikiTextTocRule:71: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Negative Rays-Branchless&quot;&gt;Branchless&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:71 --&gt;&lt;!-- ws:start:WikiTextTocRule:72: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Generalized&quot;&gt;Generalized&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:72 --&gt;&lt;!-- ws:start:WikiTextTocRule:73: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Generalized-Conditional&quot;&gt;Conditional&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:73 --&gt;&lt;!-- ws:start:WikiTextTocRule:74: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Generalized-Branchless&quot;&gt;Branchless&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:74 --&gt;&lt;!-- ws:start:WikiTextTocRule:75: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Zero Count&quot;&gt;Zero Count&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:75 --&gt;&lt;!-- ws:start:WikiTextTocRule:76: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Line Attacks&quot;&gt;Line Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:76 --&gt;&lt;!-- ws:start:WikiTextTocRule:77: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Piece Attacks&quot;&gt;Piece Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:77 --&gt;&lt;!-- ws:start:WikiTextTocRule:78: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Piece Attacks-Union of Line Attacks&quot;&gt;Union of Line Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:78 --&gt;&lt;!-- ws:start:WikiTextTocRule:79: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Piece Attacks-In one Run&quot;&gt;In one Run&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:79 --&gt;&lt;!-- ws:start:WikiTextTocRule:80: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:80 --&gt;&lt;!-- ws:start:WikiTextTocRule:81: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Publications&quot;&gt;Publications&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:81 --&gt;&lt;!-- ws:start:WikiTextTocRule:82: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forum Posts&quot;&gt;Forum Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:82 --&gt;&lt;!-- ws:start:WikiTextTocRule:83: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:83 --&gt;&lt;!-- ws:start:WikiTextTocRule:84: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:84 --&gt;&lt;!-- ws:start:WikiTextTocRule:85: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:85 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Classical Approach&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The classical approach to generate &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Pieces&quot;&gt;sliding piece&lt;/a&gt; attacks was probably first used by &lt;a class=&quot;wiki_link&quot; href=&quot;/Chess%20%28Program%29&quot;&gt;Chess&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Kaissa&quot;&gt;Kaissa&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextIncludeRule:014:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/page?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; title=&amp;quot;Include page: page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;

&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a href=&quot;/Square%20Mapping%20Considerations&quot;&gt;&lt;img src=&quot;/file/view/mapping.JPG/93134172/mapping.JPG&quot; alt=&quot;mapping.JPG&quot; title=&quot;mapping.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;em&gt;Code samples and bitboard diagrams rely on &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations#LittleEndianRankFileMapping&quot;&gt;Little endian file and rank mapping&lt;/a&gt;&lt;/em&gt;.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:end:WikiTextIncludeRule:014 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:24:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Ray Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:24 --&gt;Ray Attacks&lt;/h1&gt;
 The classical approach works ray-wise and uses pre-calculated &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#RayAttacks&quot;&gt;ray-attacks&lt;/a&gt; for each of the eight &lt;a class=&quot;wiki_link&quot; href=&quot;/Rays#RayDirections&quot;&gt;ray-directions&lt;/a&gt; and each of the 64 &lt;a class=&quot;wiki_link&quot; href=&quot;/Squares&quot;&gt;squares&lt;/a&gt;. It has to distinguish between &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#PositiveRays&quot;&gt;positive&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#NegativeRays&quot;&gt;negative&lt;/a&gt; directions, because it has to &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan&quot;&gt;bitscan&lt;/a&gt; the ray-attack intersection with the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; in different orders. That usually don&#039;t cares for getting line- or piece attacks, since one likely unrolls all directions needed for a particular line or piece - otherwise one may rely on a &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#GeneralizedBitscan&quot;&gt;generalized bitscan&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;We rely on the compass rose to enumerate ray-directions:&lt;/em&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;  noWe         nort         noEa&amp;lt;br/&amp;gt;          +7    +8    +9&amp;lt;br/&amp;gt;              \  |  /&amp;lt;br/&amp;gt;  west    -1 &amp;amp;lt;-  0 -&amp;amp;gt; +1    east&amp;lt;br/&amp;gt;              /  |  \&amp;lt;br/&amp;gt;          -9    -8    -7&amp;lt;br/&amp;gt;  soWe         sout         soEa&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;  noWe         nort         noEa
          +7    +8    +9
              \  |  /
  west    -1 &amp;lt;-  0 -&amp;gt; +1    east
              /  |  \
          -9    -8    -7
  soWe         sout         soEa&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:26:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Ray Attacks-Positive Rays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:26 --&gt;Positive Rays&lt;/h2&gt;
 Attacks of Positive Ray-Directions:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;East (+1)           North (+8)           NorthEast (+9)      NorthWest (+7)&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . . . 1     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . . 1 .     1 . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . 1 . .     . 1 . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . 1 . . .     . . 1 . . . . .&amp;lt;br/&amp;gt;. . . R 1 1 1 1     . . . R . . . .      . . . B . . . .     . . . B . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;East (+1)           North (+8)           NorthEast (+9)      NorthWest (+7)
. . . . . . . .     . . . 1 . . . .      . . . . . . . 1     . . . . . . . .
. . . . . . . .     . . . 1 . . . .      . . . . . . 1 .     1 . . . . . . .
. . . . . . . .     . . . 1 . . . .      . . . . . 1 . .     . 1 . . . . . .
. . . . . . . .     . . . 1 . . . .      . . . . 1 . . .     . . 1 . . . . .
. . . R 1 1 1 1     . . . R . . . .      . . . B . . . .     . . . B . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:28:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Ray Attacks-Positive Rays-Conditional&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:28 --&gt;Conditional&lt;/h3&gt;
 The first step gets the &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#RayAttacks&quot;&gt;ray-attack&lt;/a&gt; on the otherwise empty board. Potential blockers are then determined by intersection with the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt;, the set of all pieces. The first blocker, if any, is the least significant one-bit of the intersection. A &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#Bitscanforward&quot;&gt;bitscan forward&lt;/a&gt; determines the square of the first blocker, to reset it&#039;s ray-bits from the attack set. For instance a bishop on g2:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;occupied         &amp;amp;amp;  NorthWest(g2)       {a8, c6}&amp;lt;br/&amp;gt;1 . 1 1 1 1 1 1     1 . . . . . . .     1 . . . . . . .&amp;lt;br/&amp;gt;1 . 1 1 1 1 1 1     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. 1 1 . . . . .     . . 1 . . . . .     . . 1 . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .  &amp;amp;amp;  . . . . 1 . . .  =  . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . 1 .     . . . . . 1 . .     . . . . . . . .&amp;lt;br/&amp;gt;1 1 1 1 1 1 B 1     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;1 1 1 1 1 . 1 1     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;                    xor NorthWest(c6 = bitscanForward{a8,c6}&amp;lt;br/&amp;gt;                    1 . . . . . . .&amp;lt;br/&amp;gt;                    . 1 . . . . . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;                    =  final northWest Attacks&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;                    . . 1 . . . . .&amp;lt;br/&amp;gt;                    . . . 1 . . . .&amp;lt;br/&amp;gt;                    . . . . 1 . . .&amp;lt;br/&amp;gt;                    . . . . . 1 . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;                    . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;occupied         &amp;amp;  NorthWest(g2)       {a8, c6}
1 . 1 1 1 1 1 1     1 . . . . . . .     1 . . . . . . .
1 . 1 1 1 1 1 1     . 1 . . . . . .     . . . . . . . .
. 1 1 . . . . .     . . 1 . . . . .     . . 1 . . . . .
. . . . . . . .     . . . 1 . . . .     . . . . . . . .
. . . . . . . .  &amp;amp;  . . . . 1 . . .  =  . . . . . . . .
. . . . . . 1 .     . . . . . 1 . .     . . . . . . . .
1 1 1 1 1 1 B 1     . . . . . . . .     . . . . . . . .
1 1 1 1 1 . 1 1     . . . . . . . .     . . . . . . . .
&amp;nbsp;
                    xor NorthWest(c6 = bitscanForward{a8,c6}
                    1 . . . . . . .
                    . 1 . . . . . .
                    . . . . . . . .
                    . . . . . . . .
                    . . . . . . . .
                    . . . . . . . .
                    . . . . . . . .
                    . . . . . . . .
&amp;nbsp;
                    =  final northWest Attacks
                    . . . . . . . .
                    . . . . . . . .
                    . . 1 . . . . .
                    . . . 1 . . . .
                    . . . . 1 . . .
                    . . . . . 1 . .
                    . . . . . . . .
                    . . . . . . . .
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 rayAttacks[8][64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 getPositiveRayAttacks(U64 occupied, enumDir dir8, enumSquare square) {&amp;lt;br/&amp;gt;   U64 attacks = rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   U64 blocker = attacks &amp;amp;amp; occupied;&amp;lt;br/&amp;gt;   if ( blocker ) {&amp;lt;br/&amp;gt;      square = bitScanForward(blocker);&amp;lt;br/&amp;gt;      attacks ^= rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   }&amp;lt;br/&amp;gt;   return attacks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 getPositiveRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occupied, enumDir dir8, enumSquare square&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 attacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 blocker &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; attacks &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occupied&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; blocker &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      square &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bitScanForward&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;blocker&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      attacks &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:86:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Branchless&amp;quot; title=&amp;quot;Anchor: Branchless&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Branchless&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:86 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:30:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Ray Attacks-Positive Rays-Branchless&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:30 --&gt;Branchless&lt;/h3&gt;
 Branches are evil with todays super pipelined processors. Even if branch-prediction heuristics become smarter, &lt;a class=&quot;wiki_link&quot; href=&quot;/Avoiding%20Branches&quot;&gt;branch-less&lt;/a&gt; solutions allow better scheduling and parallel speedup of independent instruction chains, like processing several directions.&lt;br /&gt;
&lt;br /&gt;
Considering todays fast &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64#gpinstructions&quot;&gt;bsf-instruction&lt;/a&gt; of &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Intel_Core_2&quot; rel=&quot;nofollow&quot;&gt;Core 2&lt;/a&gt; or &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/AMD_K10&quot; rel=&quot;nofollow&quot;&gt;K10&lt;/a&gt;, a branch-less solution may be worth a try. Due to the fact the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; of &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;the outer squares&lt;/a&gt; doesn&#039;t affect the attack set, setting the most significant bit ensures to scan at least an outer square, which would address an empty ray set anyway, therefor not affecting the final result with no blocker or a most outer one.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 getRayAttacks(U64 occupied, enumDir dir8, unsigned long square) {&amp;lt;br/&amp;gt;   U64 attacks    = rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   U64 blocker    =  attacks &amp;amp;amp; occupied;&amp;lt;br/&amp;gt;   _BitScanForward64 (&amp;amp;amp;square, blocker | C64(0x8000000000000000));&amp;lt;br/&amp;gt;   return attacks ^ rayAttacks[dir8][square];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 getRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occupied, enumDir dir8, &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;long&lt;/span&gt; square&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 attacks    &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 blocker    &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  attacks &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occupied&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   _BitScanForward64 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;square, blocker &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x8000000000000000&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:32:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Ray Attacks-Negative Rays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:32 --&gt;Negative Rays&lt;/h2&gt;
 Attacks of Negative Ray-Directions:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;West (-1)           South (-8)           SouthWest (-9)      SouthEast (-7)&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;1 1 1 R . . . .     . . . R . . . .      . . . B . . . .     . . . B . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . 1 . . . . .     . . . . 1 . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . 1 . . . . . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      1 . . . . . . .     . . . . . . 1 .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;West (-1)           South (-8)           SouthWest (-9)      SouthEast (-7)
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
1 1 1 R . . . .     . . . R . . . .      . . . B . . . .     . . . B . . . .
. . . . . . . .     . . . 1 . . . .      . . 1 . . . . .     . . . . 1 . . .
. . . . . . . .     . . . 1 . . . .      . 1 . . . . . .     . . . . . 1 . .
. . . . . . . .     . . . 1 . . . .      1 . . . . . . .     . . . . . . 1 .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:34:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Ray Attacks-Negative Rays-Conditional&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:34 --&gt;Conditional&lt;/h3&gt;
 Works the same way, but needs &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#Bitscanreverse&quot;&gt;reverse bitscan&lt;/a&gt; to find the first blocking piece, if any.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 getNegativeRayAttacks(U64 occupied, enumDir dir8, enumSquare square) {&amp;lt;br/&amp;gt;   U64 attacks = rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   U64 blocker = attacks &amp;amp;amp; occupied;&amp;lt;br/&amp;gt;   if ( blocker ) {&amp;lt;br/&amp;gt;      square = bitScanReverse(blocker);&amp;lt;br/&amp;gt;      attacks ^= rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   }&amp;lt;br/&amp;gt;   return attacks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 getNegativeRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occupied, enumDir dir8, enumSquare square&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 attacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 blocker &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; attacks &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occupied&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; blocker &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      square &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bitScanReverse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;blocker&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      attacks &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:36:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Ray Attacks-Negative Rays-Branchless&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:36 --&gt;Branchless&lt;/h3&gt;
 The branch-less solution with a fast &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64#gpinstructions&quot;&gt;bsr-instruction&lt;/a&gt; allows better scheduling and parallel speedup of independent instruction chains, like processing several directions. Setting the least significant bit ensures to scan at least an outer square, which would address an empty ray set anyway, therefor not affecting the final result with no blocker or a most outer one.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 getRayAttacks(U64 occupied, enumDir dir8, unsigned long square) {&amp;lt;br/&amp;gt;   U64 attacks    = rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   U64 blocker    =  attacks &amp;amp;amp; occupied;&amp;lt;br/&amp;gt;   _BitScanReverse64 (&amp;amp;amp;square, blocker | 1);&amp;lt;br/&amp;gt;   return attacks ^ rayAttacks[dir8][square];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 getRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occupied, enumDir dir8, &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;long&lt;/span&gt; square&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 attacks    &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 blocker    &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  attacks &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occupied&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   _BitScanReverse64 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;square, blocker &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:87:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Generalized&amp;quot; title=&amp;quot;Anchor: Generalized&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Generalized&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:87 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:38:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Ray Attacks-Generalized&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:38 --&gt;Generalized&lt;/h2&gt;
 The idea of the &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#GeneralizedBitscan&quot;&gt;generalized bitscan&lt;/a&gt; may be used to share the same code for all directions. The implementation of isNegative(dir8), a macro or inline-function, depends on the definition or enumeration of the directions and is likely a compare or test instruction.&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:40:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Ray Attacks-Generalized-Conditional&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:40 --&gt;Conditional&lt;/h3&gt;
 The conditional by a good predictable branch on blocker is favorable - specially for slow bitscans with some chance to skip it, e.g. in endings.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 getRayAttacks(U64 occupied, enumDir dir8, enumSquare square) {&amp;lt;br/&amp;gt;   U64 attacks = rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   U64 blocker = attacks &amp;amp;amp; occupied;&amp;lt;br/&amp;gt;   if ( blocker ) {&amp;lt;br/&amp;gt;      square = bitScan(blocker, isNegative(dir8));&amp;lt;br/&amp;gt;      attacks ^= rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   }&amp;lt;br/&amp;gt;   return attacks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 getRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occupied, enumDir dir8, enumSquare square&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 attacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 blocker &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; attacks &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occupied&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; blocker &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      square &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bitScan&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;blocker, isNegative&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      attacks &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:42:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc9&quot;&gt;&lt;a name=&quot;Ray Attacks-Generalized-Branchless&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:42 --&gt;Branchless&lt;/h3&gt;
 The branch-less routine provides a dirMask as universal set for negative rays and the empty set for positive rays, to implement the &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#GeneralizedBitscan&quot;&gt;generalized bitscan&lt;/a&gt;. The dirBit-or ensures to scan at least outer square with empty ray sets.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 getRayAttacks(U64 occupied, enumDir dir8, unsigned long square) {&amp;lt;br/&amp;gt;   U64 attacks    = rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   U64 blocker    =  attacks &amp;amp;amp; occupied;&amp;lt;br/&amp;gt;   blocker       &amp;amp;amp;= -blocker | dirMask[dir8];&amp;lt;br/&amp;gt;   blocker       |=            dirBit [dir8]&amp;lt;br/&amp;gt;   _BitScanReverse64 (&amp;amp;amp;square, blocker | dirBit[dir8]);&amp;lt;br/&amp;gt;   return attacks ^ rayAttacks[dir8][square];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 getRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occupied, enumDir dir8, &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;long&lt;/span&gt; square&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 attacks    &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 blocker    &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  attacks &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occupied&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   blocker       &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;blocker &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; dirMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   blocker       &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;            dirBit &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;
   _BitScanReverse64 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;square, blocker &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; dirBit&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:9 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:44:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc10&quot;&gt;&lt;a name=&quot;Ray Attacks-Zero Count&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:44 --&gt;Zero Count&lt;/h2&gt;
 If available, Leading- or Trailing Zero Count instructions may be used instead of bitscan for another branch-less solution of the classical attack getter. Since they leave 64 for empty sets, it needs to make the ray attack &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;arrays&lt;/a&gt; one greater to allow index by 64 which contains an empty set - or one needs to map 64 to 63 for positive directions.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 rayAttacks[8][65];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 getPositiveRayAttacks(U64 occupied, enumDir dir8, enumSquare square) {&amp;lt;br/&amp;gt;   U64 attacks = rayAttacks[dir8][square];&amp;lt;br/&amp;gt;   U64 blocker = attacks &amp;amp;amp; occupied;&amp;lt;br/&amp;gt;   int firstBlockingSquare = trailingZeroCount(blocker);&amp;lt;br/&amp;gt;   attacks ^= rayAttacks[dir8][firstBlockingSquare];&amp;lt;br/&amp;gt;   return attacks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;65&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 getPositiveRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occupied, enumDir dir8, enumSquare square&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 attacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 blocker &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; attacks &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occupied&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; firstBlockingSquare &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; trailingZeroCount&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;blocker&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attacks &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;firstBlockingSquare&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;LeadingZeroCount instead of bitscanReverse may be done similarly, considering the reversed order.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:88:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Wrapper&amp;quot; title=&amp;quot;Anchor: Wrapper&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Wrapper&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:88 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:46:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc11&quot;&gt;&lt;a name=&quot;Line Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:46 --&gt;Line Attacks&lt;/h1&gt;
 As mentioned, line attacks are the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Union&quot;&gt;union&lt;/a&gt; of positive and opposite negative &lt;a class=&quot;wiki_link&quot; href=&quot;/Rays#RayDirections&quot;&gt;ray-directions&lt;/a&gt; - since they are disjoint one may also use &#039;xor&#039; or &#039;add&#039;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:11:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;  return getPositiveRayAttacks(occ, noEa, sq)&amp;lt;br/&amp;gt;       | getNegativeRayAttacks(occ, soWe, sq); // ^ +&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 antiDiagAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;  return getPositiveRayAttacks(occ, noWe, sq)&amp;lt;br/&amp;gt;       | getNegativeRayAttacks(occ, soEa, sq); // ^ +&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks (U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;  return getPositiveRayAttacks(occ, nort, sq)&amp;lt;br/&amp;gt;       | getNegativeRayAttacks(occ, sout, sq); // ^ +&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rankAttacks (U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;  return getPositiveRayAttacks(occ, east, sq)&amp;lt;br/&amp;gt;       | getNegativeRayAttacks(occ, west, sq); // ^ +&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; getPositiveRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, noEa, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; getNegativeRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, soWe, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ^ +&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 antiDiagAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; getPositiveRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, noWe, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; getNegativeRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, soEa, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ^ +&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 fileAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; getPositiveRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, nort, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; getNegativeRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sout, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ^ +&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 rankAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; getPositiveRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, east, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; getNegativeRayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, west, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ^ +&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:11 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:48:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc12&quot;&gt;&lt;a name=&quot;Piece Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:48 --&gt;Piece Attacks&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextHeadingRule:50:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc13&quot;&gt;&lt;a name=&quot;Piece Attacks-Union of Line Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:50 --&gt;Union of Line Attacks&lt;/h2&gt;
 Of course piece attacks are the union of the line attacks:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:12:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 rookAttacks (U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;  return fileAttacks(occ, sq)&amp;lt;br/&amp;gt;       | rankAttacks(occ, sq); // ^ +&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks (U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;  return diagonalAttacks(occ, sq)&amp;lt;br/&amp;gt;       | antiDiagAttacks(occ, sq); // ^ +&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 queenAttacks (U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;  return rookAttacks  (occ, sq)&amp;lt;br/&amp;gt;       | bishopAttacks(occ, sq); // ^ +&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 rookAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; fileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; rankAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ^ +&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; antiDiagAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ^ +&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 queenAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; rookAttacks  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ^ +&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:12 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:89:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@InOneRun&amp;quot; title=&amp;quot;Anchor: InOneRun&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;InOneRun&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:89 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:52:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc14&quot;&gt;&lt;a name=&quot;Piece Attacks-In one Run&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:52 --&gt;In one Run&lt;/h2&gt;
 As mentioned by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:17:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;amp;p=299564&amp;amp;amp;t=30356&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Yet another bitboard attack generator&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Robert%20Hyatt&amp;quot;&amp;gt;Robert Hyatt&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, October 28, 2009&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:17 --&gt;, instead of fetching four &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#RayAttacks&quot;&gt;ray-attacks&lt;/a&gt; on the otherwise empty board, one may already use the &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#PieceAttacks&quot;&gt;rook- or bishop attacks&lt;/a&gt; to reset outer squares from that union set. &lt;br /&gt;
&lt;br /&gt;
A further improvement was suggested by &lt;a class=&quot;wiki_link&quot; href=&quot;/Michael%20Sherwin&quot;&gt;Michael Sherwin&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:21:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=30971&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Modified old 64 bit attack getter&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Michael%20Sherwin&amp;quot;&amp;gt;Michael Sherwin&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, December 06, 2009&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:21 --&gt;, to union the occupancy with the outer bits 0 and 63. Together with appropriate bits set in separate ray-masks, this yields to an efficient branchless solution with 13 64-bit operations in total and 4.5 KByte for the lookup tables for both rooks and bishops each.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:13:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;struct {&amp;lt;br/&amp;gt;  U64 bitsN;  // bits North, including MSB (bit 63)&amp;lt;br/&amp;gt;  U64 bitsE;  // bits East, including MSB&amp;lt;br/&amp;gt;  U64 bitsS;  // bits South, including LSB (bit 0 == 1)&amp;lt;br/&amp;gt;  U64 bitsW;  // bits West, including LSB &amp;lt;br/&amp;gt;} CACHE_ALIGN rayWstop[64]; &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 attacksEmpty[64];&amp;lt;br/&amp;gt;U64 rayN[64];&amp;lt;br/&amp;gt;U64 rayE[64];&amp;lt;br/&amp;gt;U64 rayS[64];&amp;lt;br/&amp;gt;U64 rayW[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, unsigned int sq) {&amp;lt;br/&amp;gt;   unsigned long ulN, ulE, ulS, ulW;&amp;lt;br/&amp;gt;   occ |= C64(0x8000000000000001);&amp;lt;br/&amp;gt;   _BitScanForward64(&amp;amp;amp;ulN, occ &amp;amp;amp; rayWstop[sq].bitsN);&amp;lt;br/&amp;gt;   _BitScanForward64(&amp;amp;amp;ulE, occ &amp;amp;amp; rayWstop[sq].bitsE);&amp;lt;br/&amp;gt;   _BitScanReverse64(&amp;amp;amp;ulS, occ &amp;amp;amp; rayWstop[sq].bitsS);&amp;lt;br/&amp;gt;   _BitScanReverse64(&amp;amp;amp;ulW, occ &amp;amp;amp; rayWstop[sq].bitsW);&amp;lt;br/&amp;gt;   return attacksEmpty[sq]^rayN[ulN]^rayE[ulE]^rayS[ulS]^rayW[ulW];&amp;lt;br/&amp;gt;} &amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  U64 bitsN&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// bits North, including MSB (bit 63)&lt;/span&gt;
  U64 bitsE&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// bits East, including MSB&lt;/span&gt;
  U64 bitsS&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// bits South, including LSB (bit 0 == 1)&lt;/span&gt;
  U64 bitsW&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// bits West, including LSB &lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; CACHE_ALIGN rayWstop&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; 
&amp;nbsp;
U64 attacksEmpty&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
U64 rayN&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
U64 rayE&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
U64 rayS&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
U64 rayW&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;long&lt;/span&gt; ulN, ulE, ulS, ulW&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x8000000000000001&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   _BitScanForward64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;ulN, occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rayWstop&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitsN&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   _BitScanForward64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;ulE, occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rayWstop&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitsE&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   _BitScanReverse64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;ulS, occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rayWstop&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitsS&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   _BitScanReverse64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;ulW, occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rayWstop&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitsW&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacksEmpty&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;rayN&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;ulN&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;rayE&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;ulE&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;rayS&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;ulS&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;rayW&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;ulW&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:13 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:54:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc15&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:54 --&gt;See also&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Bitfoot#ABBitboards&quot;&gt;Bitfoot - A/B Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Blockers%20and%20Beyond&quot;&gt;Blockers and Beyond&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Obstruction%20Difference&quot;&gt;Obstruction Difference&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces%20versus%20Directions&quot;&gt;Pieces versus Directions&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:56:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc16&quot;&gt;&lt;a name=&quot;Publications&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:56 --&gt;Publications&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Stuart%20Cracraft&quot;&gt;Stuart Cracraft&lt;/a&gt; (&lt;strong&gt;1984&lt;/strong&gt;). &lt;em&gt;Bitmap move generation in Chess&lt;/em&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal&quot;&gt;ICCA Journal&lt;/a&gt;, Vol. 7, No. 3, pp. 146–153&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fridel%20Fainshtein&quot;&gt;Fridel Fainshtein&lt;/a&gt; (&lt;strong&gt;2006&lt;/strong&gt;). &lt;em&gt;An Orthodox k-Move Problem-Composer for Chess Directmates&lt;/em&gt;. M.Sc. thesis, &lt;a class=&quot;wiki_link&quot; href=&quot;/Bar-Ilan%20University&quot;&gt;Bar-Ilan University&lt;/a&gt;,  &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.problemschach.de/KMOVEComposer.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;, Appendix D - 64-bit Representation, pp. 105&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fridel%20Fainshtein&quot;&gt;Fridel Fainshtein&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Yaakov%20HaCohen-Kerner&quot;&gt;Yaakov HaCohen-Kerner&lt;/a&gt; (&lt;strong&gt;2006&lt;/strong&gt;). &lt;em&gt;A Chess Composer of Two-Move Mate Problems&lt;/em&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal&quot;&gt;ICGA Journal&lt;/a&gt;, Vol. 29, No. 1, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://homedir.jct.ac.il/~kerner/pdf_docs/ICGA_computer_composer.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;, Appendix E: 64-bit representation&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:58:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc17&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:58 --&gt;Forum Posts&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=257692&amp;amp;t=27113&quot; rel=&quot;nofollow&quot;&gt;Re: Thinker output&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 25, 2009&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=299564&amp;amp;t=30356&quot; rel=&quot;nofollow&quot;&gt;Re: Yet another bitboard attack generator&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, October 28, 2009&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=30971&quot; rel=&quot;nofollow&quot;&gt;Modified old 64 bit attack getter&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Michael%20Sherwin&quot;&gt;Michael Sherwin&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, December 06, 2009&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:60:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc18&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:60 --&gt;References&lt;/h1&gt;
&lt;!-- ws:start:WikiTextReferencesRule:237:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=299564&amp;amp;t=30356&quot; rel=&quot;nofollow&quot;&gt;Re: Yet another bitboard attack generator&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, October 28, 2009&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=30971&quot; rel=&quot;nofollow&quot;&gt;Modified old 64 bit attack getter&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Michael%20Sherwin&quot;&gt;Michael Sherwin&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, December 06, 2009&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:237 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:62:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc19&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:62 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:015:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Classical Approach&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Classical Approach&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Classical_Approach includeBody-Classical%20Approach includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Andscacs&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Andscacs&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 16, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bitfoot&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bitfoot&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 8, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/BitScan&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;BitScan&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 10, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Blockers+and+Beyond&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Blockers and Beyond&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Classical+Approach&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Classical Approach&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 28, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/DirGolem&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;DirGolem&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fridel+Fainshtein&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fridel Fainshtein&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 8, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hiding+the+Implementation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hiding the Implementation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 3, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pieces+versus+Directions&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pieces versus Directions&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 6, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SEE+-+The+Swap+Algorithm&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SEE - The Swap Algorithm&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Shifted+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Shifted Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 9, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Teki&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Teki&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 29, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tunguska&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tunguska&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 16, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Yaakov+HaCohen-Kerner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Yaakov HaCohen-Kerner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 23, 2014&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:015 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Congruent Modulo Bitboards</title>
      <link>https://chessprogramming.wikispaces.com/Congruent+Modulo+Bitboards</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Congruent+Modulo+Bitboards</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Congruent+Modulo+Bitboards</comments>
      <pubDate>Wed, 26 Jun 2013 18:26:44 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:63:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:63 --&gt;&lt;!-- ws:start:WikiTextTocRule:64: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Modulo vs. Multiplication&quot;&gt;Modulo vs. Multiplication&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:64 --&gt;&lt;!-- ws:start:WikiTextTocRule:65: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Modulo vs. Multiplication-Modulo&quot;&gt;Modulo&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:65 --&gt;&lt;!-- ws:start:WikiTextTocRule:66: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Modulo vs. Multiplication-Modulo-Congruence relation&quot;&gt;Congruence relation&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:66 --&gt;&lt;!-- ws:start:WikiTextTocRule:67: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Modulo vs. Multiplication-Modulo-Casting out 255&quot;&gt;Casting out 255&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:67 --&gt;&lt;!-- ws:start:WikiTextTocRule:68: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Modulo vs. Multiplication-Modulo-Reciprocal Multiplication&quot;&gt;Reciprocal Multiplication&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:68 --&gt;&lt;!-- ws:start:WikiTextTocRule:69: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Modulo vs. Multiplication-Multiplication&quot;&gt;Multiplication&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:69 --&gt;&lt;!-- ws:start:WikiTextTocRule:70: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Fenner&#039;s and Levene&#039;s conclusion&quot;&gt;Fenner&#039;s and Levene&#039;s conclusion&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:70 --&gt;&lt;!-- ws:start:WikiTextTocRule:71: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Publications&quot;&gt;Publications&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:71 --&gt;&lt;!-- ws:start:WikiTextTocRule:72: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forum Posts&quot;&gt;Forum Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:72 --&gt;&lt;!-- ws:start:WikiTextTocRule:73: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:73 --&gt;&lt;!-- ws:start:WikiTextTocRule:74: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:74 --&gt;&lt;!-- ws:start:WikiTextTocRule:75: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:75 --&gt;&lt;!-- ws:start:WikiTextTocRule:76: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:76 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Congruent Modulo Bitboards&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Congruent Modulo Bitboards&lt;/strong&gt; was introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Trevor%20Fenner&quot;&gt;Trevor Fenner&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Mark%20Levene&quot;&gt;Mark Levene&lt;/a&gt; in the &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal#31_1&quot;&gt;ICGA Journal, Vol. 31, No. 1&lt;/a&gt; in 2008 &lt;!-- ws:start:WikiTextRefRule:18:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Trevor%20Fenner&amp;quot;&amp;gt;Trevor Fenner&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Mark%20Levene&amp;quot;&amp;gt;Mark Levene&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;2008&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;Move Generation with Perfect Hashing Functions.&amp;lt;/em&amp;gt; &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/ICGA%20Journal#31_1&amp;quot;&amp;gt;ICGA Journal, Vol. 31, No. 1&amp;lt;/a&amp;gt;, pp. 3-12. &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.dcs.bbk.ac.uk/~mark/download/bitboard_sliding_icga_final.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;pdf&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:18 --&gt;. While their &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table&quot;&gt;Perfect Hashing&lt;/a&gt; approach provides great mathematical insights in &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Modulo&quot; rel=&quot;nofollow&quot;&gt;Congruent Modulo&lt;/a&gt; arithmetic, their final conclusion in comparison with &lt;a class=&quot;wiki_link&quot; href=&quot;/Hashing%20Dictionaries&quot;&gt;Hashing Dictionaries&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt; was criticized by the obvious comparison with &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;Kindergarten Bitboards&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:22:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=20913&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Nice Math - Strange Conclusions&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Gerd%20Isenberg&amp;quot;&amp;gt;Gerd Isenberg&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, April 29, 2008&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:22 --&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:39:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Modulo vs. Multiplication&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:39 --&gt;Modulo vs. Multiplication&lt;/h1&gt;
 &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan&quot;&gt;BitScan&lt;/a&gt; broaches the issue of &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table&quot;&gt;Perfect Hashing&lt;/a&gt; with &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Modulo&quot;&gt;Modulo&lt;/a&gt; versus &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Multiplication&quot;&gt;Multiplication&lt;/a&gt; as well:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#BitscanByModulo&quot;&gt;Bitscan by Modulo&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#DeBruijnMultiplation&quot;&gt;De Bruijn Multiplication&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
So does the &lt;a class=&quot;wiki_link&quot; href=&quot;/Population%20Count#SWARPopcount&quot;&gt;SWAR-Popcount&lt;/a&gt;, when it is about to finally add byte-wise populations:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Population%20Count#Castingout&quot;&gt;Casting out&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Population%20Count#Multiplication&quot;&gt;Multiplication&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:41:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Modulo vs. Multiplication-Modulo&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:41 --&gt;Modulo&lt;/h2&gt;
&lt;!-- ws:start:WikiTextHeadingRule:43:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Modulo vs. Multiplication-Modulo-Congruence relation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:43 --&gt;Congruence relation&lt;/h3&gt;
 Fenner and Levene use masked lines (not necessarily excluding the sliding piece), that is bitboards with N=8 active bits with k={7,8,9} bits apart, starting with bit zero&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;!-- ws:start:WikiTextMathRule:5:
[[math]]&amp;lt;br/&amp;gt;
A_{kN} = \{0, k, 2k, ...,(N-1)k\}&amp;lt;br/&amp;gt;[[math]]
 --&gt;&lt;script type=&quot;math/tex&quot;&gt;A_{kN} = \{0, k, 2k, ...,(N-1)k\}&lt;/script&gt;&lt;!-- ws:end:WikiTextMathRule:5 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
Based on &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Congruence_relation&quot; rel=&quot;nofollow&quot;&gt;Congruence relation&lt;/a&gt; &lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;!-- ws:start:WikiTextMathRule:6:
[[math]]&amp;lt;br/&amp;gt;
b \equiv c \pmod{m}&amp;lt;br/&amp;gt;[[math]]
 --&gt;&lt;script type=&quot;math/tex&quot;&gt;b \equiv c \pmod{m}&lt;/script&gt;&lt;!-- ws:end:WikiTextMathRule:6 --&gt;&lt;/li&gt;&lt;/ul&gt;or equivalently&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;!-- ws:start:WikiTextMathRule:7:
[[math]]&amp;lt;br/&amp;gt;
b \mod{m} = c \mod{m}&amp;lt;br/&amp;gt;[[math]]
 --&gt;&lt;script type=&quot;math/tex&quot;&gt;b \mod{m} = c \mod{m}&lt;/script&gt;&lt;!-- ws:end:WikiTextMathRule:7 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
they deduced two general perfect hashing functions. The case N &amp;lt;= k with&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;!-- ws:start:WikiTextMathRule:8:
[[math]]&amp;lt;br/&amp;gt;
h_{1}(a) = a \mod (2^k + 2)&amp;lt;br/&amp;gt;[[math]]
 --&gt;&lt;script type=&quot;math/tex&quot;&gt;h_{1}(a) = a \mod (2^k + 2)&lt;/script&gt;&lt;!-- ws:end:WikiTextMathRule:8 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
and the case N &amp;lt;= k + 1&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;!-- ws:start:WikiTextMathRule:9:
[[math]]&amp;lt;br/&amp;gt;
h_{2}(a) = a \mod (2^{k+1} + 1)&amp;lt;br/&amp;gt;[[math]]
 --&gt;&lt;script type=&quot;math/tex&quot;&gt;h_{2}(a) = a \mod (2^{k+1} + 1)&lt;/script&gt;&lt;!-- ws:end:WikiTextMathRule:9 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
This results in modulo 514 for &lt;a class=&quot;wiki_link&quot; href=&quot;/Diagonals&quot;&gt;diagonals&lt;/a&gt;, modulo 257 for &lt;a class=&quot;wiki_link&quot; href=&quot;/Anti-Diagonals&quot;&gt;anti-diagonals&lt;/a&gt;, and modulo 258 for &lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;files&lt;/a&gt;, to calculate the occupied index. Tables could made denser by storing indices, but that would require a second indirection. While Fenner and Levene used a &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/MATLAB&quot; rel=&quot;nofollow&quot;&gt;Matlab&lt;/a&gt; 32-bit implementation to conclude their approach might be competitive, this is how it may be implemented in &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt; by looking up pre-calculated attack-bitboards:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;U64 arrCmodDiaAttacks [514][64];  // 257 K&amp;lt;br/&amp;gt;U64 arrCmodAntiAttacks[257][64];&amp;lt;br/&amp;gt;U64 arrCmodFileAttacks[258][64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 aDia = C64(0x8040201008040201);&amp;lt;br/&amp;gt;   occ = ( (occ &amp;amp;gt;&amp;amp;gt; diashift[sq]) &amp;amp;amp; aDia) % 514;&amp;lt;br/&amp;gt;   return arrCmodDiaAttacks[occ][sq];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 antiDiagAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 aAntiDiaShr7 = C64(0x0002040810204081);&amp;lt;br/&amp;gt;   occ = ( (occ &amp;amp;gt;&amp;amp;gt; antishift[sq]) &amp;amp;amp; aAntiDiaShr7 ) % 257;&amp;lt;br/&amp;gt;   return arrCmodAntiAttacks[occ][sq];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 aFile = C64(0x0101010101010101);&amp;lt;br/&amp;gt;   occ = ( (occ &amp;amp;gt;&amp;amp;gt; (sq&amp;amp;amp;7)) &amp;amp;amp; aFile) % 258;&amp;lt;br/&amp;gt;   return arrCmodFileAttacks[occ][sq];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;U64 arrCmodDiaAttacks [514][64];  // 257 K
U64 arrCmodAntiAttacks[257][64];
U64 arrCmodFileAttacks[258][64];
&amp;nbsp;
U64 diagonalAttacks(U64 occ, enumSquare sq) {
   const U64 aDia = C64(0x8040201008040201);
   occ = ( (occ &amp;gt;&amp;gt; diashift[sq]) &amp;amp; aDia) % 514;
   return arrCmodDiaAttacks[occ][sq];
}
&amp;nbsp;
U64 antiDiagAttacks(U64 occ, enumSquare sq) {
   const U64 aAntiDiaShr7 = C64(0x0002040810204081);
   occ = ( (occ &amp;gt;&amp;gt; antishift[sq]) &amp;amp; aAntiDiaShr7 ) % 257;
   return arrCmodAntiAttacks[occ][sq];
}
&amp;nbsp;
U64 fileAttacks(U64 occ, enumSquare sq) {
   const U64 aFile = C64(0x0101010101010101);
   occ = ( (occ &amp;gt;&amp;gt; (sq&amp;amp;7)) &amp;amp; aFile) % 258;
   return arrCmodFileAttacks[occ][sq];
}&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:77:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Castingout255&amp;quot; title=&amp;quot;Anchor: Castingout255&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Castingout255&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:77 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:45:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Modulo vs. Multiplication-Modulo-Casting out 255&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:45 --&gt;Casting out 255&lt;/h3&gt;
For ranks, diagonals or anti-diagonals, where the occupancy mask excludes the sliding piece, and the rank-or byte-wise sum of disjoint bits is therefor less than 255, &lt;a class=&quot;wiki_link&quot; href=&quot;/Population%20Count#Castingout&quot;&gt;Casting out&lt;/a&gt; 256-1 works as well, without any shifts required, and with more space saving options for the lookup table, i. e. similar to Kindergarten Bitboards with shared multiples of first rank attacks and an trailing post-mask with the same line &lt;!-- ws:start:WikiTextRefRule:25:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;amp;t=51996&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Low memory usage attack bitboard generation&amp;lt;/a&amp;gt; by crystalclear, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, October 06, 2011&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:25 --&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;masked occupany  %  256-1            =  A-H    &amp;lt;br/&amp;gt;. . . . . . . H     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . G .     . . . . . . . .     . . . . . . . . &amp;lt;br/&amp;gt;. . . . . F . .     . . . . . . . .     . . . . . . . . &amp;lt;br/&amp;gt;. . . . E . . .     . . . . . . . .     . . . . . . . . &amp;lt;br/&amp;gt;. . . . . . . .  %  . . . . . . . .  =  . . . . . . . . &amp;lt;br/&amp;gt;. . C . . . . .     . . . . . . . .     . . . . . . . . &amp;lt;br/&amp;gt;. B . . . . . .     . . . . . . . .     . . . . . . . . &amp;lt;br/&amp;gt;A . . . . . . .     1 1 1 1 1 1 1 1     A B C . E F G H &amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;masked occupany  %  256-1            =  A-H    
. . . . . . . H     . . . . . . . .     . . . . . . . .
. . . . . . G .     . . . . . . . .     . . . . . . . . 
. . . . . F . .     . . . . . . . .     . . . . . . . . 
. . . . E . . .     . . . . . . . .     . . . . . . . . 
. . . . . . . .  %  . . . . . . . .  =  . . . . . . . . 
. . C . . . . .     . . . . . . . .     . . . . . . . . 
. B . . . . . .     . . . . . . . .     . . . . . . . . 
A . . . . . . .     1 1 1 1 1 1 1 1     A B C . E F G H &lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:47:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Modulo vs. Multiplication-Modulo-Reciprocal Multiplication&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:47 --&gt;Reciprocal Multiplication&lt;/h3&gt;
The 64-bit modulo by a constant can be done most efficiently by &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Modulo&quot;&gt;reciprocal fixed point multiplication&lt;/a&gt;, this is how &lt;a class=&quot;wiki_link&quot; href=&quot;/Microsoft&quot;&gt;Microsoft&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Visual_C%2B%2B&quot; rel=&quot;nofollow&quot;&gt;Visual C++&lt;/a&gt; 2005 compiler implements the mod constant for &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt; processors. One 64*64=128 bit multiplication, one shift, one further 32-bit multiplication , one subtraction. Of course using 64-bit &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Division&quot;&gt;division&lt;/a&gt; to get the remainder burns even more cycles.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;Code:&amp;lt;br/&amp;gt;% 514&amp;lt;br/&amp;gt; mov    r11d, r10 ; masked diagonal&amp;lt;br/&amp;gt; mov    rax, ff00ff00ff00ff01H&amp;lt;br/&amp;gt; mul    r10&amp;lt;br/&amp;gt; shr    rdx, 9&amp;lt;br/&amp;gt; imul   edx, 514 ; 00000202H&amp;lt;br/&amp;gt; sub    r11d, edx&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;% 257&amp;lt;br/&amp;gt; mov    r11d, r10 ; masked diagonal&amp;lt;br/&amp;gt; mov    rax, ff00ff00ff00ff01H&amp;lt;br/&amp;gt; mul    r10&amp;lt;br/&amp;gt; shr    rdx, 8&amp;lt;br/&amp;gt; imul   edx, 257 ; 00000101H&amp;lt;br/&amp;gt; sub    r11d, edx&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;Code:
% 514
 mov    r11d, r10 ; masked diagonal
 mov    rax, ff00ff00ff00ff01H
 mul    r10
 shr    rdx, 9
 imul   edx, 514 ; 00000202H
 sub    r11d, edx
&amp;nbsp;
% 257
 mov    r11d, r10 ; masked diagonal
 mov    rax, ff00ff00ff00ff01H
 mul    r10
 shr    rdx, 8
 imul   edx, 257 ; 00000101H
 sub    r11d, edx&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:49:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Modulo vs. Multiplication-Multiplication&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:49 --&gt;Multiplication&lt;/h2&gt;
 A Kindergarten like approach might look like this (not considering &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;inner six bits&lt;/a&gt;):&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;U64 arrDiagonalAttacks[256][64];  // 128 K&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ = (diagonalMask[sq] &amp;amp;amp; occ) * C64(0x0101010101010101) &amp;amp;gt;&amp;amp;gt; 56;&amp;lt;br/&amp;gt;   return arrDiagonalAttacks[occ][sq];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;U64 arrDiagonalAttacks[256][64];  // 128 K
&amp;nbsp;
U64 diagonalAttacks(U64 occ, enumSquare sq) {
   occ = (diagonalMask[sq] &amp;amp; occ) * C64(0x0101010101010101) &amp;gt;&amp;gt; 56;
   return arrDiagonalAttacks[occ][sq];
}&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;and uses one 64*64=64-bit multiplication, with this &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt; assembly for calculating an eight-bit occupied index:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt; mov    rax, 0101010101010101H&amp;lt;br/&amp;gt; imul   rdx, rax&amp;lt;br/&amp;gt; shr    rdx, 56&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt; mov    rax, 0101010101010101H
 imul   rdx, rax
 shr    rdx, 56&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;Even &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards#FileAttacks&quot;&gt;Kindergarten File-Attacks&lt;/a&gt; are cheaper and faster, not to mention &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt;, which covers two lines of a rook or bishop in one run.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:51:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Fenner&#039;s and Levene&#039;s conclusion&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:51 --&gt;Fenner&#039;s and Levene&#039;s conclusion&lt;/h1&gt;
 Quote from their paper pp 11&lt;br /&gt;
&lt;strong&gt;&lt;tt&gt;3.5. Comparison with other Methods&lt;/tt&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;tt&gt;As reported in Hyatt (2007), the rotated and magic bitboard methods are of comparable performance, and Tannous (2007) claims just a small improvement of the direct lookup method over rotated bitboards. It is easy to see that, in terms of the number of computer operations, the efficiency of our method will be similar to that of direct lookup. Thus we are justified in claiming that the computational efficiency of our method is comparable to the others.&lt;/tt&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
Their conclusion was based on following statement of &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:29:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;amp;p=140141&amp;amp;amp;t=16002&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Robert%20Hyatt&amp;quot;&amp;gt;Robert Hyatt&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt; August 25, 2007&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:29 --&gt; &lt;strong&gt;...&lt;/strong&gt;&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;tt&gt;I had reported this earlier. Magic was no faster than rotated. I switched because of two things...&lt;/tt&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;tt&gt;1. Magic is simpler, and simpler is better as I get older.&lt;/tt&gt;&lt;/li&gt;&lt;li&gt;&lt;tt&gt;2. Magic gives you the opportunity to update the occupied_squares and then generate moves easily.&lt;/tt&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;tt&gt;To do this with rotated bitboards first requires that all rotated bitboards be updated in addition to the normal occupied_squares bitboard. This is faster, if you use the feature (I don&#039;t yet, but well might at times).&lt;/tt&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;strong&gt;...&lt;/strong&gt; and this claim of &lt;a class=&quot;wiki_link&quot; href=&quot;/Sam%20Tannous&quot;&gt;Sam Tannous&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:37:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Sam%20Tannous&amp;quot;&amp;gt;Sam Tannous&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;2007&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;Avoiding Rotated Bitboards with Direct Lookup&amp;lt;/em&amp;gt;. &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/ICGA%20Journal#30_2&amp;quot;&amp;gt;ICGA Journal, Vol. 30, No. 2&amp;lt;/a&amp;gt;, pp. 85-91, &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://arxiv.org/PS_cache/arxiv/pdf/0704/0704.3773v2.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;pdf&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:37 --&gt;:&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;tt&gt;The results shown indicate that directly looking up the attacking moves for sliding pieces in hash tables improves the move generation speeds from 10% to 15% depending on computer architecture. Further efficiencies can be expected in a full implementation where the overhead of maintaining rotated bitboards is eliminated. The implementation and test code is made available in an Open-Source, interactive, chess programming module called “Shatranj” (Tannous, 2006).&lt;/tt&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:53:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Publications&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:53 --&gt;Publications&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://sun.aei.polsl.pl/~zjc/&quot; rel=&quot;nofollow&quot;&gt;Zbigniew J. Czech&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://itee.uq.edu.au/~havas/&quot; rel=&quot;nofollow&quot;&gt;George Havas&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.informatik.uni-trier.de/~ley/db/indices/a-tree/m/Majewski:Bohdan_S=.html&quot; rel=&quot;nofollow&quot;&gt;Bohdan S. Majewski&lt;/a&gt; (&lt;strong&gt;1997&lt;/strong&gt;). &lt;em&gt;Perfect Hashing&lt;/em&gt;. Theoretical Computer Science, Vol. 182, Nos. 1-2, pp. 1-143&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Trevor%20Fenner&quot;&gt;Trevor Fenner&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Mark%20Levene&quot;&gt;Mark Levene&lt;/a&gt; (&lt;strong&gt;2008&lt;/strong&gt;). &lt;em&gt;Move Generation with Perfect Hashing Functions.&lt;/em&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal#31_1&quot;&gt;ICGA Journal, Vol. 31, No. 1&lt;/a&gt;, pp. 3-12. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.dcs.bbk.ac.uk/~mark/download/bitboard_sliding_icga_final.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:55:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:55 --&gt;Forum Posts&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=20913&quot; rel=&quot;nofollow&quot;&gt;Nice Math - Strange Conclusions&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, April 29, 2008&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=51996&quot; rel=&quot;nofollow&quot;&gt;Low memory usage attack bitboard generation&lt;/a&gt; by crystalclear, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, October 06, 2011&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:57:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc9&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:57 --&gt;External Links&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Congruence_relation&quot; rel=&quot;nofollow&quot;&gt;Congruence relation from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Linear_congruence_theorem&quot; rel=&quot;nofollow&quot;&gt;Linear congruence theorem from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Modular_arithmetic&quot; rel=&quot;nofollow&quot;&gt;Modular arithmetic from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Modulo_operation&quot; rel=&quot;nofollow&quot;&gt;Modulo operation from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:59:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc10&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:59 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:284:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Trevor%20Fenner&quot;&gt;Trevor Fenner&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Mark%20Levene&quot;&gt;Mark Levene&lt;/a&gt; (&lt;strong&gt;2008&lt;/strong&gt;). &lt;em&gt;Move Generation with Perfect Hashing Functions.&lt;/em&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal#31_1&quot;&gt;ICGA Journal, Vol. 31, No. 1&lt;/a&gt;, pp. 3-12. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.dcs.bbk.ac.uk/~mark/download/bitboard_sliding_icga_final.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=20913&quot; rel=&quot;nofollow&quot;&gt;Nice Math - Strange Conclusions&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, April 29, 2008&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=51996&quot; rel=&quot;nofollow&quot;&gt;Low memory usage attack bitboard generation&lt;/a&gt; by crystalclear, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, October 06, 2011&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=140141&amp;amp;t=16002&quot; rel=&quot;nofollow&quot;&gt;Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt; August 25, 2007&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Sam%20Tannous&quot;&gt;Sam Tannous&lt;/a&gt; (&lt;strong&gt;2007&lt;/strong&gt;). &lt;em&gt;Avoiding Rotated Bitboards with Direct Lookup&lt;/em&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal#30_2&quot;&gt;ICGA Journal, Vol. 30, No. 2&lt;/a&gt;, pp. 85-91, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://arxiv.org/PS_cache/arxiv/pdf/0704/0704.3773v2.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:284 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:61:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc11&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:61 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:05:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Congruent Modulo Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;10&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Congruent Modulo Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;10&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Congruent_Modulo_Bitboards includeBody-Congruent%20Modulo%20Bitboards includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Congruent+Modulo+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Congruent Modulo Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 26, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Efficient Generation of Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/General+Setwise+Operations&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;General Setwise Operations&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hash+Table&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hash Table&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/ICGA+Journal&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;ICGA Journal&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 21, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mark+Levene&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mark Levene&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Trevor+Fenner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Trevor Fenner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2015&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:05 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>CPW-Engine_attacks</title>
      <link>https://chessprogramming.wikispaces.com/CPW-Engine_attacks</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/CPW-Engine_attacks</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/CPW-Engine_attacks</comments>
      <pubDate>Tue, 30 Dec 2014 18:39:57 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:12:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:12 --&gt;&lt;!-- ws:start:WikiTextTocRule:13: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#isAttacked&quot;&gt;isAttacked&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:13 --&gt;&lt;!-- ws:start:WikiTextTocRule:14: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#leaperAttack&quot;&gt;leaperAttack&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:14 --&gt;&lt;!-- ws:start:WikiTextTocRule:15: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#straightAttack&quot;&gt;straightAttack&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:15 --&gt;&lt;!-- ws:start:WikiTextTocRule:16: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#diagAttack&quot;&gt;diagAttack&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:16 --&gt;&lt;!-- ws:start:WikiTextTocRule:17: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:17 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Engines&quot;&gt;Engines&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/CPW-Engine&quot;&gt;CPW-Engine&lt;/a&gt; * Attacks&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
This page holds the functions responsible for detecting if a given square is attacked by a given player.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:4:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;isAttacked&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:4 --&gt;isAttacked&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;amp;quot;stdafx.h&amp;amp;quot;&amp;lt;br/&amp;gt;#include &amp;amp;quot;0x88_math.h&amp;amp;quot;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;int isAttacked( char byColor, S8 sq ) {&amp;lt;br/&amp;gt;/* pawns */&amp;lt;br/&amp;gt;if ( byColor == WHITE ) {&amp;lt;br/&amp;gt;   if ( IS_SQ( sq + SE ) &amp;amp;amp;&amp;amp;amp;&amp;lt;br/&amp;gt;        isPiece( WHITE, PAWN, sq + SE )&amp;lt;br/&amp;gt;      )&amp;lt;br/&amp;gt;      return 1;&amp;lt;br/&amp;gt;   if ( IS_SQ( sq + SW ) &amp;amp;amp;&amp;amp;amp;&amp;lt;br/&amp;gt;        isPiece( WHITE, PAWN, sq + SW )&amp;lt;br/&amp;gt;      )&amp;lt;br/&amp;gt;      return 1;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;else {&amp;lt;br/&amp;gt;   if ( IS_SQ( sq + NE ) &amp;amp;amp;&amp;amp;amp;&amp;lt;br/&amp;gt;        isPiece( BLACK, PAWN, sq + NE )&amp;lt;br/&amp;gt;      )&amp;lt;br/&amp;gt;      return 1;&amp;lt;br/&amp;gt;   if ( IS_SQ( sq + NW ) &amp;amp;amp;&amp;amp;amp;&amp;lt;br/&amp;gt;        isPiece( BLACK, PAWN, sq + NW )&amp;lt;br/&amp;gt;      )&amp;lt;br/&amp;gt;      return 1;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;/* knights */&amp;lt;br/&amp;gt;if ( leaperAttack( byColor, sq, KNIGHT ) )&amp;lt;br/&amp;gt;   return 1;&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; /* kings */&amp;lt;br/&amp;gt;if ( leaperAttack( byColor, sq, KING ) )&amp;lt;br/&amp;gt;   return 1;&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; /* straight line sliders */&amp;lt;br/&amp;gt;    if ( straightAttack( byColor, sq, NORTH ) ||&amp;lt;br/&amp;gt;         straightAttack( byColor, sq, SOUTH ) ||&amp;lt;br/&amp;gt;         straightAttack( byColor, sq, EAST  ) ||&amp;lt;br/&amp;gt;         straightAttack( byColor, sq, WEST  )&amp;lt;br/&amp;gt;       )&amp;lt;br/&amp;gt;       return 1;&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; /* diagonal sliders */&amp;lt;br/&amp;gt;    if ( diagAttack( byColor, sq, NE ) ||&amp;lt;br/&amp;gt;         diagAttack( byColor, sq, SE ) ||&amp;lt;br/&amp;gt;         diagAttack( byColor, sq, NW ) ||&amp;lt;br/&amp;gt;         diagAttack( byColor, sq, SW )&amp;lt;br/&amp;gt;       )&amp;lt;br/&amp;gt;       return 1;&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;    return 0;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#include &amp;quot;stdafx.h&amp;quot;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#include &amp;quot;0x88_math.h&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; isAttacked&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; byColor, S8 sq &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
&lt;span class=&quot;coMULTI&quot;&gt;/* pawns */&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; WHITE &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; IS_SQ&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; SE &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        isPiece&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; WHITE, PAWN, sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; SE &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; IS_SQ&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; SW &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        isPiece&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; WHITE, PAWN, sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; SW &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; IS_SQ&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; NE &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        isPiece&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; BLACK, PAWN, sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; NE &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; IS_SQ&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; NW &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        isPiece&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; BLACK, PAWN, sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; NW &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;coMULTI&quot;&gt;/* knights */&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; leaperAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, KNIGHT &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span class=&quot;coMULTI&quot;&gt;/* kings */&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; leaperAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, KING &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span class=&quot;coMULTI&quot;&gt;/* straight line sliders */&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; straightAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, NORTH &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt;
         straightAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, SOUTH &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt;
         straightAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, EAST  &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt;
         straightAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, WEST  &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span class=&quot;coMULTI&quot;&gt;/* diagonal sliders */&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; diagAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, NE &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt;
         diagAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, SE &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt;
         diagAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, NW &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt;
         diagAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, sq, SW &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:6:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;leaperAttack&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:6 --&gt;leaperAttack&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int leaperAttack( char byColor, S8 sq, char byPiece ) {&amp;lt;br/&amp;gt;    S8 nextSq;&amp;lt;br/&amp;gt;    for ( int dir = 0; dir &amp;amp;lt; 8; dir++ ) {&amp;lt;br/&amp;gt;        nextSq = sq + vector[byPiece][dir];&amp;lt;br/&amp;gt;        if ( IS_SQ(nextSq) &amp;amp;amp;&amp;amp;amp;&amp;lt;br/&amp;gt;             isPiece( byColor, byPiece, nextSq )&amp;lt;br/&amp;gt;           )&amp;lt;br/&amp;gt;           return 1;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;    return 0;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; leaperAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; byColor, S8 sq, &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; byPiece &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    S8 nextSq&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dir &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; dir &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; dir&lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        nextSq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; vector&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;byPiece&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; IS_SQ&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
             isPiece&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byColor, byPiece, nextSq &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:8:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;straightAttack&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:8 --&gt;straightAttack&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int straightAttack(char byColor, S8 sq, int vect) {&amp;lt;br/&amp;gt;    int nextSq = sq + vect;&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;    while ( IS_SQ(nextSq) ) {&amp;lt;br/&amp;gt;       if (b.color[nextSq] != COLOR_EMPTY ) {&amp;lt;br/&amp;gt;           if ( ( b.color[nextSq] == byColor ) &amp;amp;amp;&amp;amp;amp;&amp;lt;br/&amp;gt;                ( b.pieces[nextSq] == ROOK || b.pieces[nextSq] == QUEEN )&amp;lt;br/&amp;gt;              )&amp;lt;br/&amp;gt;              return 1;&amp;lt;br/&amp;gt;           return 0;&amp;lt;br/&amp;gt;          }&amp;lt;br/&amp;gt;       nextSq = nextSq + vect;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;     return 0;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; straightAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; byColor, S8 sq, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; vect&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; nextSq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; vect&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; IS_SQ&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
       &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b.&lt;span class=&quot;me1&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; COLOR_EMPTY &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
           &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; b.&lt;span class=&quot;me1&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; byColor &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
                &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; b.&lt;span class=&quot;me1&quot;&gt;pieces&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; ROOK &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt; b.&lt;span class=&quot;me1&quot;&gt;pieces&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; QUEEN &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
           &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
       nextSq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; nextSq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; vect&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
     &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:10:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;diagAttack&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:10 --&gt;diagAttack&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int diagAttack(int byColor, S8 sq, int vect) {&amp;lt;br/&amp;gt;    int nextSq = sq + vect;&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;    while ( IS_SQ( nextSq ) ) {&amp;lt;br/&amp;gt;       if (b.color[ nextSq ] != COLOR_EMPTY ) {&amp;lt;br/&amp;gt;           if ( ( b.color[nextSq] == byColor ) &amp;amp;amp;&amp;amp;amp;&amp;lt;br/&amp;gt;                ( b.pieces[nextSq] == BISHOP || b.pieces[nextSq] == QUEEN )&amp;lt;br/&amp;gt;              )&amp;lt;br/&amp;gt;              return 1;&amp;lt;br/&amp;gt;           return 0;&amp;lt;br/&amp;gt;          }&amp;lt;br/&amp;gt;       nextSq = nextSq + vect;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;    return 0;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; diagAttack&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; byColor, S8 sq, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; vect&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; nextSq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; vect&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; IS_SQ&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; nextSq &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
       &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b.&lt;span class=&quot;me1&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt; nextSq &lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; COLOR_EMPTY &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
           &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; b.&lt;span class=&quot;me1&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; byColor &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;
                &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; b.&lt;span class=&quot;me1&quot;&gt;pieces&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; BISHOP &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt; b.&lt;span class=&quot;me1&quot;&gt;pieces&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;nextSq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; QUEEN &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
           &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
       nextSq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; nextSq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; vect&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/CPW-Engine&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Discovered Attack</title>
      <link>https://chessprogramming.wikispaces.com/Discovered+Attack</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Discovered+Attack</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Discovered+Attack</comments>
      <pubDate>Mon, 08 Nov 2010 13:38:01 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Chess&quot;&gt;Chess&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Tactics&quot;&gt;Tactics&lt;/a&gt; * Discovered Attack&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
A &lt;strong&gt;Discovered Attack&lt;/strong&gt; is a &lt;a class=&quot;wiki_link&quot; href=&quot;/X-ray&quot;&gt;X-ray&lt;/a&gt; related chess tactic, revealed when one piece moves out of the way of a &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Pieces&quot;&gt;sliding piece&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Rays&quot;&gt;ray&lt;/a&gt;, discovering an attack to &lt;a class=&quot;wiki_link&quot; href=&quot;/Squares&quot;&gt;squares&lt;/a&gt;, opponent pieces or the &lt;a class=&quot;wiki_link&quot; href=&quot;/King&quot;&gt;king&lt;/a&gt;, the latter case called a &lt;a class=&quot;wiki_link&quot; href=&quot;/Discovered%20Check&quot;&gt;Discovered Check&lt;/a&gt;. Discovered attacks can be extremely powerful, as the piece moved can make a threat independently of the piece it reveals.&lt;br /&gt;
&lt;br /&gt;
During &lt;a class=&quot;wiki_link&quot; href=&quot;/Move%20Generation&quot;&gt;move generation&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Move%20Ordering&quot;&gt;move ordering&lt;/a&gt;, one may encourage discovering moves by considering &lt;a class=&quot;wiki_link&quot; href=&quot;/Origin%20Square&quot;&gt;origin squares&lt;/a&gt; attacked by an own sliding pieces, as well as the resulting attacking &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;direction&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:1:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:1 --&gt;See also&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Discovered%20Check&quot;&gt;Discovered Check&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Double%20Attack&quot;&gt;Double Attack&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Double%20Check&quot;&gt;Double Check&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Attacked%20By&quot;&gt;Square Attacked By&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/X-ray&quot;&gt;X-ray&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/X-ray%20Attacks%20%28Bitboards%29&quot;&gt;X-ray Attacks (Bitboards)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:3:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:3 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Discovered_attack&quot; rel=&quot;nofollow&quot;&gt;Discovered attack from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chesscorner.com/tutorial/tactics/discovered/discovered.htm&quot; rel=&quot;nofollow&quot;&gt;Chess Corner - Chess Tutorial - Discovered Attacks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chesstactics.org/index.php?Type=page&amp;amp;Action=none&amp;amp;From=3,1,1,1&quot; rel=&quot;nofollow&quot;&gt;The Discovered Attack&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chesstactics.org/&quot; rel=&quot;nofollow&quot;&gt;Ward Farnsworth&#039;s Predator at the Chessboard&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:5:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:5 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:00:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Discovered Attack&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Discovered Attack&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Discovered_Attack includeBody-Discovered%20Attack includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Battery&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Battery&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 29, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/CAPS&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;CAPS&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Combination&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Combination&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 25, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dartmouth+CP&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dartmouth CP&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 19, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dictionary&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dictionary&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 24, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Discovered+Attack&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Discovered Attack&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 8, 2010&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Discovered+Check&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Discovered Check&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Double+Attack&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Double Attack&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 22, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Double+Check&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Double Check&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 4, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Move+Ordering&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Move Ordering&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 27, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Moves&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Moves&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 19, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Overloading&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Overloading&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Pieces&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Pieces&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 3, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tactics&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tactics&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 12, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/X-ray&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;X-ray&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 12, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/X-ray+Attacks+%28Bitboards%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;X-ray Attacks (Bitboards)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 31, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Zwischenzug&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Zwischenzug&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 15, 2014&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:00 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Tactics&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Double Attack</title>
      <link>https://chessprogramming.wikispaces.com/Double+Attack</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Double+Attack</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Double+Attack</comments>
      <pubDate>Wed, 22 Oct 2014 10:12:03 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Chess&quot;&gt;Chess&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Tactics&quot;&gt;Tactics&lt;/a&gt; * Double Attack&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:72:&amp;lt;a href=&amp;quot;http://commons.wikimedia.org/wiki/File:Le_duelliste_%C3%A0_l%27%C3%A9p%C3%A9e_et_au_poignard.jpg&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/Le_duelliste_%C3%A0_l%27%C3%A9p%C3%A9e_et_au_poignard.jpg/527605724/286x207/Le_duelliste_%C3%A0_l%27%C3%A9p%C3%A9e_et_au_poignard.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;height: 207px; width: 286px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://commons.wikimedia.org/wiki/File:Le_duelliste_%C3%A0_l%27%C3%A9p%C3%A9e_et_au_poignard.jpg&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/Le_duelliste_%C3%A0_l%27%C3%A9p%C3%A9e_et_au_poignard.jpg/527605724/286x207/Le_duelliste_%C3%A0_l%27%C3%A9p%C3%A9e_et_au_poignard.jpg&quot; alt=&quot;Le_duelliste_à_l&#039;épée_et_au_poignard.jpg&quot; title=&quot;Le_duelliste_à_l&#039;épée_et_au_poignard.jpg&quot; style=&quot;height: 207px; width: 286px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:72 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;A &lt;strong&gt;Double Attack&lt;/strong&gt; attacks two or more pieces or important squares simultaneously with one &lt;a class=&quot;wiki_link&quot; href=&quot;/Moves&quot;&gt;move&lt;/a&gt;, either by &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Fork_%28chess%29&quot; rel=&quot;nofollow&quot;&gt;forking&lt;/a&gt; with the moving piece, or at least by a single direct attack of the moving piece in conjunction with a &lt;a class=&quot;wiki_link&quot; href=&quot;/Discovered%20Attack&quot;&gt;discovered attack&lt;/a&gt;. The so called royal knight fork winning the queen is most important, but like other double attacks involving &lt;a class=&quot;wiki_link&quot; href=&quot;/Check&quot;&gt;checks&lt;/a&gt; already covered by usual move selection heuristics.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Le duelliste à l&#039;épée et au poignard &lt;!-- ws:start:WikiTextRefRule:6:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Arts#Callot&amp;quot;&amp;gt;Jacques Callot&amp;lt;/a&amp;gt; - &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://commons.wikimedia.org/wiki/File:Le_duelliste_%C3%A0_l%27%C3%A9p%C3%A9e_et_au_poignard.jpg&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Le duelliste à l&#039;épée et au poignard&amp;lt;/a&amp;gt;, 1621-1625, Source: &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://gallica.bnf.fr/ark:/12148/btv1b8495739c/f1.item&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Les Gobbi, Le duelliste à l&#039;épée et au poignard : estampe / Jacques Callot&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Biblioth%C3%A8que_nationale_de_France&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Bibliothèque nationale de France&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://commons.wikimedia.org/wiki/Category:Jacques_Callot&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Category:Jacques Callot&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Wikimedia_Commons&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Wikimedia Commons&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:6 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:22:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:22 --&gt;&lt;!-- ws:start:WikiTextTocRule:23: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Seeing Potential Forks&quot;&gt;Seeing Potential Forks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:23 --&gt;&lt;!-- ws:start:WikiTextTocRule:24: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Seeing Potential Forks-Knight and Pawn&quot;&gt;Knight and Pawn&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:24 --&gt;&lt;!-- ws:start:WikiTextTocRule:25: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Seeing Potential Forks-Sliding Pieces&quot;&gt;Sliding Pieces&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:25 --&gt;&lt;!-- ws:start:WikiTextTocRule:26: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:26 --&gt;&lt;!-- ws:start:WikiTextTocRule:27: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:27 --&gt;&lt;!-- ws:start:WikiTextTocRule:28: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:28 --&gt;&lt;!-- ws:start:WikiTextTocRule:29: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:29 --&gt;&lt;!-- ws:start:WikiTextTocRule:30: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:30 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:8:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Seeing Potential Forks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:8 --&gt;Seeing Potential Forks&lt;/h1&gt;
 Like a &lt;a class=&quot;wiki_link&quot; href=&quot;/Skewer&quot;&gt;skewer&lt;/a&gt; or other &lt;a class=&quot;wiki_link&quot; href=&quot;/Tactical%20Moves&quot;&gt;tactical threats&lt;/a&gt;, it might be nice to determine the availability of forks in advance, to either try those moves early, to don&#039;t &lt;a class=&quot;wiki_link&quot; href=&quot;/Pruning&quot;&gt;prune&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Reductions&quot;&gt;reduce&lt;/a&gt; them, or even to try them at the &lt;a class=&quot;wiki_link&quot; href=&quot;/Horizon%20Node&quot;&gt;horizon&lt;/a&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/Quiescence%20Search&quot;&gt;quiescence search&lt;/a&gt;. As always, it depends on the &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;board representation&lt;/a&gt; and the availability of appropriate data structures like &lt;a class=&quot;wiki_link&quot; href=&quot;/Attack%20and%20Defend%20Maps&quot;&gt;Attack and Defend Maps&lt;/a&gt;, whether additional effort in determination of fork pattern, what kind of pieces to consider etc., makes sense and pay off.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:10:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Seeing Potential Forks-Knight and Pawn&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:10 --&gt;Knight and Pawn&lt;/h2&gt;
 A common technique in &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;bitboards&lt;/a&gt; to determine fork move target sets for respective pieces is to treat potential opponent targets as the kind of piece which may fork, and to pairwise &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Intersection&quot;&gt;intersect&lt;/a&gt; all their disjoint direction attacks, as demonstrated in &lt;a class=&quot;wiki_link&quot; href=&quot;/Knight%20Pattern#KnightForks&quot;&gt;knight forks&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
Pawn fork targets have only two different and contact attacking directions. For instance, white pawn fork targets need the intersection of east and west black &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20Attacks%20%28Bitboards%29&quot;&gt;pawn attacks&lt;/a&gt; of all black pieces, excluding the guarding real black pawn attacks. If this resulting set intersects with white &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20Pushes%20%28Bitboards%29&quot;&gt;pawn push targets&lt;/a&gt;, white has likely (considering &lt;a class=&quot;wiki_link&quot; href=&quot;/Pin&quot;&gt;pins&lt;/a&gt;) one or more pawn forks.&lt;br /&gt;
&lt;br /&gt;
Single pawn and knight forks are easy to determine with any board representation, since the patterns are simple. For knight forks one may rely on &lt;a class=&quot;wiki_link&quot; href=&quot;/Knight-Distance&quot;&gt;knight-distance&lt;/a&gt; of two, implying the precondition of &lt;a class=&quot;wiki_link&quot; href=&quot;/Color%20of%20a%20Square#SameColor&quot;&gt;same square color&lt;/a&gt; between all potential attacking targets and one own attacking knight.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:12:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Seeing Potential Forks-Sliding Pieces&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:12 --&gt;Sliding Pieces&lt;/h2&gt;
 For &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Pieces&quot;&gt;sliding piece&lt;/a&gt; forks, &lt;a class=&quot;wiki_link&quot; href=&quot;/Mailbox&quot;&gt;Mailbox&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/0x88&quot;&gt;0x88&lt;/a&gt; based board representations may rely on techniques as described in &lt;a class=&quot;wiki_link&quot; href=&quot;/Intersection%20Squares&quot;&gt;Intersection Squares&lt;/a&gt;, while it seems bitboards have an edge using attack set intersection of a pair of targets.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:14:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:14 --&gt;See also&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Knight%20Pattern#KnightForks&quot;&gt;Knight Forks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Discovered%20Attack&quot;&gt;Discovered Attack&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Discovered%20Check&quot;&gt;Discovered Check&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Double%20Check&quot;&gt;Double Check&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Skewer&quot;&gt;Skewer&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:16:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:16 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Fork_%28chess%29&quot; rel=&quot;nofollow&quot;&gt;Fork (chess) from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Discovered_attack&quot; rel=&quot;nofollow&quot;&gt;Discovered attack from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.top10chess.com/2008/09/tactical-motif-i-double-attack.html&quot; rel=&quot;nofollow&quot;&gt;Top 10 chess: Tactical Motif I: Double Attack&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chesstactics.org/index.php?Type=page&amp;amp;Action=none&amp;amp;From=2,1,1,1&quot; rel=&quot;nofollow&quot;&gt;The Double Attack&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chesstactics.org/&quot; rel=&quot;nofollow&quot;&gt;Ward Farnsworth&#039;s Predator at the Chessboard&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.mark-weeks.com/aboutcom/aa03d05.htm&quot; rel=&quot;nofollow&quot;&gt;Middle game - Double attacks&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Mark%20Weeks&quot;&gt;Mark Weeks&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:18:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:18 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:139:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#Callot&quot;&gt;Jacques Callot&lt;/a&gt; - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://commons.wikimedia.org/wiki/File:Le_duelliste_%C3%A0_l%27%C3%A9p%C3%A9e_et_au_poignard.jpg&quot; rel=&quot;nofollow&quot;&gt;Le duelliste à l&#039;épée et au poignard&lt;/a&gt;, 1621-1625, Source: &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://gallica.bnf.fr/ark:/12148/btv1b8495739c/f1.item&quot; rel=&quot;nofollow&quot;&gt;Les Gobbi, Le duelliste à l&#039;épée et au poignard : estampe / Jacques Callot&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Biblioth%C3%A8que_nationale_de_France&quot; rel=&quot;nofollow&quot;&gt;Bibliothèque nationale de France&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://commons.wikimedia.org/wiki/Category:Jacques_Callot&quot; rel=&quot;nofollow&quot;&gt;Category:Jacques Callot&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Wikimedia_Commons&quot; rel=&quot;nofollow&quot;&gt;Wikimedia Commons&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:139 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:20:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc6&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:20 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:00:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Double Attack&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;60&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Double Attack&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;60&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Double_Attack includeBody-Double%20Attack includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/AI+Chess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;AI Chess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/BigLion&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;BigLion&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 28, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chenard&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chenard&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 5, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Combination&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Combination&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 25, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dartmouth+CP&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dartmouth CP&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 19, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Decoying&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Decoying&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 12, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dictionary&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dictionary&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 24, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Discovered+Attack&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Discovered Attack&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 8, 2010&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Double+Attack&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Double Attack&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 22, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Double+Check&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Double Check&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 4, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gibbon&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gibbon&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 23, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hanging+Piece&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hanging Piece&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kaissa&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kaissa&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 9, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Knowledge&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Knowledge&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 22, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Loose+Piece&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Loose Piece&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 10, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Moves&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Moves&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 19, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Paradise&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Paradise&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 19, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Skewer&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Skewer&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 22, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tactics&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tactics&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 12, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Treebeard&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Treebeard&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 25, 2015&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:00 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Tactics&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Dumb7Fill</title>
      <link>https://chessprogramming.wikispaces.com/Dumb7Fill</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Dumb7Fill</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Dumb7Fill</comments>
      <pubDate>Fri, 27 May 2016 08:32:45 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:41:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:41 --&gt;&lt;!-- ws:start:WikiTextTocRule:42: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Occluded Fill&quot;&gt;Occluded Fill&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:42 --&gt;&lt;!-- ws:start:WikiTextTocRule:43: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Occluded Fill-Seven Fill Cycles&quot;&gt;Seven Fill Cycles&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:43 --&gt;&lt;!-- ws:start:WikiTextTocRule:44: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Occluded Fill-Fill Loop&quot;&gt;Fill Loop&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:44 --&gt;&lt;!-- ws:start:WikiTextTocRule:45: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Occluded Fill-Unrolled Loop&quot;&gt;Unrolled Loop&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:45 --&gt;&lt;!-- ws:start:WikiTextTocRule:46: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Attack Fill&quot;&gt;Attack Fill&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:46 --&gt;&lt;!-- ws:start:WikiTextTocRule:47: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Attack Fill-Comparison with Kogge-Stone&quot;&gt;Comparison with Kogge-Stone&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:47 --&gt;&lt;!-- ws:start:WikiTextTocRule:48: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Attack Fill-All Directions&quot;&gt;All Directions&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:48 --&gt;&lt;!-- ws:start:WikiTextTocRule:49: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Generalized Rays&quot;&gt;Generalized Rays&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:49 --&gt;&lt;!-- ws:start:WikiTextTocRule:50: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Generalized Rays-Loop Version&quot;&gt;Loop Version&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:50 --&gt;&lt;!-- ws:start:WikiTextTocRule:51: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Generalized Rays-Unrolled Attacks&quot;&gt;Unrolled Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:51 --&gt;&lt;!-- ws:start:WikiTextTocRule:52: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:52 --&gt;&lt;!-- ws:start:WikiTextTocRule:53: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:53 --&gt;&lt;!-- ws:start:WikiTextTocRule:54: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:54 --&gt;&lt;!-- ws:start:WikiTextTocRule:55: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:55 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Dumb7Fill&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Dumb7Fill&lt;/strong&gt; - the obvious, straight forward &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Flood_fill&quot; rel=&quot;nofollow&quot;&gt;flood-fill&lt;/a&gt; approach works &lt;strong&gt;set-wise&lt;/strong&gt; - &lt;strong&gt;seven&lt;/strong&gt; times one fill-cycle by &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;one step only&lt;/a&gt; in one of eight &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;directions&lt;/a&gt;. We rely on the &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Compass_rose&quot; rel=&quot;nofollow&quot;&gt;compass rose&lt;/a&gt; to identify ray-directions.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;  noWe         nort         noEa&amp;lt;br/&amp;gt;          +7    +8    +9&amp;lt;br/&amp;gt;              \  |  /&amp;lt;br/&amp;gt;  west    -1 &amp;amp;lt;-  0 -&amp;amp;gt; +1    east&amp;lt;br/&amp;gt;              /  |  \&amp;lt;br/&amp;gt;          -9    -8    -7&amp;lt;br/&amp;gt;  soWe         sout         soEa&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;  noWe         nort         noEa
          +7    +8    +9
              \  |  /
  west    -1 &amp;lt;-  0 -&amp;gt; +1    east
              /  |  \
          -9    -8    -7
  soWe         sout         soEa&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;!-- ws:start:WikiTextIncludeRule:012:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/page?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; title=&amp;quot;Include page: page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;

&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a href=&quot;/Square%20Mapping%20Considerations&quot;&gt;&lt;img src=&quot;/file/view/mapping.JPG/93134172/mapping.JPG&quot; alt=&quot;mapping.JPG&quot; title=&quot;mapping.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;em&gt;Code samples and bitboard diagrams rely on &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations#LittleEndianRankFileMapping&quot;&gt;Little endian file and rank mapping&lt;/a&gt;&lt;/em&gt;.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:end:WikiTextIncludeRule:012 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:56:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@OccludedFill&amp;quot; title=&amp;quot;Anchor: OccludedFill&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;OccludedFill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:56 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:15:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Occluded Fill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:15 --&gt;Occluded Fill&lt;/h1&gt;
 An &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.thefreedictionary.com/occluded&quot; rel=&quot;nofollow&quot;&gt;occluded&lt;/a&gt; fill includes the flood generating &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Pieces&quot;&gt;sliding pieces&lt;/a&gt;, but excludes the blocker. It is base of attack fills. One additional &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;direction shift&lt;/a&gt; excludes the sliders but includes the blocker.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:17:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Occluded Fill-Seven Fill Cycles&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:17 --&gt;Seven Fill Cycles&lt;/h2&gt;
 The sliding pieces generate the flood. They were &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;shifted one step&lt;/a&gt; in the desired direction and &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Intersection&quot;&gt;intersected&lt;/a&gt; with the set of empty squares, the propagator. The flood aggregates the intersection and the cycle repeats six further times to cover the maximum &lt;a class=&quot;wiki_link&quot; href=&quot;/Distance&quot;&gt;distance&lt;/a&gt; on the &lt;a class=&quot;wiki_link&quot; href=&quot;/Chessboard&quot;&gt;chessboard&lt;/a&gt;. A blocker, not member of propagator, stops the flood in that particular ray-direction for one sliding piece. Therefor occluded fill contains the initial generator but excludes any blocker.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   for (int cycle = 0; cycle &amp;amp;lt; 7; cycle++)&amp;lt;br/&amp;gt;      gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 8);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; cycle &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; cycle &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; cycle&lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:19:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Occluded Fill-Fill Loop&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:19 --&gt;Fill Loop&lt;/h2&gt;
 Alternatively one may save move-instructions by introducing an explicit flood accumulator, and to probably terminate the loop early if the flood stops:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   U64 flood = 0;&amp;lt;br/&amp;gt;   while (gen) {&amp;lt;br/&amp;gt;      flood |= gen;&amp;lt;br/&amp;gt;      gen = (gen &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;   }&amp;lt;br/&amp;gt;   return flood;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      gen &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; flood&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:21:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Occluded Fill-Unrolled Loop&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:21 --&gt;Unrolled Loop&lt;/h2&gt;
 To &lt;a class=&quot;wiki_link&quot; href=&quot;/Avoiding%20Branches&quot;&gt;avoid conditional branches&lt;/a&gt; and to schedule several directions in parallel, the &amp;quot;real&amp;quot; dumb7fill unrolls the loop:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   U64 flood = gen;&amp;lt;br/&amp;gt;   flood |= gen = (gen &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;   flood |= gen = (gen &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;   flood |= gen = (gen &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;   flood |= gen = (gen &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;   flood |= gen = (gen &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;   flood |= gen = (gen &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;   flood |=       (gen &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;   return flood;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; flood&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;Some south fill cycles in slow motion:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;flood = gen =&amp;lt;br/&amp;gt;brooks|bqueen       empty&amp;lt;br/&amp;gt;1 . . . . . . .     . 1 1 1 1 1 . 1&amp;lt;br/&amp;gt;. . . 1 . . . .     1 1 . . 1 . 1 .&amp;lt;br/&amp;gt;. . . . . . . .     1 . 1 1 1 1 . 1&amp;lt;br/&amp;gt;. . . . . . . .     1 1 . 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . 1 . .     1 1 1 . 1 . 1 1&amp;lt;br/&amp;gt;. . . . . . . .     1 1 . 1 1 1 1 .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 1 . . 1&amp;lt;br/&amp;gt;. . . . . . . .     . 1 1 . 1 1 . 1&amp;lt;br/&amp;gt;1.fill&amp;lt;br/&amp;gt; gen = gen &amp;amp;gt;&amp;amp;gt; 8   &amp;amp;amp;  empty           =&amp;amp;gt;  flood&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . . . . . .&amp;lt;br/&amp;gt;1 . . . . . . .      1 . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;. . . 1 . . . .      . . . 1 . . . .     . . . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . 1 . .      . . . . . 1 . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;2.fill&amp;lt;br/&amp;gt; gen = gen &amp;amp;gt;&amp;amp;gt; 8   &amp;amp;amp;  empty               flood  |= ...&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;1 . . . . . . .      1 . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;. . . 1 . . . .      . . . 1 . . . .     . . . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . 1 . .      . . . . . 0 . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;3.fill&amp;lt;br/&amp;gt; gen = gen &amp;amp;gt;&amp;amp;gt; 8   &amp;amp;amp;  empty               flood |= ...&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;1 . . . . . . .      1 . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;. . . 1 . . . .      . . . 0 . . . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;...&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;6.fill&amp;lt;br/&amp;gt; gen = gen &amp;amp;gt;&amp;amp;gt; 8  &amp;amp;amp;   empty               flood  |= ...&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     1 . . . . 1 . .&amp;lt;br/&amp;gt;1 . . . . . . .      0 . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;flood = gen =
brooks|bqueen       empty
1 . . . . . . .     . 1 1 1 1 1 . 1
. . . 1 . . . .     1 1 . . 1 . 1 .
. . . . . . . .     1 . 1 1 1 1 . 1
. . . . . . . .     1 1 . 1 1 1 1 1
. . . . . 1 . .     1 1 1 . 1 . 1 1
. . . . . . . .     1 1 . 1 1 1 1 .
. . . . . . . .     . . . 1 1 . . 1
. . . . . . . .     . 1 1 . 1 1 . 1
1.fill
 gen = gen &amp;gt;&amp;gt; 8   &amp;amp;  empty           =&amp;gt;  flood
. . . . . . . .      . . . . . . . .     1 . . . . . . .
1 . . . . . . .      1 . . . . . . .     1 . . 1 . . . .
. . . 1 . . . .      . . . 1 . . . .     . . . 1 . . . .
. . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .      . . . . . . . .     . . . . . 1 . .
. . . . . 1 . .      . . . . . 1 . .     . . . . . 1 . .
. . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .      . . . . . . . .     . . . . . . . .
2.fill
 gen = gen &amp;gt;&amp;gt; 8   &amp;amp;  empty               flood  |= ...
. . . . . . . .      . . . . . . . .     1 . . . . . . .
. . . . . . . .      . . . . . . . .     1 . . 1 . . . .
1 . . . . . . .      1 . . . . . . .     1 . . 1 . . . .
. . . 1 . . . .      . . . 1 . . . .     . . . 1 . . . .
. . . . . . . .      . . . . . . . .     . . . . . 1 . .
. . . . . . . .      . . . . . . . .     . . . . . 1 . .
. . . . . 1 . .      . . . . . 0 . .     . . . . . . . .
. . . . . . . .      . . . . . . . .     . . . . . . . .
3.fill
 gen = gen &amp;gt;&amp;gt; 8   &amp;amp;  empty               flood |= ...
. . . . . . . .      . . . . . . . .     1 . . . . . . .
. . . . . . . .      . . . . . . . .     1 . . 1 . . . .
. . . . . . . .      . . . . . . . .     1 . . 1 . . . .
1 . . . . . . .      1 . . . . . . .     1 . . 1 . . . .
. . . 1 . . . .      . . . 0 . . . .     . . . . . 1 . .
. . . . . . . .      . . . . . . . .     . . . . . 1 . .
. . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .      . . . . . . . .     . . . . . . . .
&amp;nbsp;
...
&amp;nbsp;
6.fill
 gen = gen &amp;gt;&amp;gt; 8  &amp;amp;   empty               flood  |= ...
. . . . . . . .      . . . . . . . .     1 . . . . . . .
. . . . . . . .      . . . . . . . .     1 . . 1 . . . .
. . . . . . . .      . . . . . . . .     1 . . 1 . . . .
. . . . . . . .      . . . . . . . .     1 . . 1 . . . .
. . . . . . . .      . . . . . . . .     1 . . . . 1 . .
. . . . . . . .      . . . . . . . .     1 . . . . 1 . .
1 . . . . . . .      0 . . . . . . .     . . . . . . . .
. . . . . . . .      . . . . . . . .     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;The flood already stopped, the final 7th fill cycles don&#039;t change anything.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:23:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Attack Fill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:23 --&gt;Attack Fill&lt;/h1&gt;
 To get attacks, one additional &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;direction shift&lt;/a&gt; of the occluded fill is necessary to exclude the rooks/queen and include the blocker:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutAttacks (U64 rooks, U64 empty) {return soutOne(soutOccl(rooks, empty));}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; soutOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;soutOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks, empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:25:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Attack Fill-Comparison with Kogge-Stone&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:25 --&gt;Comparison with Kogge-Stone&lt;/h2&gt;
 To combine the dumb7fill as attack getter, we also can take advantage of &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;outer square&lt;/a&gt; occupancy doesn&#039;t affect the attack set. We need one fill cycle less, before the final shift. That takes 19 operations. In anticipation to &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;parallel prefix&lt;/a&gt;, a &lt;a class=&quot;wiki_link&quot; href=&quot;/Kogge-Stone%20Algorithm&quot;&gt;Kogge-Stone&lt;/a&gt; approach takes 14 instructions, 5 less. Kogge-Stone needs more move-instructions and a temporary register to compute generator as well as propagator, while dumb7fill uses a const propagator:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;dumb7fill                                  | Kogge-Stone Algorithm&amp;lt;br/&amp;gt;                                           |&amp;lt;br/&amp;gt;U64 soutAttacks(U64 rooks, U64 empty) {    | U64 soutAttacks(U64 rooks, U64 empty) {&amp;lt;br/&amp;gt;   U64 flood = rooks;                      |    rooks |= empty &amp;amp;amp; (rooks &amp;amp;gt;&amp;amp;gt;  8);&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;  |    empty  = empty &amp;amp;amp; (empty &amp;amp;gt;&amp;amp;gt;  8);&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;  |    rooks |= empty &amp;amp;amp; (rooks &amp;amp;gt;&amp;amp;gt; 16);&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;  |    empty  = empty &amp;amp;amp; (empty &amp;amp;gt;&amp;amp;gt; 16);&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;  |    rooks |= empty &amp;amp;amp; (rooks &amp;amp;gt;&amp;amp;gt; 32);&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;  |    return            rooks &amp;amp;gt;&amp;amp;gt;  8;&amp;lt;br/&amp;gt;   flood |=         (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;  | }&amp;lt;br/&amp;gt;   return            flood &amp;amp;gt;&amp;amp;gt; 8;           |&amp;lt;br/&amp;gt;}                                          |&amp;lt;br/&amp;gt;                                           |&amp;lt;br/&amp;gt;in x86/64 assembly                         | in x86/64 assembly&amp;lt;br/&amp;gt;; dumb7fill                                |  ; koggeStone&amp;lt;br/&amp;gt;; rooks rdx                                |  ; rooks rdx&amp;lt;br/&amp;gt;; empty rcx                                |  ; empty rcx&amp;lt;br/&amp;gt;                                           |&amp;lt;br/&amp;gt;  mov   rax, rdx                           |    mov   rax, rdx&amp;lt;br/&amp;gt;                                           |    shr   rax, 8&amp;lt;br/&amp;gt;  shr   rdx, 8                             |    and   rax, rcx&amp;lt;br/&amp;gt;  and   rdx, rcx                           |    or    rdx, rax&amp;lt;br/&amp;gt;  or    rax, rdx                           |&amp;lt;br/&amp;gt;                                           |    mov   rax, rcx&amp;lt;br/&amp;gt;  shr   rdx, 8                             |    shr   rax, 8&amp;lt;br/&amp;gt;  and   rdx, rcx                           |    and   rcx, rax&amp;lt;br/&amp;gt;  or    rax, rdx                           |&amp;lt;br/&amp;gt;                                           |    mov   rax, rdx&amp;lt;br/&amp;gt;  shr   rdx, 8                             |    shr   rax, 16&amp;lt;br/&amp;gt;  and   rdx, rcx                           |    and   rax, rcx&amp;lt;br/&amp;gt;  or    rax, rdx                           |    or    rdx, rax&amp;lt;br/&amp;gt;                                           |&amp;lt;br/&amp;gt;  shr   rdx, 8                             |    mov   rax, rcx&amp;lt;br/&amp;gt;  and   rdx, rcx                           |    shr   rax, 16&amp;lt;br/&amp;gt;  or    rax, rdx                           |    and   rcx, rax&amp;lt;br/&amp;gt;                                           |&amp;lt;br/&amp;gt;  shr   rdx, 8                             |    mov   rax, rdx&amp;lt;br/&amp;gt;  and   rdx, rcx                           |    shr   rax, 32&amp;lt;br/&amp;gt;  or    rax, rdx                           |    and   rax, rcx&amp;lt;br/&amp;gt;                                           |    or    rax, rdx&amp;lt;br/&amp;gt;  shr   rdx, 8                             |&amp;lt;br/&amp;gt;  and   rdx, rcx                           |    shr   rax, 8&amp;lt;br/&amp;gt;  or    rax, rdx                           |&amp;lt;br/&amp;gt;                                           |&amp;lt;br/&amp;gt;  shr   rax, 8                             |&amp;lt;br/&amp;gt;                                           |&amp;lt;br/&amp;gt;   1 move                                  |     5 moves&amp;lt;br/&amp;gt;  19 operations                            |    14 operations&amp;lt;br/&amp;gt;  20 instructions                          |    19 instructions&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;dumb7fill                                  &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; Kogge&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;Stone Algorithm
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
U64 soutAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;    &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; U64 soutAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;                      &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    empty  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;empty &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    empty  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;empty &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;            rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;            flood &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;                                          &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
in x86&lt;span class=&quot;sy2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt; assembly                         &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; in x86&lt;span class=&quot;sy2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt; assembly
&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; dumb7fill                                &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;  &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; koggeStone
&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; rooks rdx                                &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;  &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; rooks rdx
&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; empty rcx                                &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;  &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; empty rcx
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
  mov   rax, rdx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    mov   rax, rdx
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    shr   rax, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;
  shr   rdx, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;                             &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    and   rax, rcx
  and   rdx, rcx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    or    rdx, rax
  or    rax, rdx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    mov   rax, rcx
  shr   rdx, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;                             &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    shr   rax, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;
  and   rdx, rcx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    and   rcx, rax
  or    rax, rdx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    mov   rax, rdx
  shr   rdx, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;                             &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    shr   rax, &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;
  and   rdx, rcx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    and   rax, rcx
  or    rax, rdx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    or    rdx, rax
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
  shr   rdx, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;                             &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    mov   rax, rcx
  and   rdx, rcx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    shr   rax, &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;
  or    rax, rdx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    and   rcx, rax
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
  shr   rdx, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;                             &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    mov   rax, rdx
  and   rdx, rcx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    shr   rax, &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;
  or    rax, rdx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    and   rax, rcx
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    or    rax, rdx
  shr   rdx, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;                             &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
  and   rdx, rcx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    shr   rax, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;
  or    rax, rdx                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
  shr   rax, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;                             &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
                                           &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;
   &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; move                                  &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;     &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt; moves
  &lt;span class=&quot;nu0&quot;&gt;19&lt;/span&gt; operations                            &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt; operations
  &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; instructions                          &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;    &lt;span class=&quot;nu0&quot;&gt;19&lt;/span&gt; instructions&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;Thus, dumb7fill is not that bad, specially if processing several directions in parallel, like south and north, all east and all west attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:27:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Attack Fill-All Directions&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:27 --&gt;All Directions&lt;/h2&gt;
 &lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutAttacks(U64 rooks, U64 empty) {&amp;lt;br/&amp;gt;   U64 flood = rooks;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=         (rooks &amp;amp;gt;&amp;amp;gt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return            flood &amp;amp;gt;&amp;amp;gt; 8;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 nortAttacks(U64 rooks, U64 empty) {&amp;lt;br/&amp;gt;   U64 flood = rooks;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=         (rooks &amp;amp;lt;&amp;amp;lt; 8) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return            flood &amp;amp;lt;&amp;amp;lt; 8;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;            flood &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 nortAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;            flood &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;Horizontal fills need to consider wraps from H-file to A-file and vice versa. Fortunately this can be combined by intersection of ~A-file or ~H-file with the propagator:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 eastAttacks(U64 rooks, U64 empty) {&amp;lt;br/&amp;gt;   const U64 notA = C64(0xfefefefefefefefe);&amp;lt;br/&amp;gt;   U64 flood = rooks;&amp;lt;br/&amp;gt;   empty &amp;amp;amp;= notA;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=         (rooks &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return           (flood &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; notA ;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 noEaAttacks(U64 bishops, U64 empty) {&amp;lt;br/&amp;gt;   const U64 notA = C64(0xfefefefefefefefe);&amp;lt;br/&amp;gt;   U64 flood = bishops;&amp;lt;br/&amp;gt;   empty &amp;amp;amp;= notA;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=           (bishops &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return               (flood &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; notA ;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 soEaAttacks(U64 bishops, U64 empty) {&amp;lt;br/&amp;gt;   const U64 notA = C64(0xfefefefefefefefe);&amp;lt;br/&amp;gt;   U64 flood = bishops;&amp;lt;br/&amp;gt;   empty &amp;amp;amp;= notA;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=           (bishops &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return               (flood &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; notA ;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 westAttacks(U64 rooks, U64 empty) {&amp;lt;br/&amp;gt;   const U64 notH = C64(0x7f7f7f7f7f7f7f7f);&amp;lt;br/&amp;gt;   U64 flood = rooks;&amp;lt;br/&amp;gt;   empty &amp;amp;amp;= notH;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= rooks = (rooks &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=         (rooks &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return           (flood &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; notH ;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 soWeAttacks(U64 bishops, U64 empty) {&amp;lt;br/&amp;gt;   const U64 notH = C64(0x7f7f7f7f7f7f7f7f);&amp;lt;br/&amp;gt;   U64 flood = bishops;&amp;lt;br/&amp;gt;   empty &amp;amp;amp;= notH;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=           (bishops &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return               (flood &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; notH ;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 noWeAttacks(U64 bishops, U64 empty) {&amp;lt;br/&amp;gt;   const U64 notH = C64(0x7f7f7f7f7f7f7f7f);&amp;lt;br/&amp;gt;   U64 flood = bishops;&amp;lt;br/&amp;gt;   empty &amp;amp;amp;= notH;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= bishops = (bishops &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=           (bishops &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return               (flood &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; notH ;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 eastAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 notA &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notA&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flood &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notA &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 noEaAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bishops, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 notA &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notA&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flood &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notA &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 soEaAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bishops, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 notA &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notA&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flood &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notA &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 westAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 notH &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notH&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rooks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flood &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notH &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 soWeAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bishops, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 notH &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notH&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flood &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notH &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 noWeAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bishops, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 notH &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notH&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishops &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flood &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notH &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:57:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@GeneralizedRays&amp;quot; title=&amp;quot;Anchor: GeneralizedRays&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;GeneralizedRays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:57 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:29:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Generalized Rays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:29 --&gt;Generalized Rays&lt;/h1&gt;
 &lt;br /&gt;
Since &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Rotate&quot;&gt;rotate&lt;/a&gt; works like a &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#GeneralizedShift&quot;&gt;generalized shift&lt;/a&gt; with positive or negative shift amount - since it internally applies a modulo 64 and makes -i = 64-i. We need to clear either the lower or upper bits by intersection with a mask, which might be combined with the wrap-ands for &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;one step&lt;/a&gt;. It might be applied to get attacks for both sides with a direction parameter and small lookups for shift amount and wrap-ands - instead of multiple code for eight directions. Of course generalized shift will be a bit slower due to lookups and using cl as the shift amount register.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:31:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Generalized Rays-Loop Version&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:31 --&gt;Loop Version&lt;/h2&gt;
 This is the loop-version:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 occludedFill (U64 gen, U64 pro, int dir8) {&amp;lt;br/&amp;gt;   U64 flood = 0;&amp;lt;br/&amp;gt;   if (gen) {&amp;lt;br/&amp;gt;      int r = shift[dir8]; // {+-1,7,8,9}&amp;lt;br/&amp;gt;      pro  &amp;amp;amp;= avoidWrap[dir8];&amp;lt;br/&amp;gt;      do {&amp;lt;br/&amp;gt;         flood |= gen;&amp;lt;br/&amp;gt;         gen = rotateLeft(gen, r) &amp;amp;amp; pro;&amp;lt;br/&amp;gt;      } while (gen);&amp;lt;br/&amp;gt;   }&amp;lt;br/&amp;gt;   return flood;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 shiftOne (U64 b, int dir8) {&amp;lt;br/&amp;gt;   int r = shift[dir8]; // {+-1,7,8,9}&amp;lt;br/&amp;gt;   return rotateLeft(b, r) &amp;amp;amp; avoidWrap[dir8];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 slidingAttacks (U64 sliders, U64 empty, int dir8) {&amp;lt;br/&amp;gt;   U64 fill = occludedFill(slider, empty, dir8)&amp;lt;br/&amp;gt;   return shiftOne(fill, dir8);&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;// positve left, negative right shifts&amp;lt;br/&amp;gt;int shift[8] = {9, 1,-7,-8,-9,-1, 7, 8};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 avoidWrap[8] =&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   0xfefefefefefefe00,&amp;lt;br/&amp;gt;   0xfefefefefefefefe,&amp;lt;br/&amp;gt;   0x00fefefefefefefe,&amp;lt;br/&amp;gt;   0x00ffffffffffffff,&amp;lt;br/&amp;gt;   0x007f7f7f7f7f7f7f,&amp;lt;br/&amp;gt;   0x7f7f7f7f7f7f7f7f,&amp;lt;br/&amp;gt;   0x7f7f7f7f7f7f7f00,&amp;lt;br/&amp;gt;   0xffffffffffffff00,&amp;lt;br/&amp;gt;};&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 occludedFill &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; r &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// {+-1,7,8,9}&lt;/span&gt;
      pro  &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; avoidWrap&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
         flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
         gen &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen, r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pro&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; flood&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 shiftOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; r &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// {+-1,7,8,9}&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b, r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; avoidWrap&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 slidingAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 sliders, U64 empty, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 fill &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; occludedFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;slider, empty, dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; shiftOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;fill, dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;// positve left, negative right shifts&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;,&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;,&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 avoidWrap&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefe00&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x00fefefefefefefe&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x00ffffffffffffff&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x007f7f7f7f7f7f7f&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f00&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0xffffffffffffff00&lt;/span&gt;,
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:9 --&gt;The avoidWrap masks by some arbitrary dir8 enumeration and shift amount:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;6 == noWe -&amp;amp;gt; +7     7 == nort -&amp;amp;gt; +8     0 == noEa -&amp;amp;gt; +9&amp;lt;br/&amp;gt;0x7F7F7F7F7F7F7F00  0xFFFFFFFFFFFFFF00  0xFEFEFEFEFEFEFE00&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;5 == west -&amp;amp;gt; -1                         1 == east -&amp;amp;gt; +1&amp;lt;br/&amp;gt;0x7F7F7F7F7F7F7F7F                      0xFEFEFEFEFEFEFEFE&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;4 == soWe -&amp;amp;gt; -9     3 == sout -&amp;amp;gt; -8     2 == soEa -&amp;amp;gt; -7&amp;lt;br/&amp;gt;0x007F7F7F7F7F7F7F  0x00FFFFFFFFFFFFFF  0x00FEFEFEFEFEFEFE&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;6 == noWe -&amp;gt; +7     7 == nort -&amp;gt; +8     0 == noEa -&amp;gt; +9
0x7F7F7F7F7F7F7F00  0xFFFFFFFFFFFFFF00  0xFEFEFEFEFEFEFE00
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
. . . . . . . .     . . . . . . . .     . . . . . . . .
&amp;nbsp;
5 == west -&amp;gt; -1                         1 == east -&amp;gt; +1
0x7F7F7F7F7F7F7F7F                      0xFEFEFEFEFEFEFEFE
1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .                         . 1 1 1 1 1 1 1
&amp;nbsp;
4 == soWe -&amp;gt; -9     3 == sout -&amp;gt; -8     2 == soEa -&amp;gt; -7
0x007F7F7F7F7F7F7F  0x00FFFFFFFFFFFFFF  0x00FEFEFEFEFEFEFE
. . . . . . . .     . . . . . . . .     . . . . . . . .
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1
1 1 1 1 1 1 1 .     1 1 1 1 1 1 1 1     . 1 1 1 1 1 1 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:33:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc9&quot;&gt;&lt;a name=&quot;Generalized Rays-Unrolled Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:33 --&gt;Unrolled Attacks&lt;/h2&gt;
 The generalized unrolled sliding attack getter:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:11:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 slidingAttacks (U64 sliders, U64 empty, int dir8) {&amp;lt;br/&amp;gt;   U64 flood = sliders;&amp;lt;br/&amp;gt;   int r = shift[dir8]; // {+-1,7,8,9}&amp;lt;br/&amp;gt;   empty &amp;amp;amp;= avoidWrap[dir8];&amp;lt;br/&amp;gt;   flood |= sliders = rotateLeft(sliders , r) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= sliders = rotateLeft(sliders , r) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= sliders = rotateLeft(sliders , r) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= sliders = rotateLeft(sliders , r) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |= sliders = rotateLeft(sliders , r) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   flood |=         = rotateLeft(sliders , r) &amp;amp;amp; empty;&amp;lt;br/&amp;gt;   return   rotateLeft(flood, r)  &amp;amp;amp;   avoidWrap[dir8];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 slidingAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 sliders, U64 empty, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 flood &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sliders&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; r &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// {+-1,7,8,9}&lt;/span&gt;
   empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; avoidWrap&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sliders &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sliders , r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sliders &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sliders , r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sliders &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sliders , r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sliders &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sliders , r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sliders &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sliders , r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   flood &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sliders , r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; empty&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;   rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flood, r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;  &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;   avoidWrap&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:11 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:35:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc10&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:35 --&gt;See also&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/AVX2#Dumb7Fill&quot;&gt;AVX2 Dumb7Fill&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fill%20Algorithms&quot;&gt;Fill Algorithms&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Kogge-Stone%20Algorithm&quot;&gt;Kogge-Stone Algorithm&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces%20versus%20Directions&quot;&gt;Pieces versus Directions&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:37:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc11&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:37 --&gt;External Links&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://radagast.se/othello/bitmob.c&quot; rel=&quot;nofollow&quot;&gt;bitboard mobility&lt;/a&gt; Copyright (c) 2003, &lt;a class=&quot;wiki_link&quot; href=&quot;/Gunnar%20Andersson&quot;&gt;Gunnar Andersson&lt;/a&gt; » &lt;a class=&quot;wiki_link&quot; href=&quot;/Othello&quot;&gt;Othello&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Mobility&quot;&gt;Mobility&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#WeatherReport&quot;&gt;Weather Report&lt;/a&gt; -  &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.weatherreportdiscography.org/weather-report-1971/&quot; rel=&quot;nofollow&quot;&gt;Seventh Arrow / Umbrellas, 1971&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#JoeZawinul&quot;&gt;Joe Zawinul&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#WayneShorter&quot;&gt;Wayne Shorter&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#MiroslavVitous&quot;&gt;Miroslav Vitouš&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#AlphonseMouzon&quot;&gt;Alphonse Mouzon&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#DomUmRomao&quot;&gt;Dom Um Romão&lt;/a&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:12:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/custom/26371110?h=0&amp;amp;w=0&amp;quot; class=&amp;quot;WikiMedia WikiMediaCustom&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;custom&amp;amp;quot; key=&amp;amp;quot;26371110&amp;amp;quot;&amp;quot; title=&amp;quot;Custom Media&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/iigJbeTzFHs?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:12 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:39:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc12&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:39 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:013:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Dumb7Fill&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Dumb7Fill&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Dumb7Fill includeBody-Dumb7Fill includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tfoot class=&quot;includeBacklinksFooter&quot;&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;5&quot;&gt;&lt;a href=&quot;https://chessprogramming.wikispaces.com/page/links/Dumb7Fill&quot;&gt;More Links&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tfoot&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/AVX2&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;AVX2&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 8, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/DirGolem&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;DirGolem&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dumb7Fill&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dumb7Fill&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Efficient Generation of Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fill+Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fill Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 6, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gaviota&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gaviota&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 21, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/General+Setwise+Operations&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;General Setwise Operations&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gunnar+Andersson&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gunnar Andersson&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 23, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Influence+Quantity+of+Pieces&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Influence Quantity of Pieces&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 21, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/John+L.+Jerz&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;John L. Jerz&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 15, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kogge-Stone+Algorithm&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kogge-Stone Algorithm&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 17, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Lachex&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Lachex&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Little+Wing&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Little Wing&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mobility&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mobility&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 17, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Othello&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Othello&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 4, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pieces+versus+Directions&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pieces versus Directions&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 6, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sequential+Logic&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sequential Logic&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 10, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Shifted+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Shifted Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 9, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SIMD+and+SWAR+Techniques&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SIMD and SWAR Techniques&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 27, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:013 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Efficient Generation of Sliding Piece Attacks</title>
      <link>https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Efficient+Generation+of+Sliding+Piece+Attacks</comments>
      <pubDate>Sat, 05 Nov 2016 09:24:03 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Conferences&quot;&gt;Conferences&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Workshop%20Chess%20and%20Mathematics&quot;&gt;Workshop Chess and Mathematics&lt;/a&gt; * Efficient Generation of Sliding Piece Attacks&lt;/strong&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextTocRule:207:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:207 --&gt;&lt;!-- ws:start:WikiTextTocRule:208: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics&quot;&gt;Bitboard Basics&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:208 --&gt;&lt;!-- ws:start:WikiTextTocRule:209: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Squares and Bitindex&quot;&gt;Squares and Bitindex&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:209 --&gt;&lt;!-- ws:start:WikiTextTocRule:210: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Empty and Universe&quot;&gt;Empty and Universe&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:210 --&gt;&lt;!-- ws:start:WikiTextTocRule:211: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Bitboard Board-Definition&quot;&gt;Bitboard Board-Definition&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:211 --&gt;&lt;!-- ws:start:WikiTextTocRule:212: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Setwise Operations&quot;&gt;Setwise Operations&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:212 --&gt;&lt;!-- ws:start:WikiTextTocRule:213: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Shifts&quot;&gt;Shifts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:213 --&gt;&lt;!-- ws:start:WikiTextTocRule:214: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Shifts-One Step Only&quot;&gt;One Step Only&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:214 --&gt;&lt;!-- ws:start:WikiTextTocRule:215: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Shifts-Pawn Attacks&quot;&gt;Pawn Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:215 --&gt;&lt;!-- ws:start:WikiTextTocRule:216: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Bit-Twiddling relying on the Two&#039;s Complement&quot;&gt;Bit-Twiddling relying on the Two&#039;s Complement&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:216 --&gt;&lt;!-- ws:start:WikiTextTocRule:217: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Bit-Twiddling relying on the Two&#039;s Complement-LS-Bit-Isolation&quot;&gt;LS-Bit-Isolation&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:217 --&gt;&lt;!-- ws:start:WikiTextTocRule:218: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Bit-Twiddling relying on the Two&#039;s Complement-LS-Bit-Reset&quot;&gt;LS-Bit-Reset&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:218 --&gt;&lt;!-- ws:start:WikiTextTocRule:219: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Converting Bitboards to Lists&quot;&gt;Converting Bitboards to Lists&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:219 --&gt;&lt;!-- ws:start:WikiTextTocRule:220: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-BitScan&quot;&gt;BitScan&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:220 --&gt;&lt;!-- ws:start:WikiTextTocRule:221: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-BitScan-De Bruijn Multiplication&quot;&gt;De Bruijn Multiplication&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:221 --&gt;&lt;!-- ws:start:WikiTextTocRule:222: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-BitScan-Bitscan by Modulo&quot;&gt;Bitscan by Modulo&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:222 --&gt;&lt;!-- ws:start:WikiTextTocRule:223: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Bitboard Basics-Kindergarten Multiplication&quot;&gt;Kindergarten Multiplication&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:223 --&gt;&lt;!-- ws:start:WikiTextTocRule:224: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Attack-Sets as Base for Bitboard Move-generation&quot;&gt;Attack-Sets as Base for Bitboard Move-generation&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:224 --&gt;&lt;!-- ws:start:WikiTextTocRule:225: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Attack-Sets as Base for Bitboard Move-generation-Sliding piece Attacks on the otherwise empty board&quot;&gt;Sliding piece Attacks on the otherwise empty board&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:225 --&gt;&lt;!-- ws:start:WikiTextTocRule:226: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Attack-Sets as Base for Bitboard Move-generation-Sliding piece Attacks on the otherwise empty board-Ray Attacks&quot;&gt;Ray Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:226 --&gt;&lt;!-- ws:start:WikiTextTocRule:227: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Attack-Sets as Base for Bitboard Move-generation-Sliding piece Attacks on the otherwise empty board-Line Attacks&quot;&gt;Line Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:227 --&gt;&lt;!-- ws:start:WikiTextTocRule:228: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Attack-Sets as Base for Bitboard Move-generation-Sliding piece Attacks on the otherwise empty board-Piece attacks&quot;&gt;Piece attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:228 --&gt;&lt;!-- ws:start:WikiTextTocRule:229: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Sliding Attacks by Calculation&quot;&gt;Sliding Attacks by Calculation&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:229 --&gt;&lt;!-- ws:start:WikiTextTocRule:230: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Sliding Attacks by Calculation-Subtraction and Reverse Subtraction of rooks from blockers&quot;&gt;Subtraction and Reverse Subtraction of rooks from blockers&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:230 --&gt;&lt;!-- ws:start:WikiTextTocRule:231: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Sliding Attacks by Calculation-Flood Fill Techniques with multiple sliders&quot;&gt;Flood Fill Techniques with multiple sliders&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:231 --&gt;&lt;!-- ws:start:WikiTextTocRule:232: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Sliding Attacks by Calculation-Flood Fill Techniques with multiple sliders-Occluded Fill&quot;&gt;Occluded Fill&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:232 --&gt;&lt;!-- ws:start:WikiTextTocRule:233: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Sliding Attacks by Calculation-Flood Fill Techniques with multiple sliders-Kogge-Stone Parallel Prefix Algorithm&quot;&gt;Kogge-Stone Parallel Prefix Algorithm&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:233 --&gt;&lt;!-- ws:start:WikiTextTocRule:234: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Sliding Attacks by Calculation-Flood Fill Techniques with multiple sliders-Ray-wise Attacks in one Direction&quot;&gt;Ray-wise Attacks in one Direction&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:234 --&gt;&lt;!-- ws:start:WikiTextTocRule:235: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques&quot;&gt;Lookup Techniques&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:235 --&gt;&lt;!-- ws:start:WikiTextTocRule:236: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Rook Attacks on the first Rank - as a base of occupancy lookup&quot;&gt;Rook Attacks on the first Rank - as a base of occupancy lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:236 --&gt;&lt;!-- ws:start:WikiTextTocRule:237: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Rook Attacks on the first Rank - as a base of occupancy lookup-One Byte Only&quot;&gt;One Byte Only&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:237 --&gt;&lt;!-- ws:start:WikiTextTocRule:238: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Rook Attacks on the first Rank - as a base of occupancy lookup-The Outer Squares&quot;&gt;The Outer Squares&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:238 --&gt;&lt;!-- ws:start:WikiTextTocRule:239: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Rook Attacks on the first Rank - as a base of occupancy lookup-Other ranks&quot;&gt;Other ranks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:239 --&gt;&lt;!-- ws:start:WikiTextTocRule:240: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Rotated Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:240 --&gt;&lt;!-- ws:start:WikiTextTocRule:241: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Kindergarten Bitboards&quot;&gt;Kindergarten Bitboards&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:241 --&gt;&lt;!-- ws:start:WikiTextTocRule:242: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Kindergarten Bitboards-Ranks and Diagonals&quot;&gt;Ranks and Diagonals&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:242 --&gt;&lt;!-- ws:start:WikiTextTocRule:243: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Kindergarten Bitboards-Files&quot;&gt;Files&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:243 --&gt;&lt;!-- ws:start:WikiTextTocRule:244: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Congruent Modulo Bitboards&quot;&gt;Congruent Modulo Bitboards&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:244 --&gt;&lt;!-- ws:start:WikiTextTocRule:245: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Magic Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:245 --&gt;&lt;!-- ws:start:WikiTextTocRule:246: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Magic Bitboards-How it works&quot;&gt;How it works&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:246 --&gt;&lt;!-- ws:start:WikiTextTocRule:247: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Magic Bitboards-Perfect Hashing&quot;&gt;Perfect Hashing&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:247 --&gt;&lt;!-- ws:start:WikiTextTocRule:248: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Lookup Techniques-Magic Bitboards-Sample Code&quot;&gt;Sample Code&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:248 --&gt;&lt;!-- ws:start:WikiTextTocRule:249: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Summary&quot;&gt;Summary&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:249 --&gt;&lt;!-- ws:start:WikiTextTocRule:250: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:250 --&gt;&lt;!-- ws:start:WikiTextTocRule:251: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:251 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextRemoteImageRule:596:&amp;lt;a href=&amp;quot;http://en.wikipedia.org/wiki/Dresden_University_of_Technology&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;http://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/Logo_tu-dresden.jpg/175px-Logo_tu-dresden.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dresden_University_of_Technology&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/Logo_tu-dresden.jpg/175px-Logo_tu-dresden.jpg&quot; alt=&quot;external image 175px-Logo_tu-dresden.jpg&quot; title=&quot;external image 175px-Logo_tu-dresden.jpg&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextRemoteImageRule:596 --&gt;&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;u&gt;Fakultät Mathematik und Naturwissenschaften Institut für Numerische Mathematik&lt;/u&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;strong&gt;Workshop Chess and Mathematics&lt;/strong&gt; &lt;!-- ws:start:WikiTextRefRule:47:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.math.tu-dresden.de/num/chess2008/abstracts.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Workshop Chess and Mathematics&amp;lt;/a&amp;gt; (pdf) agenda and abstracts&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:47 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Dresden&quot; rel=&quot;nofollow&quot;&gt;Dresden&lt;/a&gt;, November 21st and 22nd, 2008&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;, Hattingen&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 130%; font-family: Tahoma,Geneva,sans-serif&quot;&gt;&lt;strong&gt;Efficient generation of Moves and Controls of Sliding Pieces&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Sa., 16:00, TU Dresden, WIL C207&lt;br /&gt;
&lt;tt&gt;Attack-Sets as Base for Bitboard Move-generation: Opposed to “None-sliding” pieces, Knight, King and Pawn, whose attacks are determined by its origin square only, sliding piece attacks like Rook-, Bishop- and Queen-attacks are dependend on other pieces as well, which may block the attacking ray in one particular ray-direction. In &lt;a class=&quot;wiki_link&quot; href=&quot;/Quiescence%20Search&quot;&gt;Quiescence Search&lt;/a&gt; the performance of generating (winning) capture moves is crucial. Opposed to classical square-centric board-representations, which require loops over squares, bitboards permit more efficient algorithms in generating sliding attacks.&lt;/tt&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:121:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Bitboard Basics&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:121 --&gt;Bitboard Basics&lt;/h1&gt;
 Bitboards are 64-bit integers and represent a &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Finite_set&quot; rel=&quot;nofollow&quot;&gt;finite set&lt;/a&gt; of up to 64 elements - all the &lt;a class=&quot;wiki_link&quot; href=&quot;/Squares&quot;&gt;squares&lt;/a&gt; of a &lt;a class=&quot;wiki_link&quot; href=&quot;/Chessboard&quot;&gt;chessboard&lt;/a&gt; with specific boolean properties of those squares. For instance whether squares are empty or occupied, or occupied by a specific kind of piece - or which is the main topic of this talk, whether a square is controlled or attacked (defended) by a specific kind of piece, especially attacked by sliding pieces.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:123:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Bitboard Basics-Squares and Bitindex&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:123 --&gt;Squares and Bitindex&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations&quot;&gt;Square Mapping Considerations&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
There is a &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Bijection&quot; rel=&quot;nofollow&quot;&gt;bijective&lt;/a&gt; one-to-one correspondence between bits of a bitboard and the squares of a board. There are 64! different mappings, but most commonly bits are enumerated &amp;quot;in order&amp;quot; along ranks or files (orthogonal). Some programs (&lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt;) keep redundant mappings and also enumerate consecutive bits along the diagonals or anti-diagonals.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;If not stated otherwise, we further rely on Little-Endian Rank-File Mapping.&lt;/em&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextLocalImageRule:591:&amp;lt;img src=&amp;quot;/file/view/BBUniverse.jpg/47123363/BBUniverse.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;img src=&quot;/file/view/BBUniverse.jpg/47123363/BBUniverse.jpg&quot; alt=&quot;BBUniverse.jpg&quot; title=&quot;BBUniverse.jpg&quot; /&gt;&lt;!-- ws:end:WikiTextLocalImageRule:591 --&gt;&lt;br /&gt;
with following relations:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;squareIndex {0..63} = 8*rankIndex + fileIndex;&amp;lt;br/&amp;gt;rankIndex   {0..7}  = squareIndex div 8; // squareIndex &amp;amp;gt;&amp;amp;gt; 3;&amp;lt;br/&amp;gt;fileIndex   {0..7}  = squareIndex mod 8; // squareIndex &amp;amp;amp; 7;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;squareIndex &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;..&lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;rankIndex &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; fileIndex&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
rankIndex   &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;..&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; squareIndex &lt;span class=&quot;kw3&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// squareIndex &amp;gt;&amp;gt; 3;&lt;/span&gt;
fileIndex   &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;..&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; squareIndex mod &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// squareIndex &amp;amp; 7;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;Diagonals may be enumerated in various ways determined by the difference of rankIndex and fileIndex:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;DiagonalIndex {0..15} = (rankIndex - fileIndex) &amp;amp;amp; 15;&amp;lt;br/&amp;gt;\f  0  1  2  3  4  5  6  7&amp;lt;br/&amp;gt;r_________________________&amp;lt;br/&amp;gt;7 | 7  6  5  4  3  2  1  0&amp;lt;br/&amp;gt;6 | 6  5  4  3  2  1  0 15&amp;lt;br/&amp;gt;5 | 5  4  3  2  1  0 15 14&amp;lt;br/&amp;gt;4 | 4  3  2  1  0 15 14 13&amp;lt;br/&amp;gt;3 | 3  2  1  0 15 14 13 12&amp;lt;br/&amp;gt;2 | 2  1  0 15 14 13 12 11&amp;lt;br/&amp;gt;1 | 1  0 15 14 13 12 11 10&amp;lt;br/&amp;gt;0 | 0 15 14 13 12 11 10  9&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;DiagonalIndex {0..15} = (rankIndex - fileIndex) &amp;amp; 15;
\f  0  1  2  3  4  5  6  7
r_________________________
7 | 7  6  5  4  3  2  1  0
6 | 6  5  4  3  2  1  0 15
5 | 5  4  3  2  1  0 15 14
4 | 4  3  2  1  0 15 14 13
3 | 3  2  1  0 15 14 13 12
2 | 2  1  0 15 14 13 12 11
1 | 1  0 15 14 13 12 11 10
0 | 0 15 14 13 12 11 10  9&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;Anti-Diagonals may be enumerated in various ways determined by the sum of rankIndex and fileIndex:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;AntiDiagonalIndex {0..15} = (rankIndex + fileIndex) ^ 7; // xor&amp;lt;br/&amp;gt;\f  0  1  2  3  4  5  6  7&amp;lt;br/&amp;gt;r_________________________&amp;lt;br/&amp;gt;7 | 0 15 14 13 12 11 10  9&amp;lt;br/&amp;gt;6 | 1  0 15 14 13 12 11 10&amp;lt;br/&amp;gt;5 | 2  1  0 15 14 13 12 11&amp;lt;br/&amp;gt;4 | 3  2  1  0 15 14 13 12&amp;lt;br/&amp;gt;3 | 4  3  2  1  0 15 14 13&amp;lt;br/&amp;gt;2 | 5  4  3  2  1  0 15 14&amp;lt;br/&amp;gt;1 | 6  5  4  3  2  1  0 15&amp;lt;br/&amp;gt;0 | 7  6  5  4  3  2  1  0&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;AntiDiagonalIndex {0..15} = (rankIndex + fileIndex) ^ 7; // xor
\f  0  1  2  3  4  5  6  7
r_________________________
7 | 0 15 14 13 12 11 10  9
6 | 1  0 15 14 13 12 11 10
5 | 2  1  0 15 14 13 12 11
4 | 3  2  1  0 15 14 13 12
3 | 4  3  2  1  0 15 14 13
2 | 5  4  3  2  1  0 15 14
1 | 6  5  4  3  2  1  0 15
0 | 7  6  5  4  3  2  1  0&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:125:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Bitboard Basics-Empty and Universe&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:125 --&gt;Empty and Universe&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;The &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Empty_set&quot; rel=&quot;nofollow&quot;&gt;empty set&lt;/a&gt; is represented by all bits zero.&lt;/li&gt;&lt;li&gt;The &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Universal_set&quot; rel=&quot;nofollow&quot;&gt;universal set&lt;/a&gt; contains all elements by setting all bits to binary one.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
The numerical values and set-wise representations of those sets, and how the appear as a board:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;empty set E = 0      universal set U   = 2^64 - 1 or ~0&amp;lt;br/&amp;gt; set-wise   = {}      set-wise         = {a1, b1, c1, d1, ....., e8, f8, g8, h8}&amp;lt;br/&amp;gt;                      hexadecimal      = 0xffffffffffffffff&amp;lt;br/&amp;gt;                      unsigned decimal = 18,446,744,073,709,551,615&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;empty set E = 0      universal set U   = 2^64 - 1 or ~0
 set-wise   = {}      set-wise         = {a1, b1, c1, d1, ....., e8, f8, g8, h8}
                      hexadecimal      = 0xffffffffffffffff
                      unsigned decimal = 18,446,744,073,709,551,615
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:127:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Bitboard Basics-Bitboard Board-Definition&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:127 --&gt;Bitboard Board-Definition&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboard%20Board-Definition&quot;&gt;Bitboard Board-Definition&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
To represent the board we typically need one bitboard for each &lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces&quot;&gt;piece-type&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Color&quot;&gt;color&lt;/a&gt; - likely encapsulated inside a class or structure, or as an array of bitboards as part of a &lt;a class=&quot;wiki_link&quot; href=&quot;/Chess%20Position&quot;&gt;position&lt;/a&gt; object. A one-bit inside a bitboard implies the existence of a piece of this piece-type on a certain &lt;a class=&quot;wiki_link&quot; href=&quot;/Squares&quot;&gt;square&lt;/a&gt; - one to one associated by the bit-position.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;               pieces&amp;lt;br/&amp;gt;   white                  black            occupied               empty&amp;lt;br/&amp;gt;. . . . . . . .     1 . 1 1 . 1 1 .     1 . 1 1 . 1 1 .     . 1 . . 1 . . 1&amp;lt;br/&amp;gt;. . . . . . . .     . . 1 . 1 1 1 1     . . 1 . 1 1 1 1     1 1 . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .     1 . . . . . . .     1 . . . . . . .     . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .     . 1 . 1 1 . . .     . 1 . 1 1 . . .     1 . 1 . . 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. 1 1 . . . . .     . . . . . . . .     . 1 1 . . . . .     1 . . 1 1 1 1 1&amp;lt;br/&amp;gt;1 1 . 1 . 1 1 1     . . . . . . . .     1 1 . 1 . 1 1 1     . . 1 . 1 . . .&amp;lt;br/&amp;gt;1 1 1 1 1 . 1 .     . . . . . . . .     1 1 1 1 1 . 1 .     . . . . . 1 . 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;               pieces
   white                  black            occupied               empty
. . . . . . . .     1 . 1 1 . 1 1 .     1 . 1 1 . 1 1 .     . 1 . . 1 . . 1
. . . . . . . .     . . 1 . 1 1 1 1     . . 1 . 1 1 1 1     1 1 . 1 . . . .
. . . . . . . .     1 . . . . . . .     1 . . . . . . .     . 1 1 1 1 1 1 1
. . . . . . . .     . 1 . 1 1 . . .     . 1 . 1 1 . . .     1 . 1 . . 1 1 1
. . . . . . . .     . . . . . . . .     . . . . . . . .     1 1 1 1 1 1 1 1
. 1 1 . . . . .     . . . . . . . .     . 1 1 . . . . .     1 . . 1 1 1 1 1
1 1 . 1 . 1 1 1     . . . . . . . .     1 1 . 1 . 1 1 1     . . 1 . 1 . . .
1 1 1 1 1 . 1 .     . . . . . . . .     1 1 1 1 1 . 1 .     . . . . . 1 . 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;&lt;!-- ws:start:WikiTextLocalImageRule:592:&amp;lt;div style=&amp;quot;text-align: center&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/pictureParser.php.png/32251681/pictureParser.php.png&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt;&amp;lt;/div&amp;gt; --&gt;&lt;div style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;/file/view/pictureParser.php.png/32251681/pictureParser.php.png&quot; alt=&quot;pictureParser.php.png&quot; title=&quot;pictureParser.php.png&quot; /&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextLocalImageRule:592 --&gt;&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;               pawns                                  knights&amp;lt;br/&amp;gt;   white                  black            white                  black&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . 1 . . 1 1 1     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     1 . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . 1 . . 1 . . .     . . . . . . . .     . . . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . 1 . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;1 1 . 1 . 1 1 1     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;              bishops                                  rooks&amp;lt;br/&amp;gt;   white                   black           white                  black&amp;lt;br/&amp;gt;. . . . . . . .     . . 1 . . . . .     . . . . . . . .     1 . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . 1 . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. 1 . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . 1 . . . . .     . . . . . . . .     1 . . . 1 . . .     . . . . . . . .&amp;lt;br/&amp;gt;               queens                                  kings&amp;lt;br/&amp;gt;   white                   black           white                  black&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .     . . . . . . . .     . . . . . . 1 .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . 1 . . . .     . . . . . . . .     . . . . . . 1 .     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;               pawns                                  knights
   white                  black            white                  black
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . . . . . .     . . . . . . . .
. . . . . . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . .     . . . . . . . .
              &lt;span class=&quot;me1&quot;&gt;bishops&lt;/span&gt;                                  rooks
   white                   black           white                  black
. . . . . . . .     . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . .     . . . . . . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .
. . . . . . . .     . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . .     . . . . . . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . . . . . . .
               &lt;span class=&quot;me1&quot;&gt;queens&lt;/span&gt;                                  kings
   white                   black           white                  black
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .     . . . . . . . .     . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .     . . . . . . . .
. . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .     . . . . . . . .     . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:129:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Bitboard Basics-Setwise Operations&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:129 --&gt;Setwise Operations&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations&quot;&gt;General Setwise Operations&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Boolean_algebra&quot; rel=&quot;nofollow&quot;&gt; Boolean algebra&lt;/a&gt; is an algebraic structure that captures essential properties of both set operations and logic operations. Specifically, it deals with the set operations of &lt;strong&gt;intersection&lt;/strong&gt;, &lt;strong&gt;union&lt;/strong&gt;, &lt;strong&gt;complement&lt;/strong&gt; - and the bitwise boolean operations of &lt;strong&gt;AND, OR, NOT&lt;/strong&gt;. Bitwise boolean operations on 64-bit words are in fact 64 parallel operations on each bit.&lt;br /&gt;
&lt;br /&gt;
Assume we have an attack set of a &lt;a class=&quot;wiki_link&quot; href=&quot;/Queen&quot;&gt;queen&lt;/a&gt;, and like to know whether the queen attacks opponent &lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces&quot;&gt;pieces&lt;/a&gt; it may &lt;a class=&quot;wiki_link&quot; href=&quot;/Captures&quot;&gt;capture&lt;/a&gt;, we need to &#039;and&#039; the queen-attacks with the set of opponent pieces.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;queen attacks    &amp;amp;amp;  opponent pieces  =  attacked pieces&amp;lt;br/&amp;gt;. . . . . . . .     1 . . 1 1 . . 1     . . . . . . . .&amp;lt;br/&amp;gt;. . . 1 . . 1 .     1 . 1 1 1 1 1 .     . . . 1 . . 1 .&amp;lt;br/&amp;gt;. 1 . 1 . 1 . .     . 1 . . . . . 1     . 1 . . . . . .&amp;lt;br/&amp;gt;. . 1 1 1 . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;1 1 1 * 1 1 1 .  &amp;amp;amp;  . . . * . . 1 .  =  . . . * . . 1 .&amp;lt;br/&amp;gt;. . 1 1 1 . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . 1 . 1 . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . 1 . . . .     . . . . . . . .     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;queen attacks    &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;  opponent pieces  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  attacked pieces
. . . . . . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . . . . . .
. . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .
. &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . .
. . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . . . . . . .     . . . . . . . .
&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .  &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;  . . . &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  . . . &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .
. . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . . . . . . .     . . . . . . . .
. . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .     . . . . . . . .     . . . . . . . .
. . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .     . . . . . . . .     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:131:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Bitboard Basics-Shifts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:131 --&gt;Shifts&lt;/h2&gt;
 Shift acts like a multiplication (shift left) or division (shift right) by a power of two.&lt;br /&gt;
With orthogonal square mapping, shift with appropriate ray directions amounts of {1,7,8,9} are used to &amp;quot;move&amp;quot; the pieces one step in that direction, or to generate their square controls set-wise.&lt;br /&gt;
&lt;br /&gt;
In the 8*8 board centric world with one scalar square-coordinate 0..63, each of the max eight neighboring squares can be determined by adding an offset for each direction. For border squares one has to care about overflows and wraps from a-file to h-file or vice versa. Some conditional code is needed to avoid that. Such code is usually part of move generation for particular pieces.&lt;br /&gt;
&lt;br /&gt;
The mentioned square mapping implies following eight ray-directions as a compass-rose:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;  northwest    north   northeast&amp;lt;br/&amp;gt;  noWe         nort         noEa&amp;lt;br/&amp;gt;          +7    +8    +9&amp;lt;br/&amp;gt;              \  |  /&amp;lt;br/&amp;gt;  west    -1 &amp;amp;lt;-  0 -&amp;amp;gt; +1    east&amp;lt;br/&amp;gt;              /  |  \&amp;lt;br/&amp;gt;          -9    -8    -7&amp;lt;br/&amp;gt;  soWe         sout         soEa&amp;lt;br/&amp;gt;  southwest    south   southeast&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;  northwest    north   northeast
  noWe         nort         noEa
          +7    +8    +9
              \  |  /
  west    -1 &amp;lt;-  0 -&amp;gt; +1    east
              /  |  \
          -9    -8    -7
  soWe         sout         soEa
  southwest    south   southeast&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;In the set-wise world of bitboards, where a square as member of a set is determined by an appropriate one-bit 2^square, the operation to apply such movements is shifting.&lt;br /&gt;
&lt;br /&gt;
One has to consider wraps, which requires one further intersection.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;To be aware of their scalar 64-bit origin, we use so far a type defined unsigned integer U64 in our &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Cpp&quot;&gt;C++&lt;/a&gt; source snippets, the scalar 64-bit long in &lt;a class=&quot;wiki_link&quot; href=&quot;/Java&quot;&gt;Java&lt;/a&gt;. Feel free to define a distinct type or wrap U64 into classes for better abstraction and type-safety during compile time. The macro C64 will append a suffix to 64-bit constants as required by some compilers&lt;/em&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;typedef unsigned __int64 U64;    // for the old microsoft compilers&amp;lt;br/&amp;gt;typedef unsigned long long  U64; // supported by MSC 13.00+ and C99&amp;lt;br/&amp;gt;#define C64(constantU64) constantU64##ULL&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;typedef unsigned __int64 U64;    // for the old microsoft compilers
typedef unsigned long long  U64; // supported by MSC 13.00+ and C99
#define C64(constantU64) constantU64##ULL&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:133:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Bitboard Basics-Shifts-One Step Only&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:133 --&gt;One Step Only&lt;/h3&gt;
 The advantage with bitboards is, that the shift applies to all set bits in parallel, e.g. with all pawns. Vertical shifts by +-8 don&#039;t need any under- or overflow conditions since bits simply fall out and disappear.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutOne (U64 b) {return  b &amp;amp;gt;&amp;amp;gt; 8;}&amp;lt;br/&amp;gt;U64 nortOne (U64 b) {return  b &amp;amp;lt;&amp;amp;lt; 8;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;  b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 nortOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;  b &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:9 --&gt;&lt;br /&gt;
Wraps from a-file to h-file or vice versa may be considered by only shifting subsets which may not wrap. Thus we can mask off the a- or h-file before or after a +-1,7,9 shift:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;const U64 notAFile = 0xfefefefefefefefe; // ~0x0101010101010101&amp;lt;br/&amp;gt;const U64 notHFile = 0x7f7f7f7f7f7f7f7f; // ~0x8080808080808080&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 notAFile &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ~0x0101010101010101&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 notHFile &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ~0x8080808080808080&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;Post-shift masks, ...&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:11:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 eastOne (U64 b) {return (b &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; notAFile;}&amp;lt;br/&amp;gt;U64 noEaOne (U64 b) {return (b &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; notAFile;}&amp;lt;br/&amp;gt;U64 soEaOne (U64 b) {return (b &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; notAFile;}&amp;lt;br/&amp;gt;U64 westOne (U64 b) {return (b &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; notHFile;}&amp;lt;br/&amp;gt;U64 soWeOne (U64 b) {return (b &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; notHFile;}&amp;lt;br/&amp;gt;U64 noWeOne (U64 b) {return (b &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; notHFile;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 eastOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noEaOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soEaOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 westOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soWeOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noWeOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:11 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:135:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Bitboard Basics-Shifts-Pawn Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:135 --&gt;Pawn Attacks&lt;/h3&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20Attacks%20%28Bitboards%29&quot;&gt;Pawn Attacks (Bitboards)&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Pawn Attacks set-wise as application of One Step Only.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:12:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt; white pawns       white pawns &amp;amp;lt;&amp;amp;lt; 9  &amp;amp;amp;       notAFile     ==      noEaOne&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     h . . c . . . .      . 1 1 1 1 1 1 1      . . . c . . . .&amp;lt;br/&amp;gt;. . c . . . . .     . a b . d . f g      . 1 1 1 1 1 1 1      . a b . d . f g&amp;lt;br/&amp;gt;a b . d . f g h     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     / . . . . . . .      . 1 1 1 1 1 1 1      / . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt; white pawns       white pawns &amp;amp;lt;&amp;amp;lt; 7  &amp;amp;amp;       notHFile     ==     noWeOne&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      1 1 1 1 1 1 1 .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      1 1 1 1 1 1 1 .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      1 1 1 1 1 1 1 .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      1 1 1 1 1 1 1 .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . c . . . . . .      1 1 1 1 1 1 1 .      . c . . . . . .&amp;lt;br/&amp;gt;. . c . . . . .     b . d . f g h .      1 1 1 1 1 1 1 .      b . d . f g h .&amp;lt;br/&amp;gt;a b . d . f g h     . . . . . . . a      1 1 1 1 1 1 1 .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . \      1 1 1 1 1 1 1 .      . . . . . . . \&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt; white pawns                                                 Union (1 == double attacks)&amp;lt;br/&amp;gt;. . . . . . . .                                               . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .                                               . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .                                               . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .                                               . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .                                               . c . c . . . .&amp;lt;br/&amp;gt;. . c . . . . .                                               b a 1 . 1 g 1 g&amp;lt;br/&amp;gt;a b . d . f g h                                               . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .                                               . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt; white pawns       white pawns &amp;lt;&amp;lt; 9  &amp;amp;       notAFile     ==      noEaOne
. . . . . . . .     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .
. . . . . . . .     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .
. . . . . . . .     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .
. . . . . . . .     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .
. . . . . . . .     h . . c . . . .      . 1 1 1 1 1 1 1      . . . c . . . .
. . c . . . . .     . a b . d . f g      . 1 1 1 1 1 1 1      . a b . d . f g
a b . d . f g h     . . . . . . . .      . 1 1 1 1 1 1 1      . . . . . . . .
. . . . . . . .     / . . . . . . .      . 1 1 1 1 1 1 1      / . . . . . . .
&amp;nbsp;
 white pawns       white pawns &amp;lt;&amp;lt; 7  &amp;amp;       notHFile     ==     noWeOne
. . . . . . . .     . . . . . . . .      1 1 1 1 1 1 1 .      . . . . . . . .
. . . . . . . .     . . . . . . . .      1 1 1 1 1 1 1 .      . . . . . . . .
. . . . . . . .     . . . . . . . .      1 1 1 1 1 1 1 .      . . . . . . . .
. . . . . . . .     . . . . . . . .      1 1 1 1 1 1 1 .      . . . . . . . .
. . . . . . . .     . c . . . . . .      1 1 1 1 1 1 1 .      . c . . . . . .
. . c . . . . .     b . d . f g h .      1 1 1 1 1 1 1 .      b . d . f g h .
a b . d . f g h     . . . . . . . a      1 1 1 1 1 1 1 .      . . . . . . . .
. . . . . . . .     . . . . . . . \      1 1 1 1 1 1 1 .      . . . . . . . \
&amp;nbsp;
 white pawns                                                 Union (1 == double attacks)
. . . . . . . .                                               . . . . . . . .
. . . . . . . .                                               . . . . . . . .
. . . . . . . .                                               . . . . . . . .
. . . . . . . .                                               . . . . . . . .
. . . . . . . .                                               . c . c . . . .
. . c . . . . .                                               b a 1 . 1 g 1 g
a b . d . f g h                                               . . . . . . . .
. . . . . . . .                                               . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:12 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:137:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Bitboard Basics-Bit-Twiddling relying on the Two&#039;s Complement&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:137 --&gt;Bit-Twiddling relying on the Two&#039;s Complement&lt;/h2&gt;
 &lt;!-- ws:start:WikiTextHeadingRule:139:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc9&quot;&gt;&lt;a name=&quot;Bitboard Basics-Bit-Twiddling relying on the Two&#039;s Complement-LS-Bit-Isolation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:139 --&gt;LS-Bit-Isolation&lt;/h3&gt;
 Intersection with its Two&#039;s Complement isolates the least significant one bit:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:13:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;With some arbitrary sample set:&amp;lt;br/&amp;gt;      x          &amp;amp;amp;        -x         =     LS1B_of_x&amp;lt;br/&amp;gt;. . . . . . . .     1 1 1 1 1 1 1 1     . . . . . . . .&amp;lt;br/&amp;gt;. . 1 . 1 . . .     1 1 . 1 . 1 1 1     . . . . . . . .&amp;lt;br/&amp;gt;. 1 . . . 1 . .     1 . 1 1 1 . 1 1     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     1 1 1 1 1 1 1 1     . . . . . . . .&amp;lt;br/&amp;gt;. 1 . . . 1 . .  &amp;amp;amp;  1 . 1 1 1 . 1 1  =  . . . . . . . .&amp;lt;br/&amp;gt;. . 1 . 1 . . .     . . 1 1 . 1 1 1     . . 1 . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;With some arbitrary sample set:
      x          &amp;amp;        -x         =     LS1B_of_x
. . . . . . . .     1 1 1 1 1 1 1 1     . . . . . . . .
. . 1 . 1 . . .     1 1 . 1 . 1 1 1     . . . . . . . .
. 1 . . . 1 . .     1 . 1 1 1 . 1 1     . . . . . . . .
. . . . . . . .     1 1 1 1 1 1 1 1     . . . . . . . .
. 1 . . . 1 . .  &amp;amp;  1 . 1 1 1 . 1 1  =  . . . . . . . .
. . 1 . 1 . . .     . . 1 1 . 1 1 1     . . 1 . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:13 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:141:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc10&quot;&gt;&lt;a name=&quot;Bitboard Basics-Bit-Twiddling relying on the Two&#039;s Complement-LS-Bit-Reset&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:141 --&gt;LS-Bit-Reset&lt;/h3&gt;
 Intersection with its Ones&#039; Decrement resets the least significant one bit:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:14:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;      x          &amp;amp;amp;      (x-1)        =  x_with_reset_LS1B&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . 1 . 1 . . .     . . 1 . 1 . . .     . . 1 . 1 . . .&amp;lt;br/&amp;gt;. 1 . . . 1 . .     . 1 . . . 1 . .     . 1 . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. 1 . . . 1 . .  &amp;amp;amp;  . 1 . . . 1 . .  =  . 1 . . . 1 . .&amp;lt;br/&amp;gt;. . 1 . 1 . . .     1 1 . . 1 . . .     . . . . 1 . . .&amp;lt;br/&amp;gt;. . . . . . . .     1 1 1 1 1 1 1 1     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     1 1 1 1 1 1 1 1     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;      x          &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;        &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  x_with_reset_LS1B
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .
. &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .  &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;  . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .
. . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .
. . . . . . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . . . . . .
. . . . . . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:14 --&gt;... since two&#039;s complement (-x) and ones&#039; decrement (x-1) are complement sets.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:143:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc11&quot;&gt;&lt;a name=&quot;Bitboard Basics-Converting Bitboards to Lists&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:143 --&gt;Converting Bitboards to Lists&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboard%20Serialization&quot;&gt;Bitboard Serialization&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Traversing%20Subsets%20of%20a%20Set&quot;&gt;Traversing Subsets of a Set&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
At some point bitboards require serialization - for instance if we need to process move-target sets to generate moves. Thanks to the Two&#039;s Complement, isolation and reset is cheap. To determine the bit- or square-index in the 0..63 range is tad more work ...&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:15:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;while ( x ) {&amp;lt;br/&amp;gt;   *list++  = log2OfPowerOfTwo (x &amp;amp;amp; -x); // determine bit index, also referred as BitScan&amp;lt;br/&amp;gt;   x &amp;amp;amp;= x-1; // reset LS1B&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; x &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;list&lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; log2OfPowerOfTwo &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// determine bit index, also referred as BitScan&lt;/span&gt;
   x &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; x&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// reset LS1B&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:15 --&gt;or alternatively&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:16:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;while ( x ) {&amp;lt;br/&amp;gt;   *list++  = bitScanForward(x); // determine bit index of least significant one bit&amp;lt;br/&amp;gt;   x &amp;amp;amp;= x-1; // reset LS1B&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; x &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;list&lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bitScanForward&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// determine bit index of least significant one bit&lt;/span&gt;
   x &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; x&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// reset LS1B&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:16 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:145:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc12&quot;&gt;&lt;a name=&quot;Bitboard Basics-BitScan&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:145 --&gt;BitScan&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan&quot;&gt;BitScan&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Despite recent processors have hardware instruction for bitScan, two hashing methods are mentioned to determine the base two logarithm of a single populated Bitboard. One hash-index is based on multiplication and shift, while the second one is determined by modulo. As we will see, both techniques also appear in hashing of multiple bits of a line.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:147:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc13&quot;&gt;&lt;a name=&quot;Bitboard Basics-BitScan-De Bruijn Multiplication&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:147 --&gt;De Bruijn Multiplication&lt;/h3&gt;
 The classical &lt;strong&gt;De Bruijn&lt;/strong&gt; bitscan, as described by &lt;a class=&quot;wiki_link&quot; href=&quot;/Charles%20Leiserson&quot;&gt;Leiserson et al.&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:54:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Charles%20Leiserson&amp;quot;&amp;gt;Charles E. Leiserson&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Harald%20Prokop&amp;quot;&amp;gt;Harald Prokop&amp;lt;/a&amp;gt; and &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Keith%20H.%20Randall&amp;quot;&amp;gt;Keith H. Randall&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1998&amp;lt;/strong&amp;gt;) &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://supertech.csail.mit.edu/papers/debruijn.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Using de Bruijn Sequences to Index a 1 in a Computer Word&amp;lt;/a&amp;gt; (pdf)&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:54 --&gt;, to determine the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#TheLeastSignificantOneBitLS1B&quot;&gt;LS1B&lt;/a&gt; index by &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table#MinimalPerfectHashing&quot;&gt;minimal perfect hashing&lt;/a&gt;. So called &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/De_Bruijn_sequence&quot; rel=&quot;nofollow&quot;&gt;De Bruijn sequences&lt;/a&gt; were invented by the Dutch mathematician &lt;a class=&quot;wiki_link&quot; href=&quot;/Nicolaas%20de%20Bruijn&quot;&gt;Nicolaas de Bruijn&lt;/a&gt;. A 64-bit De Bruijn sequence contains 64-overlapping unique 6-bit sequences, thus a ring of 64+5 bits. The five hidden &amp;quot;trailing&amp;quot; zeros are in fact common with the five leading zeros. There are 2^26 = 67108864 odd sequences with 6 leading binary zeros and 2^26 even sequences with 5 leading binary zeros, which may be calculated from the odd ones by shifting left one.&lt;br /&gt;
&lt;br /&gt;
A multiplication with a power of two value (the isolated &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#TheLeastSignificantOneBitLS1B&quot;&gt;LS1B&lt;/a&gt;) acts like a left shift by it&#039;s exponent. Thus, if we multiply a 64-bit De Bruijn sequence with the isolated &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#TheLeastSignificantOneBitLS1B&quot;&gt;LS1B&lt;/a&gt;, we get a unique six bit sequence in the most significant bits. To obtain the bit-index we need to extract these upper six bits by shifting right the product, to lookup an array.&lt;br /&gt;
&lt;br /&gt;
See also &lt;a class=&quot;wiki_link&quot; href=&quot;/De%20Bruijn%20Sequence%20Generator&quot;&gt;generating your &amp;quot;private&amp;quot; De Bruijn Bitscan routine&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:17:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;const int index64[64] = {&amp;lt;br/&amp;gt;   63,  0, 58,  1, 59, 47, 53,  2,&amp;lt;br/&amp;gt;   60, 39, 48, 27, 54, 33, 42,  3,&amp;lt;br/&amp;gt;   61, 51, 37, 40, 49, 18, 28, 20,&amp;lt;br/&amp;gt;   55, 30, 34, 11, 43, 14, 22,  4,&amp;lt;br/&amp;gt;   62, 57, 46, 52, 38, 26, 32, 41,&amp;lt;br/&amp;gt;   50, 36, 17, 19, 29, 10, 13, 21,&amp;lt;br/&amp;gt;   56, 45, 25, 31, 35, 16,  9, 12,&amp;lt;br/&amp;gt;   44, 24, 15,  8, 23,  7,  6,  5&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;/**&amp;lt;br/&amp;gt;* bitScanForward&amp;lt;br/&amp;gt;* @author Charles E. Leiserson&amp;lt;br/&amp;gt;*         Harald Prokop&amp;lt;br/&amp;gt;*         Keith H. Randall&amp;lt;br/&amp;gt;* &amp;amp;quot;Using de Bruijn Sequences to Index a 1 in a Computer Word&amp;amp;quot;&amp;lt;br/&amp;gt;* @param bb bitboard to scan&amp;lt;br/&amp;gt;* @precondition bb != 0&amp;lt;br/&amp;gt;* @return index (0..63) of least significant one bit&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;int bitScanForward(U64 bb) {&amp;lt;br/&amp;gt;   const U64 debruijn64 = C64(0x07EDD5E59A4E28C2);&amp;lt;br/&amp;gt;   return index64[((bb &amp;amp;amp; -bb) * debruijn64) &amp;amp;gt;&amp;amp;gt; 58];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; index64&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;59&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;47&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;53&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;39&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;48&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;27&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;54&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;33&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;42&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;61&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;51&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;37&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;49&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;28&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;55&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;30&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;34&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;11&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;43&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;22&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;62&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;57&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;46&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;52&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;38&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;26&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;41&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;50&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;36&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;17&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;19&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;29&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;13&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;21&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;56&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;45&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;25&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;31&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;35&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;12&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;44&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;24&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;23&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;coMULTI&quot;&gt;/**
* bitScanForward
* @author Charles E. Leiserson
*         Harald Prokop
*         Keith H. Randall
* &amp;quot;Using de Bruijn Sequences to Index a 1 in a Computer Word&amp;quot;
* @param bb bitboard to scan
* @precondition bb != 0
* @return index (0..63) of least significant one bit
*/&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; bitScanForward&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bb&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 debruijn64 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x07EDD5E59A4E28C2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; index64&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;bb&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; debruijn64&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:17 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:149:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc14&quot;&gt;&lt;a name=&quot;Bitboard Basics-BitScan-Bitscan by Modulo&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:149 --&gt;Bitscan by Modulo&lt;/h3&gt;
 Another idea is to apply a modulo operation of the isolated LS1B by the prime number 67 &lt;!-- ws:start:WikiTextRefRule:58:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/d5dbf08c66e83517#&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;bitboard 2^i mod 67 is unique&amp;lt;/a&amp;gt; post by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Stefan%20Plenkner&amp;quot;&amp;gt;Stefan Plenkner&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;rec.games.chess.computer&amp;lt;/a&amp;gt;, August 6, 1996&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:58 --&gt;&lt;!-- ws:start:WikiTextRefRule:62:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/871851f83e2c429f#&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;bitboard 2^i mod 67 is unique&amp;lt;/a&amp;gt; post by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Jo%C3%ABl%20Rivat&amp;quot;&amp;gt;Joël Rivat&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;rec.games.chess.computer&amp;lt;/a&amp;gt;, September 2, 1996&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:62 --&gt;&lt;!-- ws:start:WikiTextRefRule:66:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/9658009e315021fe#&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;bitboard 2^i mod 67 is unique&amp;lt;/a&amp;gt; post by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Stefan%20Plenkner&amp;quot;&amp;gt;Stefan Plenkner&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;rec.games.chess.computer&amp;lt;/a&amp;gt;, August 7, 1996&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:66 --&gt;. The remainder 0..66 can be used to &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table#PerfectHashing&quot;&gt;perfectly hash&lt;/a&gt; the bit-index table. Three gaps are 0, 17, and 34, so the mod 67 can make a branchless trailing zero count.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:18:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;const int lookup67[67+1] = {&amp;lt;br/&amp;gt;   64,  0,  1, 39,  2, 15, 40, 23,&amp;lt;br/&amp;gt;    3, 12, 16, 59, 41, 19, 24, 54,&amp;lt;br/&amp;gt;    4, -1, 13, 10, 17, 62, 60, 28,&amp;lt;br/&amp;gt;   42, 30, 20, 51, 25, 44, 55, 47,&amp;lt;br/&amp;gt;    5, 32, -1, 38, 14, 22, 11, 58,&amp;lt;br/&amp;gt;   18, 53, 63,  9, 61, 27, 29, 50,&amp;lt;br/&amp;gt;   43, 46, 31, 37, 21, 57, 52,  8,&amp;lt;br/&amp;gt;   26, 49, 45, 36, 56,  7, 48, 35,&amp;lt;br/&amp;gt;    6, 34, 33, -1&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;/**&amp;lt;br/&amp;gt;* trailingZeroCount&amp;lt;br/&amp;gt;* @param bb bitboard to scan&amp;lt;br/&amp;gt;* @return index (0..63) of least significant one bit, 64 if bb is zero&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;int trailingZeroCount(U64 bb) {&amp;lt;br/&amp;gt;   return lookup67[(bb &amp;amp;amp; -bb) % 67];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; lookup67&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;67&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;39&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;23&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;12&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;59&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;41&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;19&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;24&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;54&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;13&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;17&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;62&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;28&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;42&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;30&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;51&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;25&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;44&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;55&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;47&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;, &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;38&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;22&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;11&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;53&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;61&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;27&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;29&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;50&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;43&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;46&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;31&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;37&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;21&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;57&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;52&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
   &lt;span class=&quot;nu0&quot;&gt;26&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;49&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;45&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;36&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;56&lt;/span&gt;,  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;48&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;35&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;34&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;33&lt;/span&gt;, &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;coMULTI&quot;&gt;/**
* trailingZeroCount
* @param bb bitboard to scan
* @return index (0..63) of least significant one bit, 64 if bb is zero
*/&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; trailingZeroCount&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bb&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; lookup67&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;bb&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;67&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:18 --&gt;Since div/mod is an expensive instruction, a modulo by constant is likely replaced by reciprocal fixed point multiplication to get the quotient and a second multiplication and difference to get the remainder. Compared with De Bruijn multiplication it is still to slow.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:151:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc15&quot;&gt;&lt;a name=&quot;Bitboard Basics-Kindergarten Multiplication&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:151 --&gt;Kindergarten Multiplication&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating&quot;&gt;Flipping Mirroring and Rotating&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Multiplication with &lt;strong&gt;disjoint&lt;/strong&gt; intermediate results was nominated as Kindergarten Multiplication.&lt;br /&gt;
&lt;br /&gt;
Multiplying the masked A-file with the main-diagonal, maps the file-bits to the 8th rank, similar to a flip about the anti-diagonal A8-H1. Shifting down to the 1st rank, leaves the bits like a 90-degree anti clockwise rotation.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:19:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;masked bits                             mapped to 8th rank&amp;lt;br/&amp;gt;bits on A-file   *  main-diagonal    =  with garbage     -&amp;amp;gt; 1st rank&amp;lt;br/&amp;gt;A . . . . . . .     . . . . . . . 1     A B C D E F G H     . . . . . . . .&amp;lt;br/&amp;gt;B . . . . . . .     . . . . . . 1 .     B C D E F G H .     . . . . . . . .&amp;lt;br/&amp;gt;C . . . . . . .     . . . . . 1 . .     C D E F G H . .     . . . . . . . .&amp;lt;br/&amp;gt;D . . . . . . .     . . . . 1 . . .     D E F G H . . .  &amp;amp;gt;&amp;amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;E . . . . . . .  *  . . . 1 . . . .  =  E F G H . . . .  56 . . . . . . . .&amp;lt;br/&amp;gt;F . . . . . . .     . . 1 . . . . .     F G H . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;G . . . . . . .     . 1 . . . . . .     G H . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;H . . . . . . .     1 . . . . . . .     H . . . . . . .     A B C D E F G H&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;masked bits                             mapped to 8th rank
bits on A-file   *  main-diagonal    =  with garbage     -&amp;gt; 1st rank
A . . . . . . .     . . . . . . . 1     A B C D E F G H     . . . . . . . .
B . . . . . . .     . . . . . . 1 .     B C D E F G H .     . . . . . . . .
C . . . . . . .     . . . . . 1 . .     C D E F G H . .     . . . . . . . .
D . . . . . . .     . . . . 1 . . .     D E F G H . . .  &amp;gt;&amp;gt; . . . . . . . .
E . . . . . . .  *  . . . 1 . . . .  =  E F G H . . . .  56 . . . . . . . .
F . . . . . . .     . . 1 . . . . .     F G H . . . . .     . . . . . . . .
G . . . . . . .     . 1 . . . . . .     G H . . . . . .     . . . . . . . .
H . . . . . . .     1 . . . . . . .     H . . . . . . .     A B C D E F G H&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:19 --&gt;That is straight forward multiplication of a masked diagonal or anti-diagonal with the A-file.&lt;br /&gt;
To mask the garbage off, we further shift down by 7 ranks.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:20:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;masked diagonal  *  A-file              mapped&amp;lt;br/&amp;gt;to 8th rank      -&amp;amp;gt;  1st rank&amp;lt;br/&amp;gt;. . . . . . . H     1 . . . . . . .     A B C D E F G H     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . G .     1 . . . . . . .     A B C D E F G .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . F . .     1 . . . . . . .     A B C D E F . .  &amp;amp;gt;&amp;amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;. . . . E . . .     1 . . . . . . .     A B C D E . . .  56 . . . . . . . .&amp;lt;br/&amp;gt;. . . D . . . .  *  1 . . . . . . .  =  A B C D . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . C . . . . .     1 . . . . . . .     A B C . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. B . . . . . .     1 . . . . . . .     A B . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;A . . . . . . .     1 . . . . . . .     A . . . . . . .     A B C D E F G H&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;masked diagonal  *  A-file              mapped
to 8th rank      -&amp;gt;  1st rank
. . . . . . . H     1 . . . . . . .     A B C D E F G H     . . . . . . . .
. . . . . . G .     1 . . . . . . .     A B C D E F G .     . . . . . . . .
. . . . . F . .     1 . . . . . . .     A B C D E F . .  &amp;gt;&amp;gt; . . . . . . . .
. . . . E . . .     1 . . . . . . .     A B C D E . . .  56 . . . . . . . .
. . . D . . . .  *  1 . . . . . . .  =  A B C D . . . .     . . . . . . . .
. . C . . . . .     1 . . . . . . .     A B C . . . . .     . . . . . . . .
. B . . . . . .     1 . . . . . . .     A B . . . . . .     . . . . . . . .
A . . . . . . .     1 . . . . . . .     A . . . . . . .     A B C D E F G H&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:20 --&gt;&lt;br /&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:153:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc16&quot;&gt;&lt;a name=&quot;Attack-Sets as Base for Bitboard Move-generation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:153 --&gt;Attack-Sets as Base for Bitboard Move-generation&lt;/h1&gt;
 Opposed to &amp;quot;None-sliding&amp;quot; pieces, Knight, King and Pawn, whose &lt;strong&gt;controls&lt;/strong&gt; or &lt;strong&gt;attacks&lt;/strong&gt; are determined by its origin &lt;strong&gt;square&lt;/strong&gt; only, sliding piece attacks like Rook-, Bishop- and Queen-attacks are dependent on other pieces as well, which may &lt;strong&gt;block&lt;/strong&gt; the attacking ray in one particular ray-direction.&lt;br /&gt;
&lt;br /&gt;
In Quiescence Search the performance of generating (winning) capture moves is crucial. Opposed to classical square-centric board-representations, which require loops over squares, bitboards permit more efficient algorithms in generating sliding attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:155:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc17&quot;&gt;&lt;a name=&quot;Attack-Sets as Base for Bitboard Move-generation-Sliding piece Attacks on the otherwise empty board&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:155 --&gt;Sliding piece Attacks on the otherwise empty board&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board&quot;&gt;On an empty Board&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Attacks of single sliding pieces on the otherwise empty board or their disjoint subsets on lines or rays are that simple than none sliding pieces. We simply use pre-calculated tables for each piece-type, line or ray, indexed by square-index.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:157:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc18&quot;&gt;&lt;a name=&quot;Attack-Sets as Base for Bitboard Move-generation-Sliding piece Attacks on the otherwise empty board-Ray Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:157 --&gt;Ray Attacks&lt;/h3&gt;
 The mentioned square mapping implies following eight ray-directions as a compass-rose:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:21:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;  northwest    north   northeast&amp;lt;br/&amp;gt;  noWe         nort         noEa&amp;lt;br/&amp;gt;          +7    +8    +9&amp;lt;br/&amp;gt;              \  |  /&amp;lt;br/&amp;gt;  west    -1 &amp;amp;lt;-  0 -&amp;amp;gt; +1    east&amp;lt;br/&amp;gt;              /  |  \&amp;lt;br/&amp;gt;          -9    -8    -7&amp;lt;br/&amp;gt;  soWe         sout         soEa&amp;lt;br/&amp;gt;  southwest    south   southeast&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;  northwest    north   northeast
  noWe         nort         noEa
          +7    +8    +9
              \  |  /
  west    -1 &amp;lt;-  0 -&amp;gt; +1    east
              /  |  \
          -9    -8    -7
  soWe         sout         soEa
  southwest    south   southeast&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:21 --&gt;Positive Rays:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:22:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;East (+1)           Nort (+8)            NoEa (+9)           NoWe (+7)&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . . . 1     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . . 1 .     1 . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . 1 . .     . 1 . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . 1 . . .     . . 1 . . . . .&amp;lt;br/&amp;gt;. . . R 1 1 1 1     . . . R . . . .      . . . B . . . .     . . . B . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;East &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;           Nort &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;            NoEa &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;           NoWe &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . . . . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . .
. . . &lt;span class=&quot;me1&quot;&gt;R&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . &lt;span class=&quot;me1&quot;&gt;R&lt;/span&gt; . . . .      . . . &lt;span class=&quot;me1&quot;&gt;B&lt;/span&gt; . . . .     . . . &lt;span class=&quot;me1&quot;&gt;B&lt;/span&gt; . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:22 --&gt;Negative Rays:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:23:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;West (-1)           Sout (-8)            SoWe (-9)           SoEa (-7)&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;1 1 1 R . . . .     . . . R . . . .      . . . B . . . .     . . . B . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . 1 . . . . .     . . . . 1 . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . 1 . . . . . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      1 . . . . . . .     . . . . . . 1 .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;West &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;           Sout &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;            SoWe &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;           SoEa &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .     . . . . . . . .
&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; R . . . .     . . . &lt;span class=&quot;me1&quot;&gt;R&lt;/span&gt; . . . .      . . . &lt;span class=&quot;me1&quot;&gt;B&lt;/span&gt; . . . .     . . . &lt;span class=&quot;me1&quot;&gt;B&lt;/span&gt; . . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . .     . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . .     . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . . .     . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:23 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:159:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc19&quot;&gt;&lt;a name=&quot;Attack-Sets as Base for Bitboard Move-generation-Sliding piece Attacks on the otherwise empty board-Line Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:159 --&gt;Line Attacks&lt;/h3&gt;
 &lt;!-- ws:start:WikiTextCodeRule:24:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;Rank                File                 Diagonal            Anti-Diagonal&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . . . 1     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . . 1 .     1 . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . . 1 . .     . 1 . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . . . 1 . . .     . . 1 . . . . .&amp;lt;br/&amp;gt;1 1 1 R 1 1 1 1     . . . R . . . .      . . . B . . . .     . . . B . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . . 1 . . . . .     . . . . 1 . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      . 1 . . . . . .     . . . . . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . 1 . . . .      1 . . . . . . .     . . . . . . 1 .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;Rank                File                 Diagonal            Anti&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;Diagonal
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . . . . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . .
&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; R &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . &lt;span class=&quot;me1&quot;&gt;R&lt;/span&gt; . . . .      . . . &lt;span class=&quot;me1&quot;&gt;B&lt;/span&gt; . . . .     . . . &lt;span class=&quot;me1&quot;&gt;B&lt;/span&gt; . . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . .     . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . .     . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .
. . . . . . . .     . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .      &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . . .     . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:24 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:161:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc20&quot;&gt;&lt;a name=&quot;Attack-Sets as Base for Bitboard Move-generation-Sliding piece Attacks on the otherwise empty board-Piece attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:161 --&gt;Piece attacks&lt;/h3&gt;
Piece attacks are the union of either orthogonal or diagonal lines. Queen attacks are the union of rook- and bishop attacks.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:25:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;                                   Queen&amp;lt;br/&amp;gt;                               . . . 1 . . . 1&amp;lt;br/&amp;gt;                               1 . . 1 . . 1 .&amp;lt;br/&amp;gt;                               . 1 . 1 . 1 . .&amp;lt;br/&amp;gt;               Rook            . . 1 1 1 . . .         Bishop&amp;lt;br/&amp;gt;           . . . 1 . . . .     1 1 1 Q 1 1 1 1     . . . . . . . 1&amp;lt;br/&amp;gt;           . . . 1 . . . .     . . 1 1 1 . . .     1 . . . . . 1 .&amp;lt;br/&amp;gt;           . . . 1 . . . .     . 1 . 1 . 1 . .     . 1 . . . 1 . .&amp;lt;br/&amp;gt;           . . . 1 . . . .     1 . . 1 . . 1 .     . . 1 . 1 . . .&amp;lt;br/&amp;gt;           1 1 1 R 1 1 1 1                         . . . B . . . .&amp;lt;br/&amp;gt;           . . . 1 . . . .                         . . 1 . 1 . . .&amp;lt;br/&amp;gt;           . . . 1 . . . .                         . 1 . . . 1 . .&amp;lt;br/&amp;gt;           . . . 1 . . . .                         1 . . . . . 1 .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;                                   Queen
                               . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
                               &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .
                               . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .
               &lt;span class=&quot;me1&quot;&gt;Rook&lt;/span&gt;            . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .         &lt;span class=&quot;me1&quot;&gt;Bishop&lt;/span&gt;
           . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; Q &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;     . . . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
           . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .     . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .
           . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .     . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .
           . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .     &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .     . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .
           &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; R &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;                         . . . &lt;span class=&quot;me1&quot;&gt;B&lt;/span&gt; . . . .
           . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .                         . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . .
           . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .                         . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . .
           . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . .                         &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; . . . . . &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:25 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:163:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc21&quot;&gt;&lt;a name=&quot;Sliding Attacks by Calculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:163 --&gt;Sliding Attacks by Calculation&lt;/h1&gt;
 For one single sliding piece, one may consider subtraction from the set of blockers, to determine attack sets. Zeros, that are empty squares, between the nearest blocker and the sliding pieces became &amp;quot;ones&amp;quot;, the nearest blocker becomes zero. In fact all flipped bits are the attacked squares in positive ray direction.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:26:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt; occupied  11000101&amp;lt;br/&amp;gt; slider    00000100 subset of occupied&amp;lt;br/&amp;gt; o-s       11000001 resets the slider in occupied&amp;lt;br/&amp;gt; o-2s      10111101 borrows the one from nearest blocker&amp;lt;br/&amp;gt; occupied  11000101&amp;lt;br/&amp;gt; o^(o-2s)  01111000 all flipped bits are the attacks in most significant bit direction&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt; occupied  11000101
 slider    00000100 subset of occupied
 o-s       11000001 resets the slider in occupied
 o-2s      10111101 borrows the one from nearest blocker
 occupied  11000101
 o^(o-2s)  01111000 all flipped bits are the attacks in most significant bit direction&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:26 --&gt;&lt;br /&gt;
To restrict the operations to a certain line, rank file or diagonal, a leading intersection with the line mask is necessary, same for the final result.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:165:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc22&quot;&gt;&lt;a name=&quot;Sliding Attacks by Calculation-Subtraction and Reverse Subtraction of rooks from blockers&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:165 --&gt;Subtraction and Reverse Subtraction of rooks from blockers&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Subtracting%20a%20rook%20from%20a%20blocking%20piece&quot;&gt;Subtracting a rook from a blocking piece&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Hyperbola%20Quintessence&quot;&gt;Hyperbola Quintessence&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
With s (sliding piece) single element set and subset of o (occupied):&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:27:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;positiveRayAttacks = o  ^ (o - 2s);&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;positiveRayAttacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; o  &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;o &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; 2s&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:27 --&gt;The first subtraction resets the siding-piece-bit in occupied.&lt;br /&gt;
The second subtraction borrows a one from nearest blocker (if any), and sets all intermediate zero bits (empty squares). The exclusive or gains all flipped bits, which turnes out to be the rook attacks in &amp;quot;positive&amp;quot; attacking direction.&lt;br /&gt;
&lt;br /&gt;
For negative directions one needs &amp;quot;reverse&amp;quot; arithmetic (2 + 2 == 1).&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:28:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;with o&#039; = reverse (o)&amp;lt;br/&amp;gt;and  s&#039; = reverse (s)&amp;lt;br/&amp;gt;negativeRayAttacks = reverse (o&#039; ^ (o&#039; - 2s&#039;));&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;with o&lt;span class=&quot;st0&quot;&gt;&#039; = reverse (o)
and  s&#039;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; reverse &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;s&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
negativeRayAttacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; reverse &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;o&lt;span class=&quot;st0&quot;&gt;&#039; ^ (o&#039;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; 2s&lt;span class=&quot;st0&quot;&gt;&#039;));&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:28 --&gt;Since bit-reversal or any mirroring or flipping is distributive over xor:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:29:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;reverse(a ^ b) == reverse (a) ^ reverse(b)&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;reverse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;a &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; reverse &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;a&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; reverse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:29 --&gt;One can reformulate negative rays&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:30:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;negativeRayAttacks = o  ^  reverse (o&#039; - 2s&#039;);&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;negativeRayAttacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; o  &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;  reverse &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;o&lt;span class=&quot;st0&quot;&gt;&#039; - 2s&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:30 --&gt;which leads to a simplification in the line-attacks, since positiveRayAttacks and negativeRayAttacks are disjoint sets for one particular sliding piece and may be combined by &amp;quot;xor&amp;quot;, and o ^ o == 0.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:31:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;lineAttacks = positiveRayAttacks ^ negativeRayAttacks;&amp;lt;br/&amp;gt;lineAttacks =         o ^ (o-2s) ^ reverse( o&#039;-2s&#039;) ^ o&amp;lt;br/&amp;gt;lineAttacks =             (o-2s) ^ reverse( o&#039;-2s&#039;)&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;lineAttacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; positiveRayAttacks &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; negativeRayAttacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
lineAttacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;         o &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;o&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;2s&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; reverse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; o&lt;span class=&quot;st0&quot;&gt;&#039;-2s&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; o
lineAttacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;o&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;2s&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; reverse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; o&lt;span class=&quot;st0&quot;&gt;&#039;-2s&#039;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:31 --&gt;Diagonal or vertical line occupancies need leading and trailing intersection with line-masks. Thanks to the little-endian versus big-endian war, recent processors have appropriate instructions to swap bytes (ranks) inside a 64-bit word for the reverse arithmetic, note that masked files or diagonals have only max one bit per rank:&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:32:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 diagonalAttacks(U64 occ, int sqOfSlider) {&amp;lt;br/&amp;gt;   U64 forward, reverse, slider, lineMask;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   lineMask = diagonalMaskEx[sqOfSlider]; // excludes square of slider&amp;lt;br/&amp;gt;   slider   = singleBitboard[sqOfSlider]; // single bit 1 &amp;amp;lt;&amp;amp;lt; sq, 2^sq&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   forward  = occ &amp;amp;amp; lineMask; // also performs the first subtraction by clearing the s in o&amp;lt;br/&amp;gt;   reverse  = byteswap( forward ); // o&#039;-s&#039;&amp;lt;br/&amp;gt;   forward -=         ( slider  ); // o -2s&amp;lt;br/&amp;gt;   reverse -= byteswap( slider  ); // o&#039;-2s&#039;&amp;lt;br/&amp;gt;   forward ^= byteswap( reverse );&amp;lt;br/&amp;gt;   return forward &amp;amp;amp; lineMask;      // mask the line again&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sqOfSlider&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 forward, reverse, slider, lineMask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   lineMask &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sqOfSlider&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// excludes square of slider&lt;/span&gt;
   slider   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; singleBitboard&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sqOfSlider&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// single bit 1 &amp;lt;&amp;lt; sq, 2^sq&lt;/span&gt;
&amp;nbsp;
   forward  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; lineMask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// also performs the first subtraction by clearing the s in o&lt;/span&gt;
   reverse  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; byteswap&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; forward &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// o&#039;-s&#039;&lt;/span&gt;
   forward &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; slider  &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// o -2s&lt;/span&gt;
   reverse &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; byteswap&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; slider  &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// o&#039;-2s&#039;&lt;/span&gt;
   forward &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; byteswap&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; reverse &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; forward &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; lineMask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;      &lt;span class=&quot;co1&quot;&gt;// mask the line again&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:32 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:167:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc23&quot;&gt;&lt;a name=&quot;Sliding Attacks by Calculation-Flood Fill Techniques with multiple sliders&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:167 --&gt;Flood Fill Techniques with multiple sliders&lt;/h2&gt;
 Fill approaches determine attacks set-wise for multiple pieces (i.e. rooks and queen(s)) in one particular ray-direction. The flood stops on each particular ray (either 8 ranks or files, or 15 diagonals or anti-diagonals), if a square is not empty.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:169:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc24&quot;&gt;&lt;a name=&quot;Sliding Attacks by Calculation-Flood Fill Techniques with multiple sliders-Occluded Fill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:169 --&gt;Occluded Fill&lt;/h3&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Dumb7Fill&quot;&gt;Dumb7Fill&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
For sliding piece-attacks one direction step can be repeated seven times, after each shift, intersecting with empty squares accumulating all intermediate results to a union set, which results in an occluded fill set, including the sliding piece but excluding the blocker.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:33:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 eastOccluded (U64 rooks, U64 empty) {&amp;lt;br/&amp;gt;   empty  = empty &amp;amp;amp; notAFile; // make A-File all occupied, to consider H-A-wraps after shift&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 1. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 2. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 3. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 4. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 5. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 6. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 7. fill // not necessary for further attack generation&amp;lt;br/&amp;gt;   return rooks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 eastOccluded &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   empty  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// make A-File all occupied, to consider H-A-wraps after shift&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 1. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 2. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 3. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 4. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 5. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 6. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 7. fill // not necessary for further attack generation&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; rooks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:33 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:171:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc25&quot;&gt;&lt;a name=&quot;Sliding Attacks by Calculation-Flood Fill Techniques with multiple sliders-Kogge-Stone Parallel Prefix Algorithm&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:171 --&gt;Kogge-Stone Parallel Prefix Algorithm&lt;/h3&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Kogge-Stone%20Algorithm&quot;&gt;Kogge-Stone Algorithm&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;Parallel Prefix Algorithms&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
Occluded fill might be done more efficiently parallel prefix wise by Kogge-Stone Algorithms:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:34:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 eastOccluded(U64 rooks, U64 empty) {&amp;lt;br/&amp;gt;   empty  = empty &amp;amp;amp; notAFile; // make A-File all occupied, to consider H-A-wraps after shift&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1);&amp;lt;br/&amp;gt;   empty  = empty &amp;amp;amp; (empty &amp;amp;lt;&amp;amp;lt; 1);&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 2);&amp;lt;br/&amp;gt;   empty  = empty &amp;amp;amp; (empty &amp;amp;lt;&amp;amp;lt; 2);&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 4);&amp;lt;br/&amp;gt;   return rooks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 eastOccluded&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   empty  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// make A-File all occupied, to consider H-A-wraps after shift&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   empty  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;empty &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   empty  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;empty &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; rooks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:34 --&gt;&lt;br /&gt;
The Kogge-Stone &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;parallel prefix algorithm&lt;/a&gt; for sliding piece attack generation was first introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;CCC&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:70:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.stmintz.com/ccc/index.php?id=252289&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: flood fill attack bitboards&amp;lt;/a&amp;gt; answer by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Steffan%20Westcott&amp;quot;&amp;gt;Steffan Westcott&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, September 15, 2002&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-6&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-6&quot;&gt;[6]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:70 --&gt;. It is a parallel prefix approach of a occluded &lt;a class=&quot;wiki_link&quot; href=&quot;/Dumb7Fill&quot;&gt;dumb7&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Flood_fill&quot; rel=&quot;nofollow&quot;&gt;flood-fill&lt;/a&gt;, propagating sliding piece attacks in software like carries of a kogge-stone &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Carry_look-ahead_adder&quot; rel=&quot;nofollow&quot;&gt;hardware adder&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:72:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.aoki.ecei.tohoku.ac.jp/arith/mg/algorithm.html#fsa_pfx&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Hardware algorithms for arithmetic modules&amp;lt;/a&amp;gt; from the ARITH research group, Aoki lab., Tohoku University&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-7&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-7&quot;&gt;[7]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:72 --&gt;. We need to pass sliders as generator set and the set of empty squares as propagator set. For appropriate attacks we need to shift &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;one step&lt;/a&gt; further, considering wraps.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:173:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc26&quot;&gt;&lt;a name=&quot;Sliding Attacks by Calculation-Flood Fill Techniques with multiple sliders-Ray-wise Attacks in one Direction&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:173 --&gt;Ray-wise Attacks in one Direction&lt;/h3&gt;
 For square attack sets, occluded fill sets need to be shifted one more step. Thus, the occluded fill needs one fill cycle less.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:35:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 eastAttacks (U64 rooks, U64 empty) {&amp;lt;br/&amp;gt;   empty  = empty &amp;amp;amp; notAFile; // make A-File all occupied, to consider H-A-wraps after shift&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 1. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 2. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 3. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 4. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 5. fill&amp;lt;br/&amp;gt;   rooks |= empty &amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1); // 6. fill&amp;lt;br/&amp;gt;   return notAFile&amp;amp;amp; (rooks &amp;amp;lt;&amp;amp;lt; 1);&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 eastAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   empty  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// make A-File all occupied, to consider H-A-wraps after shift&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 1. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 2. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 3. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 4. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 5. fill&lt;/span&gt;
   rooks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; empty &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 6. fill&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; notAFile&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:35 --&gt;&lt;br /&gt;
Because fill-approaches keep distinct ray-directions, there is still a unique source-target square relation. Fill approaches with pure calculation are Cpu-intensive, but require no memory reads. They are a domain of SIMD instruction sets like SSE2 with sixteen 128-bit registers, to process two or four distinct sets (e.g. white and black, sliders and king as queen like meta-slider) per register and several ray-directions simultaneously - e.g. three 128-bit instructions per cycle for core2duo.&lt;br /&gt;
&lt;br /&gt;
Keeping distinct ray-directions has some advantages, for instance in determining pinned pieces or discovered checks. Fill-Algorithms are great to feed in line-wise attack sets of single sliders, to determine a progressive mobility on the orthogonal rays, i.e. move targets in two moves, or trajectories against important squares or areas.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:36:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . \ . . .&amp;lt;br/&amp;gt; . . . \ . 1 . .&amp;lt;br/&amp;gt; . . \ . 1 . \ .&amp;lt;br/&amp;gt; . \ . 1 . \ . .&amp;lt;br/&amp;gt; . . 1 . \ . . .&amp;lt;br/&amp;gt; . B . \ . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt; . . . . . . . .
 . . . . \ . . .
 . . . \ . 1 . .
 . . \ . 1 . \ .
 . \ . 1 . \ . .
 . . 1 . \ . . .
 . B . \ . . . .
 . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:36 --&gt;&lt;br /&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:175:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc27&quot;&gt;&lt;a name=&quot;Lookup Techniques&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:175 --&gt;Lookup Techniques&lt;/h1&gt;
 Lookup Techniques are used to hash pre-calculated attack-sets of a single pieces by square-index and occupancy of the affected lines.&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:177:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc28&quot;&gt;&lt;a name=&quot;Lookup Techniques-Rook Attacks on the first Rank - as a base of occupancy lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:177 --&gt;Rook Attacks on the first Rank - as a base of occupancy lookup&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks&quot;&gt;First Rank Attacks&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
The first &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;rank&lt;/a&gt; is the ideal line to introduce occupancy lookups.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:179:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc29&quot;&gt;&lt;a name=&quot;Lookup Techniques-Rook Attacks on the first Rank - as a base of occupancy lookup-One Byte Only&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:179 --&gt;One Byte Only&lt;/h3&gt;
 Assume we (temporary) reduce the chess-board to one &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;rank&lt;/a&gt;. Occupancy bitboard is one &lt;a class=&quot;wiki_link&quot; href=&quot;/Byte&quot;&gt;byte&lt;/a&gt; with up to 256 states. A &lt;a class=&quot;wiki_link&quot; href=&quot;/Rook&quot;&gt;rook&lt;/a&gt; attack-set from one of the eight &lt;a class=&quot;wiki_link&quot; href=&quot;/Squares&quot;&gt;squares&lt;/a&gt; (&lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;file&lt;/a&gt;) on this single rank is also only one byte. Thus we can construct an array of bytes[256][8], indexed by all 256 occupancies and 8 files, to lookup the pre-calculated rank-attack bytes.&lt;br /&gt;
&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:593:&amp;lt;img src=&amp;quot;/file/view/firstRank.JPG/47379251/firstRank.JPG&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;img src=&quot;/file/view/firstRank.JPG/47379251/firstRank.JPG&quot; alt=&quot;firstRank.JPG&quot; title=&quot;firstRank.JPG&quot; /&gt;&lt;!-- ws:end:WikiTextLocalImageRule:593 --&gt;&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Occupancy of the first rank = 01001010B&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:594:&amp;lt;img src=&amp;quot;/file/view/firstRankA.JPG/47379293/firstRankA.JPG&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;img src=&quot;/file/view/firstRankA.JPG/47379293/firstRankA.JPG&quot; alt=&quot;firstRankA.JPG&quot; title=&quot;firstRankA.JPG&quot; /&gt;&lt;!-- ws:end:WikiTextLocalImageRule:594 --&gt;&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Rank-attacks ::= f (e-file, Occupancy) = 01110110B&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:37:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;BYTE arrFirstRankAttacks256x8[256][8]; // 2048 Bytes = 2KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;firstRankAttack = arrFirstRankAttacks256x8[rankOccupancy][squareOnRank];&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;BYTE arrFirstRankAttacks256x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 2048 Bytes = 2KByte&lt;/span&gt;
&amp;nbsp;
firstRankAttack &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; arrFirstRankAttacks256x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;rankOccupancy&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;squareOnRank&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:37 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:181:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc30&quot;&gt;&lt;a name=&quot;Lookup Techniques-Rook Attacks on the first Rank - as a base of occupancy lookup-The Outer Squares&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:181 --&gt;The Outer Squares&lt;/h3&gt;
 If we think about to the occupancy lookup, we may recognize that the outer squares don&#039;t matter. There are no more squares behind. The outer squares are either attacked or not - independent from their occupancy state. We can use the &lt;strong&gt;six inner bits&lt;/strong&gt; only as lookup-index with two additional cheap instruction. This reduces the lookup-table by factor of &lt;strong&gt;four&lt;/strong&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:38:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;BYTE arrFirstRankAttacks64x8[64][8]; // 512 Bytes = 1/2KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;firstRankAttack = arrFirstRankAttacks64x8[(rankOccupancy &amp;amp;gt;&amp;amp;gt; 1)&amp;amp;amp; 63][squareOnRank];&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;BYTE arrFirstRankAttacks64x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 512 Bytes = 1/2KByte&lt;/span&gt;
&amp;nbsp;
firstRankAttack &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; arrFirstRankAttacks64x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rankOccupancy &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;squareOnRank&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:38 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:183:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc31&quot;&gt;&lt;a name=&quot;Lookup Techniques-Rook Attacks on the first Rank - as a base of occupancy lookup-Other ranks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:183 --&gt;Other ranks&lt;/h3&gt;
 It is simple to shift other ranks to the first rank, and to shift back the attack set.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:185:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc32&quot;&gt;&lt;a name=&quot;Lookup Techniques-Rotated Bitboards&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:185 --&gt;Rotated Bitboards&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Rotated Bitboards&lt;/strong&gt; are a bitboard move generation technique invented independently by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:81:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Robert%20Hyatt&amp;quot;&amp;gt;Robert Hyatt&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1999&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.craftychess.com/hyatt/bitmaps.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Rotated Bitmaps, a New Twist on an Old Idea&amp;lt;/a&amp;gt;&amp;lt;/em&amp;gt;. &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/ICGA%20Journal&amp;quot;&amp;gt;ICCA Journal&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.cs.unimaas.nl/icga/journal/contents/content22-4.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Vol. 22, No. 4&amp;lt;/a&amp;gt;, pp. 213–222. &amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-8&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-8&quot;&gt;[8]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:81 --&gt; and by &lt;a class=&quot;wiki_link&quot; href=&quot;/Ernst%20A.%20Heinz&quot;&gt;Ernst A. Heinz&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:83:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://people.csail.mit.edu/heinz/dt/node8.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Rotated Bitboards by Ernst A. Heinz&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-9&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-9&quot;&gt;[9]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:83 --&gt; with &lt;a class=&quot;wiki_link&quot; href=&quot;/Peter%20Gillgasch&quot;&gt;Peter Gillgasch&lt;/a&gt; from the &lt;a class=&quot;wiki_link&quot; href=&quot;/DarkThought&quot;&gt;DarkThought&lt;/a&gt; team. This variation uses rotated copies of the occupancy in order to place bits along a &lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;file&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Diagonals&quot;&gt;diagonal&lt;/a&gt; in adjacent bits. Because of this, these bits can be easily extracted to obtain an occupancy map for a &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;rank&lt;/a&gt;, file, or diagonal. This is used, along with the square of a slider, to lookup a bitboard containing attacks in an array.&lt;br /&gt;
&lt;br /&gt;
Rotated bitboards are fast to extract the occupancy index and require 32 KByte for each line direction (rank, file, diagonal and anti-diagonal) for the lookup-tables, considering the inner six bits. However, there is more work in updating four occupied bitboards while making or unmaking moves, instead of one. The fast 64-bit multiplication of recent x64 processors (~4-cycles) with a throughput of up to one cycle, makes on the fly calculations of occupied states on files and diagonals more attractive.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:187:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc33&quot;&gt;&lt;a name=&quot;Lookup Techniques-Kindergarten Bitboards&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:187 --&gt;Kindergarten Bitboards&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;Kindergarten Bitboards&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
Kindergarten Bitboards perform a fill-multiplication and uses a shared lookup table for ranks and diagonals.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:189:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc34&quot;&gt;&lt;a name=&quot;Lookup Techniques-Kindergarten Bitboards-Ranks and Diagonals&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:189 --&gt;Ranks and Diagonals&lt;/h3&gt;
 Ranks and diagonals - that is their appropriate line-mask by square-index - are first intersected by the occupancy of the whole board. Doesn&#039;t matter whether the slider itself is cleared or not - it is redundant anyway, considered by the pre-calculated lookup-table. Since there is only up to one bit per file, the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Multiplication&quot;&gt;north-fill multiplication&lt;/a&gt; by the A-file maps the diagonal to the 8th rank. Or - since we only need the inner six bits, we combine the required shift left one by multiplying with the B-file. Shifting right the product by 58 (64-6) leaves the six-bit occupancy-index in the 0..63 range.&lt;br /&gt;
&lt;br /&gt;
For instance the diagonal-attacks of a bishop on d4. &#039;A&#039;-&#039;H&#039; represent the masked occupied bits along this diagonal, which are either zero or one. We need &#039;B&#039;-&#039;G&#039; as six bit number:&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:39:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;masked line      *  B-File           =  B-G upper six       occupancy 6 bit&amp;lt;br/&amp;gt;. . . . . . . H     . 1 . . . . . .     . A[B C . E F G]    . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . G .     . 1 . . . . . .     . A B C . E F G     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . F . .     . 1 . . . . . .     . A B C . E F .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . E . . .     . 1 . . . . . .     . A B C . E . .  &amp;amp;gt;&amp;amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .  *  . 1 . . . . . .  =  . A B C . . . .  58 . . . . . . . .&amp;lt;br/&amp;gt;. . C . . . . .     . 1 . . . . . .     . A B C . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. B . . . . . .     . 1 . . . . . .     . A B . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;A . . . . . . .     . 1 . . . . . .     . A . . . . . .    [B C . E F G]. .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;masked line      *  B-File           =  B-G upper six       occupancy 6 bit
. . . . . . . H     . 1 . . . . . .     . A[B C . E F G]    . . . . . . . .
. . . . . . G .     . 1 . . . . . .     . A B C . E F G     . . . . . . . .
. . . . . F . .     . 1 . . . . . .     . A B C . E F .     . . . . . . . .
. . . . E . . .     . 1 . . . . . .     . A B C . E . .  &amp;gt;&amp;gt; . . . . . . . .
. . . . . . . .  *  . 1 . . . . . .  =  . A B C . . . .  58 . . . . . . . .
. . C . . . . .     . 1 . . . . . .     . A B C . . . .     . . . . . . . .
. B . . . . . .     . 1 . . . . . .     . A B . . . . .     . . . . . . . .
A . . . . . . .     . 1 . . . . . .     . A . . . . . .    [B C . E F G]. .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:39 --&gt;&lt;br /&gt;
The pre-calculated lookup-table contains the attacks of the first rank - but eight copies in each rank or byte. It is indexed by the six bit occupied-state (&#039;B&#039;-&#039;G&#039;) and the file of the slider&#039;s square. It needs to be intersected with the same line-mask as formerly the occupancy - to map the first rank attack bits to the appropriate line - that&#039;s all. Appropriate pre-calculated attack bits are represented by &#039;a&#039;-&#039;h&#039;:&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:40:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;fillUpAttacks[file == 3][B C . E F G]:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;8 copies of rank      the attack set&amp;lt;br/&amp;gt;attacks &amp;amp;amp; l-mask  -&amp;amp;gt;  of this line&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . . h&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . g .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . f . .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . e . . .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       . . c . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       . b . . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       a . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;fillUpAttacks[file == 3][B C . E F G]:
&amp;nbsp;
8 copies of rank      the attack set
attacks &amp;amp; l-mask  -&amp;gt;  of this line
a b c . e f g h       . . . . . . . h
a b c . e f g h       . . . . . . g .
a b c . e f g h       . . . . . f . .
a b c . e f g h       . . . . e . . .
a b c . e f g h       . . . . . . . .
a b c . e f g h       . . c . . . . .
a b c . e f g h       . b . . . . . .
a b c . e f g h       a . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:40 --&gt;Code spippets.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:41:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 fillUpAttacks[8][64];  // 4 KByte pre-calculated Lookup table&amp;lt;br/&amp;gt;const U64 bFile = C64(0x0202020202020202);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ = (diagonalMaskEx[sq] &amp;amp;amp; occ) * bFile &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   return diagonalMaskEx[sq] &amp;amp;amp; fillUpAttacks[sq&amp;amp;amp;7][occ];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 antiDiagAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ = (antidiagMaskEx[sq] &amp;amp;amp; occ) * bFile &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   return antidiagMaskEx[sq] &amp;amp;amp; fillUpAttacks[sq&amp;amp;amp;7][occ];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rankAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ = (rankMaskEx[sq] &amp;amp;amp; occ) * bFile &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   return rankMaskEx[sq] &amp;amp;amp; fillUpAttacks[sq&amp;amp;amp;7][occ];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 fillUpAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 4 KByte pre-calculated Lookup table&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 bFile &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0202020202020202&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; bFile &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; fillUpAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 antiDiagAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;antidiagMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; bFile &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; antidiagMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; fillUpAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 rankAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rankMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; bFile &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; rankMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; fillUpAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:41 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:191:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc35&quot;&gt;&lt;a name=&quot;Lookup Techniques-Kindergarten Bitboards-Files&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:191 --&gt;Files&lt;/h3&gt;
 File attacks need tad more work:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:42:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 aFileAttacks [8][64];  // 4 KByte&amp;lt;br/&amp;gt;const U64 aFile   = C64(0x0101010101010101);&amp;lt;br/&amp;gt;const U64 diac2h7 = C64(0x0080402010080400);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ = aFile  &amp;amp;amp; (occ &amp;amp;gt;&amp;amp;gt; (sq&amp;amp;amp;7));&amp;lt;br/&amp;gt;   occ = (diac2h7 *  occ ) &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   return aFileAttacksx[sq&amp;amp;gt;&amp;amp;gt;3][occ] &amp;amp;lt;&amp;amp;lt; (sq&amp;amp;amp;7);&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 aFileAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 4 KByte&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 aFile   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 diac2h7 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0080402010080400&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 fileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; aFile  &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;diac2h7 &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;  occ &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; aFileAttacksx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:42 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:193:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc36&quot;&gt;&lt;a name=&quot;Lookup Techniques-Congruent Modulo Bitboards&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:193 --&gt;Congruent Modulo Bitboards&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Congruent%20Modulo%20Bitboards&quot;&gt;Congruent Modulo Bitboards&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Congruent Modulo Bitboards&lt;/strong&gt; was introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Trevor%20Fenner&quot;&gt;Trevor Fenner&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Mark%20Levene&quot;&gt;Mark Levene&lt;/a&gt; in the &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal&quot;&gt;ICGA Journal&lt;/a&gt; Vol. 31, No. 1 in 2008 &lt;!-- ws:start:WikiTextRefRule:91:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Trevor%20Fenner&amp;quot;&amp;gt;Trevor Fenner&amp;lt;/a&amp;gt; and &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Mark%20Levene&amp;quot;&amp;gt;Mark Levene&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;2008&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;Move Generation with Perfect Hashing Functions.&amp;lt;/em&amp;gt; &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/ICGA%20Journal&amp;quot;&amp;gt;ICGA Journal&amp;lt;/a&amp;gt;, Vol. 31, No. 1, pp. 3-12. ISSN 1389-6911.&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-10&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-10&quot;&gt;[10]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:91 --&gt;. While their &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table&quot;&gt;Perfect Hashing&lt;/a&gt; approach provides great mathematical insights in &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Modulo&quot; rel=&quot;nofollow&quot;&gt;Congruent Modulo&lt;/a&gt; arithmetic, their final conclusion in comparison with &lt;a class=&quot;wiki_link&quot; href=&quot;/Hashing%20Dictionaries&quot;&gt;Hashing Dictionaries&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt; was criticized by the obvious comparison with &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;Kindergarten Bitboards&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:95:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=20913&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Nice Math - Strange Conclusions&amp;lt;/a&amp;gt; post by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Gerd%20Isenberg&amp;quot;&amp;gt;Gerd Isenberg&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-11&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-11&quot;&gt;[11]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:95 --&gt;.&lt;br /&gt;
&lt;br /&gt;
Fenner and Levene use masked line modulo 514 for the diagonals, modulo 257 for the anti-diagonals and mod 258 for files, to calculate the occupied index, but they didn&#039;t consider the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;inner six bits&lt;/a&gt; for a denser lookup. Of course, tables could made denser by storing indices, but that would require a second indirection. While Fenner and Levene used a &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/MATLAB&quot; rel=&quot;nofollow&quot;&gt;Matlab&lt;/a&gt; 32-bit implementation to conclude their approach might be competitive, this is how it may be implemented in &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt; by looking up pre-calculated attack-bitboards:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:43:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 arrCmodDiaAttacks [514][64];  // 257 K&amp;lt;br/&amp;gt;U64 arrCmodAntiAttacks[257][64];&amp;lt;br/&amp;gt;U64 arrCmodFileAttacks[258][64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ = (diagonalMask[sq] &amp;amp;amp; occ) % 514;&amp;lt;br/&amp;gt;   return arrCmodDiaAttacks[occ][sq];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 antiDiagAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ = (antiDiagMask[sq] &amp;amp;amp; occ) % 257;&amp;lt;br/&amp;gt;   return arrCmodAntiAttacks[occ][sq];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ = (fileMask[sq] &amp;amp;amp; occ) % 258;&amp;lt;br/&amp;gt;   return arrCmodFileAttacks[occ][sq];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 arrCmodDiaAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;514&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 257 K&lt;/span&gt;
U64 arrCmodAntiAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;257&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
U64 arrCmodFileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;258&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;diagonalMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;514&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; arrCmodDiaAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 antiDiagAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;antiDiagMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;257&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; arrCmodAntiAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 fileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;fileMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;258&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; arrCmodFileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:43 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:195:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc37&quot;&gt;&lt;a name=&quot;Lookup Techniques-Magic Bitboards&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:195 --&gt;Magic Bitboards&lt;/h2&gt;
 &lt;em&gt;see main article &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Magic bitboards uses a multiply-right-shift &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table#PerfectHashing&quot;&gt;perfect hashing&lt;/a&gt; algorithm to index a attack bitboard database - which leaves both line-attacks of a bishop or rook in one run.&lt;br /&gt;
&lt;br /&gt;
The magic bitboard approach was introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Lasse%20Hansen&quot;&gt;Lasse Hansen&lt;/a&gt; in the &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard programming forum&lt;/a&gt;. He had the idea to hash the up to twelve relevant occupied bits of &lt;strong&gt;both directions&lt;/strong&gt; of a rook- or bishop movement simultaneously &lt;!-- ws:start:WikiTextRefRule:99:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Lasse%20Hansen&amp;quot;&amp;gt;Lasse Hansen&#039;s&amp;lt;/a&amp;gt; &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5015&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Initial idea&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, June 14, 2006&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-12&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-12&quot;&gt;[12]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:99 --&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&#039;s&lt;/a&gt; improvements to Lasse Hansen&#039;s initial approach was to introduce a &lt;a class=&quot;wiki_link&quot; href=&quot;/Java&quot;&gt;Java&lt;/a&gt;-like, two-dimensional array with individual size for each square and all it&#039;s relevant occupancies &lt;!-- ws:start:WikiTextRefRule:102:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.pradu.us/old/Nov27_2008/Buzz/research/magic/Bitboards.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Magic Move-Bitboard Generation in Computer Chess&amp;lt;/a&amp;gt; (pdf) by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Pradu%20Kannan&amp;quot;&amp;gt;Pradu Kannan&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-13&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-13&quot;&gt;[13]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:102 --&gt;. Big savings in table-size - since many squares on either orthogonals or diagonals require less bits than others, especially considering the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;inner six bits&lt;/a&gt;. While center squares are more dense for rooks, it is the opposite for bishops &lt;!-- ws:start:WikiTextRefRule:106:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5441&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;List of magics for bitboard move generation&amp;lt;/a&amp;gt; thread started by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Pradu%20Kannan&amp;quot;&amp;gt;Pradu Kannan&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, Aug 23, 2006&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-14&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-14&quot;&gt;[14]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:106 --&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:197:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc38&quot;&gt;&lt;a name=&quot;Lookup Techniques-Magic Bitboards-How it works&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:197 --&gt;How it works&lt;/h3&gt;
 A magic move-bitboard generation technique consists of four key steps:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Mask the relevant occupancy bits to form a key. For example if you had a rook on a1, the relevant occupancy bits will be from a2-a7 and b1-g1.&lt;/li&gt;&lt;li&gt;Multiply the key by a &amp;quot;magic number&amp;quot; to obtain an index mapping. This magic number can be generated by brute-force trial and error quite easily although it isn&#039;t 100% certain that the magic number is the best possible (see step 3).&lt;/li&gt;&lt;li&gt;Right shift the index mapping by 64-n bits to create an index, where n is the number of bits in the index. A better magic number will have less bits required in the index.&lt;/li&gt;&lt;li&gt;Use the index to reference a preinitialized move database.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:44:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;any consecutive&amp;lt;br/&amp;gt;relevant occupancy                      combination of&amp;lt;br/&amp;gt;bishop b1, 5 bits                       the masked bits&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . .[C D E F G]&amp;lt;br/&amp;gt;. . . . . . . .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . G .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . F . .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . E . . .  *  . 1 . . . . . .  =  . .garbadge . .    &amp;amp;gt;&amp;amp;gt; (64- 5)&amp;lt;br/&amp;gt;. . . D . . . .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . C . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;any consecutive&amp;lt;br/&amp;gt;relevant occupancy                      combination of&amp;lt;br/&amp;gt;bishop d4, 9 bits                       the masked bits&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     2 4 5 B C E F G]&amp;lt;br/&amp;gt;. . . . . . G .     . . .some . . .     . . . . . . .[1&amp;lt;br/&amp;gt;. 5 . . . F . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . 4 . E . . .     . . .magic. . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .  *  . . . . . . . .  =  . .garbadge . .    &amp;amp;gt;&amp;amp;gt; (64- 9)&amp;lt;br/&amp;gt;. . C . 2 . . .     . . .bits . . .     . . . . . . . .&amp;lt;br/&amp;gt;. B . . . 1 . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;any consecutive&amp;lt;br/&amp;gt;relevant occupancy                      combination of&amp;lt;br/&amp;gt;rook d4, 10 bits                        the masked bits&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     4 5 6 B C E F G]&amp;lt;br/&amp;gt;. . . 6 . . . .     . . .some . . .     . . . . . .[1 2&amp;lt;br/&amp;gt;. . . 5 . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . 4 . . . .     . . .magic. . .     . . . . . . . .&amp;lt;br/&amp;gt;. B C . E F G .  *  . . . . . . . .  =  . .garbadge . .    &amp;amp;gt;&amp;amp;gt; (64-10)&amp;lt;br/&amp;gt;. . . 2 . . . .     . . .bits . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . 1 . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;any consecutive&amp;lt;br/&amp;gt;relevant occupancy                      combination of&amp;lt;br/&amp;gt;rook a1, 12 bits                        the masked bits&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     5 6 B C D E F G]&amp;lt;br/&amp;gt;6 . . . . . . .     . . .some . . .     . . . .[1 2 3 4&amp;lt;br/&amp;gt;5 . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;4 . . . . . . .     . . .magic. . .     . . . . . . . .&amp;lt;br/&amp;gt;3 . . . . . . .  *  . . . . . . . .  =  . .garbadge . .    &amp;amp;gt;&amp;amp;gt; (64-12)&amp;lt;br/&amp;gt;2 . . . . . . .     . . .bits . . .     . . . . . . . .&amp;lt;br/&amp;gt;1 . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. B C D E F G .     . . . . . . . .     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;any consecutive
relevant occupancy                      combination of
bishop b1, 5 bits                       the masked bits
. . . . . . . .     . . . . . . . .     . . .[C D E F G]
. . . . . . . .     . 1 . . . . . .     . . . . . . . .
. . . . . . G .     . 1 . . . . . .     . . . . . . . .
. . . . . F . .     . 1 . . . . . .     . . . . . . . .
. . . . E . . .  *  . 1 . . . . . .  =  . .garbadge . .    &amp;gt;&amp;gt; (64- 5)
. . . D . . . .     . 1 . . . . . .     . . . . . . . .
. . C . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
&amp;nbsp;
any consecutive
relevant occupancy                      combination of
bishop d4, 9 bits                       the masked bits
. . . . . . . .     . . . . . . . .     2 4 5 B C E F G]
. . . . . . G .     . . .some . . .     . . . . . . .[1
. 5 . . . F . .     . . . . . . . .     . . . . . . . .
. . 4 . E . . .     . . .magic. . .     . . . . . . . .
. . . . . . . .  *  . . . . . . . .  =  . .garbadge . .    &amp;gt;&amp;gt; (64- 9)
. . C . 2 . . .     . . .bits . . .     . . . . . . . .
. B . . . 1 . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
&amp;nbsp;
any consecutive
relevant occupancy                      combination of
rook d4, 10 bits                        the masked bits
. . . . . . . .     . . . . . . . .     4 5 6 B C E F G]
. . . 6 . . . .     . . .some . . .     . . . . . .[1 2
. . . 5 . . . .     . . . . . . . .     . . . . . . . .
. . . 4 . . . .     . . .magic. . .     . . . . . . . .
. B C . E F G .  *  . . . . . . . .  =  . .garbadge . .    &amp;gt;&amp;gt; (64-10)
. . . 2 . . . .     . . .bits . . .     . . . . . . . .
. . . 1 . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
&amp;nbsp;
any consecutive
relevant occupancy                      combination of
rook a1, 12 bits                        the masked bits
. . . . . . . .     . . . . . . . .     5 6 B C D E F G]
6 . . . . . . .     . . .some . . .     . . . .[1 2 3 4
5 . . . . . . .     . . . . . . . .     . . . . . . . .
4 . . . . . . .     . . .magic. . .     . . . . . . . .
3 . . . . . . .  *  . . . . . . . .  =  . .garbadge . .    &amp;gt;&amp;gt; (64-12)
2 . . . . . . .     . . .bits . . .     . . . . . . . .
1 . . . . . . .     . . . . . . . .     . . . . . . . .
. B C D E F G .     . . . . . . . .     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:44 --&gt;The above illustration is correct for the b1 bishop, since it has only one ray and one bit per file and works kindergarten like. In general a one to one mapping of N scattered occupied bits to N consecutive bits is not always possible due to possible overflows. A perfect mapping of N scattered bits to N consecutive bits is likely not minimal for most squares. It requires one or two gaps inside the consecutive N bits, to avoid collisions, blowing up the table size.&lt;br /&gt;
&lt;br /&gt;
But the purpose is to perfectly hash attack-sets rather than consecutive occupied bits.&lt;br /&gt;
&lt;br /&gt;
The number of distinct attack-sets is much smaller than the relevant occupancies. Thus, with the help of constructive collisions, some initial guess how to map the bits, and/or trial and error, using exactly N bits is always possible. If we try hard enough to maximize constructive collisions - even less.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:199:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc39&quot;&gt;&lt;a name=&quot;Lookup Techniques-Magic Bitboards-Perfect Hashing&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:199 --&gt;Perfect Hashing&lt;/h3&gt;
 Magic bitboards applies &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table#PerfectHashing&quot;&gt;perfect hashing&lt;/a&gt;. A &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Surjection&quot; rel=&quot;nofollow&quot;&gt;surjective function&lt;/a&gt;, to map the vector of all relevant occupancies to a range of attack-sets per square. The less bits the attack-set - the closer the blockers, the more those attack-sets are shared by occupancies with different, but redundant outer squares.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The &lt;strong&gt;cardinality&lt;/strong&gt; of all &lt;strong&gt;relevant occupancies&lt;/strong&gt; is determined by the number of bits to map, varying from five to twelve - thus, the cardinality is the power of two the number of bits, varying from 32 to 4096.&lt;/li&gt;&lt;li&gt;The &lt;strong&gt;cardinality&lt;/strong&gt; of &lt;strong&gt;distinct attack-sets&lt;/strong&gt; is determined by the product of the length of each of the max four direction rays greater than zero (or one). The rook on d4 has 3*4*3*4 = 144 distinct attack-sets, a bishop on a8 has only 7.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
The &lt;strong&gt;ratio&lt;/strong&gt; of both cardinalities, that is all &lt;strong&gt;relevant occupancies&lt;/strong&gt; versus the all &lt;strong&gt;distinct attack-sets&lt;/strong&gt; is illustrated below: As a quarter of a board - due to the symmetry, the other squares may deduced by flipping and mirroring. Noticeable is the huge 4096/49 ratio of 2^12 occupied states versus 7 times 7 attack-sets of the edge rooks - 12 bits instead of 6. Those &amp;quot;expensive&amp;quot; squares make constructive collisions very desirable. To become more &amp;quot;minimal&amp;quot; by saving an index bit - to halve down the table for one square or the other.&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th colspan=&quot;4&quot;&gt;bishop on square&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;#occs/&lt;br /&gt;
#attset&lt;br /&gt;
&lt;/th&gt;
        &lt;th colspan=&quot;4&quot;&gt;rook on square&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;A&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;B&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;C&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;D&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;A&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;B&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;C&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;D&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;8&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;64/7&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/6&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/10&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/ 12&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;8&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;4096/49&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/42&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/ 70&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/ 84&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;7&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/6&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/6&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/10&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/ 12&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;7&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/42&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/36&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/ 60&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/ 72&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;6&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/10&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/10&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;128/40&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;128/ 48&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;6&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/70&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/60&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/120&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;5&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/12&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/12&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;128/48&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;512/108&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;5&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/84&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/72&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/120&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/144&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th colspan=&quot;4&quot;&gt;bishop on square&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th colspan=&quot;4&quot;&gt;rook on square&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;A&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;B&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;C&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;D&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;A&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;B&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;C&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;D&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;8&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;9.14&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;5.33&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;8&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;83.59&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;48.76&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;29.26&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;24.38&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;7&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;5.33&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;5.33&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;7&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;48.76&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;28.44&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;17.07&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;14.22&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;6&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;6&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;29.26&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;17.07&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;10.24&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;8.53&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;5&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;4.74&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;5&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;24.38&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;14.22&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;8.53&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;7.11&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;br /&gt;
The idea to implement minimal perfect hashing by an additional 16-bit indirection turned out to be slower.&lt;br /&gt;
&lt;br /&gt;
Recent table sizes were about &lt;strong&gt;38 KByte&lt;/strong&gt; for the bishop attacks, but still about &lt;strong&gt;800 KByte&lt;/strong&gt; for rook attacks. That sounds huge, considering L1 and L2 (L3) cache-sizes and number of cachelines and pages needed - we likely fetch distinct cachelines for each different square or occupancy. On the other hand caches and pages become larger in future processors. And occupancy and squares of the lookups don&#039;t change that randomly inside a search that we can still expect a lot of L1-hits. Unfortunately changes in occupancy outside the blockers and therefor not affecting the attack-set will introduce some more cache misses.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:201:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc40&quot;&gt;&lt;a name=&quot;Lookup Techniques-Magic Bitboards-Sample Code&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:201 --&gt;Sample Code&lt;/h3&gt;
 Anyway, register usage and code size are important issues as well - and here &lt;strong&gt;magic bitboards&lt;/strong&gt; are unbeatable - specially bishopAttacks, with respect to the relative small table.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:45:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 attacks_table[...]; // ~840K Byte all rook and bishop attacks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct SMagic {&amp;lt;br/&amp;gt;   U64* ptr;  // pointer to the attack-table for one particular square&amp;lt;br/&amp;gt;   U64 mask;  // to mask of both lines&amp;lt;br/&amp;gt;   U64 magic; // magic 64-bit factor&amp;lt;br/&amp;gt;   int shift; // shift right &amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;SMagic mBishopTbl[64];&amp;lt;br/&amp;gt;SMagic mRookTbl[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mBishopTbl[sq].ptr;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mBishopTbl[sq].mask;&amp;lt;br/&amp;gt;   occ      *= mBishopTbl[sq].magic;&amp;lt;br/&amp;gt;   occ     &amp;amp;gt;&amp;amp;gt;= mBishopTbl[sq].shift;&amp;lt;br/&amp;gt;   return aptr[occ];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mRookTbl[sq].ptr;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mRookTbl[sq].mask;&amp;lt;br/&amp;gt;   occ      *= mRookTbl[sq].magic;&amp;lt;br/&amp;gt;   occ     &amp;amp;gt;&amp;amp;gt;= mRookTbl[sq].shift;&amp;lt;br/&amp;gt;   return aptr[occ];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 attacks_table&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;...&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ~840K Byte all rook and bishop attacks&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; ptr&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// pointer to the attack-table for one particular square&lt;/span&gt;
   U64 mask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// to mask of both lines&lt;/span&gt;
   U64 magic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// magic 64-bit factor&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; shift&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// shift right &lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
SMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
SMagic mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ     &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ     &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:45 --&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:203:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc41&quot;&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:203 --&gt;Summary&lt;/h1&gt;
 The bitboard method for holding a board game appears to have been invented in the mid 1950&#039;s, by &lt;a class=&quot;wiki_link&quot; href=&quot;/Arthur%20Samuel&quot;&gt;Arthur Samuel&lt;/a&gt; and was used in his checkers program. In computer chess bitboards were first described by &lt;a class=&quot;wiki_link&quot; href=&quot;/Georgy%20Adelson-Velsky&quot;&gt;Georgy Adelson-Velsky&lt;/a&gt; et al. in 1967 &lt;!-- ws:start:WikiTextRefRule:110:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://groups.google.com/group/rec.games.chess/browse_frm/thread/0e3a93f45ff07d31#&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Early Reference on Bit-Boards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Tony%20Warnock&amp;quot;&amp;gt;Tony Warnock&amp;lt;/a&amp;gt;, October 29, 1994 &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://groups.google.com/group/rec.games.chess/topics&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;rec.games.chess archive&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-15&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-15&quot;&gt;[15]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:110 --&gt;, reprinted 1970 &lt;!-- ws:start:WikiTextRefRule:120:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Georgy%20Adelson-Velsky&amp;quot;&amp;gt;Georgy Adelson-Velsky&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Vladimir%20Arlazarov&amp;quot;&amp;gt;Vladimir Arlazarov&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Alexander%20Bitman&amp;quot;&amp;gt;Alexander Bitman&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Alexander%20Zhivotovsky&amp;quot;&amp;gt;Alexander Zhivotovsky&amp;lt;/a&amp;gt; and &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Anatoly%20Uskov&amp;quot;&amp;gt;Anatoly Uskov&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1970&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;Programming a Computer to Play Chess&amp;lt;/em&amp;gt;. Russian Mathematical Surveys, Vol. 25, pp. 221-262&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-16&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-16&quot;&gt;[16]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:120 --&gt;. Bitboards were used both in &lt;a class=&quot;wiki_link&quot; href=&quot;/Kaissa&quot;&gt;Kaissa&lt;/a&gt; and independently in &lt;a class=&quot;wiki_link&quot; href=&quot;/Chess%20%28Program%29&quot;&gt;Chess&lt;/a&gt;. The invention and publication of &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Peter%20Gillgasch&quot;&gt;Peter Gillgasch&lt;/a&gt; with &lt;a class=&quot;wiki_link&quot; href=&quot;/Ernst%20A.%20Heinz&quot;&gt;Ernst A. Heinz&lt;/a&gt; in the 90s was another milestone in the history of bitboards. While rotated bitboards was the mainstream in bitboard chess programs, &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt; become more populated nowadays. Finally, &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&#039;s&lt;/a&gt; innovations, too expensive with 32-bit &lt;a class=&quot;wiki_link&quot; href=&quot;/x86&quot;&gt;x86&lt;/a&gt; architectures, should be revisited with &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/SIMD%20and%20SWAR%20Techniques&quot;&gt;SIMD instructions&lt;/a&gt; in mind.&lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:205:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc42&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:205 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:1145:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.math.tu-dresden.de/num/chess2008/abstracts.pdf&quot; rel=&quot;nofollow&quot;&gt;Workshop Chess and Mathematics&lt;/a&gt; (pdf) agenda and abstracts&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Charles%20Leiserson&quot;&gt;Charles E. Leiserson&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Harald%20Prokop&quot;&gt;Harald Prokop&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Keith%20H.%20Randall&quot;&gt;Keith H. Randall&lt;/a&gt; (&lt;strong&gt;1998&lt;/strong&gt;) &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://supertech.csail.mit.edu/papers/debruijn.pdf&quot; rel=&quot;nofollow&quot;&gt;Using de Bruijn Sequences to Index a 1 in a Computer Word&lt;/a&gt; (pdf)&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/d5dbf08c66e83517#&quot; rel=&quot;nofollow&quot;&gt;bitboard 2^i mod 67 is unique&lt;/a&gt; post by &lt;a class=&quot;wiki_link&quot; href=&quot;/Stefan%20Plenkner&quot;&gt;Stefan Plenkner&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rec.games.chess.computer&lt;/a&gt;, August 6, 1996&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/871851f83e2c429f#&quot; rel=&quot;nofollow&quot;&gt;bitboard 2^i mod 67 is unique&lt;/a&gt; post by &lt;a class=&quot;wiki_link&quot; href=&quot;/Jo%C3%ABl%20Rivat&quot;&gt;Joël Rivat&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rec.games.chess.computer&lt;/a&gt;, September 2, 1996&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/9658009e315021fe#&quot; rel=&quot;nofollow&quot;&gt;bitboard 2^i mod 67 is unique&lt;/a&gt; post by &lt;a class=&quot;wiki_link&quot; href=&quot;/Stefan%20Plenkner&quot;&gt;Stefan Plenkner&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rec.games.chess.computer&lt;/a&gt;, August 7, 1996&lt;/li&gt;
&lt;li id=&quot;cite_note-6&quot;&gt;&lt;a href=&quot;#cite_ref-6&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=252289&quot; rel=&quot;nofollow&quot;&gt;Re: flood fill attack bitboards&lt;/a&gt; answer by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;CCC&lt;/a&gt;, September 15, 2002&lt;/li&gt;
&lt;li id=&quot;cite_note-7&quot;&gt;&lt;a href=&quot;#cite_ref-7&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.aoki.ecei.tohoku.ac.jp/arith/mg/algorithm.html#fsa_pfx&quot; rel=&quot;nofollow&quot;&gt;Hardware algorithms for arithmetic modules&lt;/a&gt; from the ARITH research group, Aoki lab., Tohoku University&lt;/li&gt;
&lt;li id=&quot;cite_note-8&quot;&gt;&lt;a href=&quot;#cite_ref-8&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; (&lt;strong&gt;1999&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.craftychess.com/hyatt/bitmaps.html&quot; rel=&quot;nofollow&quot;&gt;Rotated Bitmaps, a New Twist on an Old Idea&lt;/a&gt;&lt;/em&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal&quot;&gt;ICCA Journal&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.cs.unimaas.nl/icga/journal/contents/content22-4.htm&quot; rel=&quot;nofollow&quot;&gt;Vol. 22, No. 4&lt;/a&gt;, pp. 213–222. &lt;/li&gt;
&lt;li id=&quot;cite_note-9&quot;&gt;&lt;a href=&quot;#cite_ref-9&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://people.csail.mit.edu/heinz/dt/node8.html&quot; rel=&quot;nofollow&quot;&gt;Rotated Bitboards by Ernst A. Heinz&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-10&quot;&gt;&lt;a href=&quot;#cite_ref-10&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Trevor%20Fenner&quot;&gt;Trevor Fenner&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Mark%20Levene&quot;&gt;Mark Levene&lt;/a&gt; (&lt;strong&gt;2008&lt;/strong&gt;). &lt;em&gt;Move Generation with Perfect Hashing Functions.&lt;/em&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal&quot;&gt;ICGA Journal&lt;/a&gt;, Vol. 31, No. 1, pp. 3-12. ISSN 1389-6911.&lt;/li&gt;
&lt;li id=&quot;cite_note-11&quot;&gt;&lt;a href=&quot;#cite_ref-11&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=20913&quot; rel=&quot;nofollow&quot;&gt;Nice Math - Strange Conclusions&lt;/a&gt; post by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;CCC&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-12&quot;&gt;&lt;a href=&quot;#cite_ref-12&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Lasse%20Hansen&quot;&gt;Lasse Hansen&#039;s&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5015&quot; rel=&quot;nofollow&quot;&gt;Initial idea&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, June 14, 2006&lt;/li&gt;
&lt;li id=&quot;cite_note-13&quot;&gt;&lt;a href=&quot;#cite_ref-13&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.pradu.us/old/Nov27_2008/Buzz/research/magic/Bitboards.pdf&quot; rel=&quot;nofollow&quot;&gt;Magic Move-Bitboard Generation in Computer Chess&lt;/a&gt; (pdf) by &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-14&quot;&gt;&lt;a href=&quot;#cite_ref-14&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5441&quot; rel=&quot;nofollow&quot;&gt;List of magics for bitboard move generation&lt;/a&gt; thread started by &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, Aug 23, 2006&lt;/li&gt;
&lt;li id=&quot;cite_note-15&quot;&gt;&lt;a href=&quot;#cite_ref-15&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess/browse_frm/thread/0e3a93f45ff07d31#&quot; rel=&quot;nofollow&quot;&gt;Early Reference on Bit-Boards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Tony%20Warnock&quot;&gt;Tony Warnock&lt;/a&gt;, October 29, 1994 &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess/topics&quot; rel=&quot;nofollow&quot;&gt;rec.games.chess archive&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-16&quot;&gt;&lt;a href=&quot;#cite_ref-16&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Georgy%20Adelson-Velsky&quot;&gt;Georgy Adelson-Velsky&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Vladimir%20Arlazarov&quot;&gt;Vladimir Arlazarov&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Alexander%20Bitman&quot;&gt;Alexander Bitman&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Alexander%20Zhivotovsky&quot;&gt;Alexander Zhivotovsky&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Anatoly%20Uskov&quot;&gt;Anatoly Uskov&lt;/a&gt; (&lt;strong&gt;1970&lt;/strong&gt;). &lt;em&gt;Programming a Computer to Play Chess&lt;/em&gt;. Russian Mathematical Surveys, Vol. 25, pp. 221-262&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:1145 --&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Workshop%20Chess%20and%20Mathematics&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Exploding Bitboards</title>
      <link>https://chessprogramming.wikispaces.com/Exploding+Bitboards</link>
      <dc:creator>PsyMar</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Exploding+Bitboards</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Exploding+Bitboards</comments>
      <pubDate>Mon, 09 Mar 2015 12:29:50 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:28:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:28 --&gt;&lt;!-- ws:start:WikiTextTocRule:29: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Bishops&quot;&gt;Bishops&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:29 --&gt;&lt;!-- ws:start:WikiTextTocRule:30: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Rooks&quot;&gt;Rooks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:30 --&gt;&lt;!-- ws:start:WikiTextTocRule:31: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Results&quot;&gt;Results&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:31 --&gt;&lt;!-- ws:start:WikiTextTocRule:32: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:32 --&gt;&lt;!-- ws:start:WikiTextTocRule:33: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:33 --&gt;&lt;!-- ws:start:WikiTextTocRule:34: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:34 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Exploding Bitboards&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The expanding or &lt;strong&gt;exploding bitboards&lt;/strong&gt; were created by &lt;a class=&quot;wiki_link&quot; href=&quot;/Harald%20L%C3%BC%C3%9Fen&quot;&gt;Harald Lüßen&lt;/a&gt; with some help from other people in &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:16:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;amp;t=4523&amp;amp;amp;start=80&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Compact Bitboard Attacks&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Harald%20L%C3%BC%C3%9Fen&amp;quot;&amp;gt;Harald Lüßen&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, September 13, 2006&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:16 --&gt; . The idea is to generate the attacks of a sliding piece from its square outside on all its rays in parallel like the waves of a stone thrown into water. This is done in some steps with multiplications and shifts like in the &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;kindergarten bitboards&lt;/a&gt;. At each step or distance from the original square the rays can be expanded or stopped by other pieces from an occupied bitboard. There are some nasty overflow problems at the border of the board that must be solved. This approach is slower than other techniques. The code below is taken from the chess engine &lt;a class=&quot;wiki_link&quot; href=&quot;/Elephant&quot;&gt;Elephant&lt;/a&gt; which is known for some bitboard comparisons but not for playing strength.&lt;br /&gt;
&lt;br /&gt;
In the example this &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations&quot;&gt;big-endian file-mapping&lt;/a&gt; is used:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;    directions and shifts&amp;lt;br/&amp;gt;    +&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;br/&amp;gt;    |&amp;amp;lt;&amp;amp;lt;= 9|&amp;amp;lt;&amp;amp;lt;= 8|&amp;amp;lt;&amp;amp;lt;= 7|&amp;lt;br/&amp;gt;    +&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;br/&amp;gt;    |&amp;amp;lt;&amp;amp;lt;= 1|     |&amp;amp;gt;&amp;amp;gt;= 1|&amp;lt;br/&amp;gt;    +&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;br/&amp;gt;    |&amp;amp;gt;&amp;amp;gt;= 7|&amp;amp;gt;&amp;amp;gt;= 8|&amp;amp;gt;&amp;amp;gt;= 9|&amp;lt;br/&amp;gt;    +&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;    +&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;br/&amp;gt;    | 63 62 61 60 59 58 57 56 | 8&amp;lt;br/&amp;gt;    | 55 54 53 52 51 50 49 48 | 7&amp;lt;br/&amp;gt;    | 47 46 45 44 43 42 41 40 | 6&amp;lt;br/&amp;gt;    | 39 38 37 36 35 35 33 32 | 5&amp;lt;br/&amp;gt;    | 31 30 29 28 27 26 25 24 | 4&amp;lt;br/&amp;gt;    | 23 22 21 20 19 18 17 16 | 3&amp;lt;br/&amp;gt;    | 15 14 13 12 11 10  9  8 | 2&amp;lt;br/&amp;gt;    |  7  6  5  4  3  2  1  0 | 1&amp;lt;br/&amp;gt;    +&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;&amp;amp;#45;-+&amp;lt;br/&amp;gt;       a  b  c  d  e  f  g  h&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;    directions and shifts
    +-----+-----+-----+
    |&amp;lt;&amp;lt;= 9|&amp;lt;&amp;lt;= 8|&amp;lt;&amp;lt;= 7|
    +-----+-----+-----+
    |&amp;lt;&amp;lt;= 1|     |&amp;gt;&amp;gt;= 1|
    +-----+-----+-----+
    |&amp;gt;&amp;gt;= 7|&amp;gt;&amp;gt;= 8|&amp;gt;&amp;gt;= 9|
    +-----+-----+-----+
&amp;nbsp;
    +-------------------------+
    | 63 62 61 60 59 58 57 56 | 8
    | 55 54 53 52 51 50 49 48 | 7
    | 47 46 45 44 43 42 41 40 | 6
    | 39 38 37 36 35 35 33 32 | 5
    | 31 30 29 28 27 26 25 24 | 4
    | 23 22 21 20 19 18 17 16 | 3
    | 15 14 13 12 11 10  9  8 | 2
    |  7  6  5  4  3  2  1  0 | 1
    +-------------------------+
       a  b  c  d  e  f  g  h
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;br /&gt;
The general trick of chasing and pushing around the bits on the board is this: First shift down and sideways far enough to get a good start. Then multiply with 2 to shift one square to the side (left in this mapping) and multiply with 2^8 = 0x100 to move the bit upwards. Use any power of 2 that helps you. Build the sum of all the multiplication factors of all moves for all bits and multiply with that number. There will probably be more bits in the result than there should be because the multiplication works on all original bits. Use a mask to get rid of all the bad bits.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:18:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Bishops&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:18 --&gt;Bishops&lt;/h1&gt;
 For each square there is an ignition of the explosion.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;First expanding step (explosion) for a bishop&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . 1 . 1 . . .&amp;lt;br/&amp;gt; . . .sq . . . .&amp;lt;br/&amp;gt; . . 1 . 1 . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard initB[64];&amp;lt;br/&amp;gt;void makeInitB()&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    for ( int sq = 0; sq &amp;amp;lt; 64; ++sq )&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;        Bitboard bb = C64(1) &amp;amp;lt;&amp;amp;lt; sq;&amp;lt;br/&amp;gt;        initB[sq]  = (bb &amp;amp;gt;&amp;amp;gt; 9) &amp;amp;amp; C64(0x7f7f7f7f7f7f7f7f);&amp;lt;br/&amp;gt;        initB[sq] |= (bb &amp;amp;gt;&amp;amp;gt; 7) &amp;amp;amp; C64(0xfefefefefefefefe);&amp;lt;br/&amp;gt;        initB[sq] |= (bb &amp;amp;lt;&amp;amp;lt; 9) &amp;amp;amp; C64(0xfefefefefefefefe);&amp;lt;br/&amp;gt;        initB[sq] |= (bb &amp;amp;lt;&amp;amp;lt; 7) &amp;amp;amp; C64(0x7f7f7f7f7f7f7f7f);&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/*
First expanding step (explosion) for a bishop
 . . . . . . . .
 . . . . . . . .
 . . . . . . . .
 . . 1 . 1 . . .
 . . .sq . . . .
 . . 1 . 1 . . .
 . . . . . . . .
 . . . . . . . .
*/&lt;/span&gt;
Bitboard initB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; makeInitB&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;sq &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        Bitboard bb &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; sq&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        initB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        initB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        initB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        initB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;The explosion is only allowed along the rays.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;Mask for bishop attack rays&amp;lt;br/&amp;gt; . . . . . . . 1&amp;lt;br/&amp;gt; 1 . . . . . 1 .&amp;lt;br/&amp;gt; . 1 . . . 1 . .&amp;lt;br/&amp;gt; . . 1 . 1 . . .&amp;lt;br/&amp;gt; . . .sq . . . .&amp;lt;br/&amp;gt; . . 1 . 1 . . .&amp;lt;br/&amp;gt; . 1 . . . 1 . .&amp;lt;br/&amp;gt; 1 . . . . . 1 .&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard maskB[64];&amp;lt;br/&amp;gt;void makeMaskB()&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    int sq;&amp;lt;br/&amp;gt;    for ( sq = 0; sq &amp;amp;lt; 64; ++sq )&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;        maskB[sq] = 0;&amp;lt;br/&amp;gt;        int i;&amp;lt;br/&amp;gt;        for ( i = sq - 9; i &amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; i % 8 != 7; i -= 9 )&amp;lt;br/&amp;gt;            maskB[sq] |= C64(1) &amp;amp;lt;&amp;amp;lt; i;&amp;lt;br/&amp;gt;        for ( i = sq - 7; i &amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; i % 8 != 0; i -= 7 )&amp;lt;br/&amp;gt;            maskB[sq] |= C64(1) &amp;amp;lt;&amp;amp;lt; i;&amp;lt;br/&amp;gt;        for ( i = sq + 9; i &amp;amp;lt; 64 &amp;amp;amp;&amp;amp;amp; i % 8 != 0; i += 9 )&amp;lt;br/&amp;gt;            maskB[sq] |= C64(1) &amp;amp;lt;&amp;amp;lt; i;&amp;lt;br/&amp;gt;        for ( i = sq + 7; i &amp;amp;lt; 64 &amp;amp;amp;&amp;amp;amp; i % 8 != 7; i += 7 )&amp;lt;br/&amp;gt;            maskB[sq] |= C64(1) &amp;amp;lt;&amp;amp;lt; i;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/*
Mask for bishop attack rays
 . . . . . . . 1
 1 . . . . . 1 .
 . 1 . . . 1 . .
 . . 1 . 1 . . .
 . . .sq . . . .
 . . 1 . 1 . . .
 . 1 . . . 1 . .
 1 . . . . . 1 .
*/&lt;/span&gt;
Bitboard maskB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; makeMaskB&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;sq &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        maskB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            maskB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            maskB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            maskB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            maskB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;For each square there is a maximum number of steps to take.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;Number of expanding steps (explosions) for a bishop&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;const int repsB[64] =&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    6, 5, 4, 3, 3, 4, 5, 6,&amp;lt;br/&amp;gt;    5, 5, 4, 3, 3, 4, 5, 5,&amp;lt;br/&amp;gt;    4, 4, 4, 3, 3, 4, 4, 4,&amp;lt;br/&amp;gt;    3, 3, 3, 3, 3, 3, 3, 3,&amp;lt;br/&amp;gt;    3, 3, 3, 3, 3, 3, 3, 3,&amp;lt;br/&amp;gt;    4, 4, 4, 3, 3, 4, 4, 4,&amp;lt;br/&amp;gt;    5, 5, 4, 3, 3, 4, 5, 5,&amp;lt;br/&amp;gt;    6, 5, 4, 3, 3, 4, 5, 6,&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;/*
Number of expanding steps (explosions) for a bishop
*/
const int repsB[64] =
{
    6, 5, 4, 3, 3, 4, 5, 6,
    5, 5, 4, 3, 3, 4, 5, 5,
    4, 4, 4, 3, 3, 4, 4, 4,
    3, 3, 3, 3, 3, 3, 3, 3,
    3, 3, 3, 3, 3, 3, 3, 3,
    4, 4, 4, 3, 3, 4, 4, 4,
    5, 5, 4, 3, 3, 4, 5, 5,
    6, 5, 4, 3, 3, 4, 5, 6,
};
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;This does one step of the explosion.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;= init               &amp;amp;gt;&amp;amp;gt;= 9               *= 0x5005          &amp;amp;amp;= mask            at |= bb&amp;lt;br/&amp;gt; . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .     . . . . . . . .     . 1 1 . . 1 . .    . 1 . . . 1 . .    . 1 . . . 1 . .&amp;lt;br/&amp;gt; . . 1 . 1 . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . 1 . 1 . . .&amp;lt;br/&amp;gt; . . . s . . . .     . . . 1 . 1 . .     1 1 . . 1 . . .    . . . s . . . .    . . . s . . . .&amp;lt;br/&amp;gt; . . 1 . 1 . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . 1 . 1 . . .&amp;lt;br/&amp;gt; . . . . . . . .     . . . 1 . 1 . .     . 1 1 . . 1 . .    . 1 . . . 1 . .    . 1 . . . 1 . .&amp;lt;br/&amp;gt; . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard bishopAttacks( int sq, const Bitboard &amp;amp;amp;free )&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    Bitboard msk = maskB[sq];&amp;lt;br/&amp;gt;    Bitboard bb  = initB[sq];&amp;lt;br/&amp;gt;    Bitboard at  = bb;&amp;lt;br/&amp;gt;    bb &amp;amp;amp;= free;&amp;lt;br/&amp;gt;    switch ( repsB[sq] )&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;      case 6:&amp;lt;br/&amp;gt;        bb &amp;amp;gt;&amp;amp;gt;= 9; bb *= 0x00050005; bb &amp;amp;amp;= msk; at |= bb; bb &amp;amp;amp;= free;&amp;lt;br/&amp;gt;      case 5:&amp;lt;br/&amp;gt;        bb &amp;amp;gt;&amp;amp;gt;= 9; bb *= 0x00050005; bb &amp;amp;amp;= msk; at |= bb; bb &amp;amp;amp;= free;&amp;lt;br/&amp;gt;      case 4:&amp;lt;br/&amp;gt;        bb &amp;amp;gt;&amp;amp;gt;= 9; bb *= 0x00050005; bb &amp;amp;amp;= msk; at |= bb; bb &amp;amp;amp;= free;&amp;lt;br/&amp;gt;      case 3:&amp;lt;br/&amp;gt;        bb &amp;amp;gt;&amp;amp;gt;= 9; bb *= 0x00050005; bb &amp;amp;amp;= msk; at |= bb; bb &amp;amp;amp;= free;&amp;lt;br/&amp;gt;        bb &amp;amp;gt;&amp;amp;gt;= 9; bb *= 0x00050005; bb &amp;amp;amp;= msk; at |= bb; bb &amp;amp;amp;= free;&amp;lt;br/&amp;gt;        bb &amp;amp;gt;&amp;amp;gt;= 9; bb *= 0x00050005; bb &amp;amp;amp;= msk; at |= bb;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;    return at;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/*
= init               &amp;gt;&amp;gt;= 9               *= 0x5005          &amp;amp;= mask            at |= bb
 . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .
 . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .
 . . . . . . . .     . . . . . . . .     . 1 1 . . 1 . .    . 1 . . . 1 . .    . 1 . . . 1 . .
 . . 1 . 1 . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . 1 . 1 . . .
 . . . s . . . .     . . . 1 . 1 . .     1 1 . . 1 . . .    . . . s . . . .    . . . s . . . .
 . . 1 . 1 . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . 1 . 1 . . .
 . . . . . . . .     . . . 1 . 1 . .     . 1 1 . . 1 . .    . 1 . . . 1 . .    . 1 . . . 1 . .
 . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .
*/&lt;/span&gt;
Bitboard bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq, &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; Bitboard &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    Bitboard msk &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; maskB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    Bitboard bb  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; initB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    Bitboard at  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; repsB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00050005&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; msk&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00050005&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; msk&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00050005&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; msk&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00050005&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; msk&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00050005&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; msk&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00050005&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; msk&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; at&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;There are some possible optimisations when the repsB[] array is modified in the corners during&lt;br /&gt;
the game or search. Some numbers 7, 8, 9 combined with additional switch cases can work&lt;br /&gt;
as a shortcut for bishops in the corners behind pawns.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:20:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Rooks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:20 --&gt;Rooks&lt;/h1&gt;
 For each square there is an ignition of the explosion.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;First expanding step (explosion) for a rook&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; . . 1sq 1 . . .&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard initR[64];&amp;lt;br/&amp;gt;void makeInitR()&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    for ( int sq = 0; sq &amp;amp;lt; 64; ++sq )&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;        Bitboard bb = C64(1) &amp;amp;lt;&amp;amp;lt; sq;&amp;lt;br/&amp;gt;        initR[sq]  = (bb &amp;amp;gt;&amp;amp;gt; 8);&amp;lt;br/&amp;gt;        initR[sq] |= (bb &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; C64(0x7f7f7f7f7f7f7f7f);&amp;lt;br/&amp;gt;        initR[sq] |= (bb &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; C64(0xfefefefefefefefe);&amp;lt;br/&amp;gt;        initR[sq] |= (bb &amp;amp;lt;&amp;amp;lt; 8);&amp;lt;br/&amp;gt;        //logf &amp;amp;lt;&amp;amp;lt; &amp;amp;quot;initR[sq] &amp;amp;quot; &amp;amp;lt;&amp;amp;lt; sq &amp;amp;lt;&amp;amp;lt; endl;&amp;lt;br/&amp;gt;        //logf &amp;amp;lt;&amp;amp;lt; initR[sq].txt8lines() &amp;amp;lt;&amp;amp;lt; endl;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/*
First expanding step (explosion) for a rook
 . . . . . . . .
 . . . . . . . .
 . . . . . . . .
 . . . 1 . . . .
 . . 1sq 1 . . .
 . . . 1 . . . .
 . . . . . . . .
 . . . . . . . .
*/&lt;/span&gt;
Bitboard initR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; makeInitR&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;sq &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        Bitboard bb &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; sq&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        initR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        initR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        initR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        initR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;co1&quot;&gt;//logf &amp;lt;&amp;lt; &amp;quot;initR[sq] &amp;quot; &amp;lt;&amp;lt; sq &amp;lt;&amp;lt; endl;&lt;/span&gt;
        &lt;span class=&quot;co1&quot;&gt;//logf &amp;lt;&amp;lt; initR[sq].txt8lines() &amp;lt;&amp;lt; endl;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;The explosion is only allowed along the rays.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;Mask for rook attack rays&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; 1 1 1sq 1 1 1 1&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt; . . . 1 . . . .&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard maskR[64];&amp;lt;br/&amp;gt;void makeMaskR()&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    int sq;&amp;lt;br/&amp;gt;    for ( sq = 0; sq &amp;amp;lt; 64; ++sq )&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;        maskR[sq] = 0;&amp;lt;br/&amp;gt;        int i;&amp;lt;br/&amp;gt;        for ( i = sq - 8; i &amp;amp;gt;= 0; i -= 8 )&amp;lt;br/&amp;gt;            maskR[sq] |= C64(1) &amp;amp;lt;&amp;amp;lt; i;&amp;lt;br/&amp;gt;        for ( i = sq - 1; i &amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; (i &amp;amp;amp; 7) != 7; &amp;amp;#45;-i )&amp;lt;br/&amp;gt;            maskR[sq] |= C64(1) &amp;amp;lt;&amp;amp;lt; i;&amp;lt;br/&amp;gt;        for ( i = sq + 1; i &amp;amp;lt; 64 &amp;amp;amp;&amp;amp;amp; (i &amp;amp;amp; 7) != 0; ++i )&amp;lt;br/&amp;gt;            maskR[sq] |= C64(1) &amp;amp;lt;&amp;amp;lt; i;&amp;lt;br/&amp;gt;        for ( i = sq + 8; i &amp;amp;lt; 64; i += 8 )&amp;lt;br/&amp;gt;            maskR[sq] |= C64(1) &amp;amp;lt;&amp;amp;lt; i;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/*
Mask for rook attack rays
 . . . 1 . . . .
 . . . 1 . . . .
 . . . 1 . . . .
 . . . 1 . . . .
 1 1 1sq 1 1 1 1
 . . . 1 . . . .
 . . . 1 . . . .
 . . . 1 . . . .
*/&lt;/span&gt;
Bitboard maskR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; makeMaskR&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;sq &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        maskR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            maskR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;i &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;--&lt;/span&gt;i &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            maskR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;i &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;i &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            maskR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            maskR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; i&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;For each square there is a maximum number of steps to take. The number 8 is just a variant of the 7th step.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/**&amp;lt;br/&amp;gt;Number of expanding steps (explosions) for a rook&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;const int repsR[64] =&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    7, 6, 6, 6, 6, 6, 6, 8,&amp;lt;br/&amp;gt;    7, 5, 5, 5, 5, 5, 5, 8,&amp;lt;br/&amp;gt;    7, 5, 4, 4, 4, 4, 5, 8,&amp;lt;br/&amp;gt;    7, 5, 4, 3, 3, 4, 5, 8,&amp;lt;br/&amp;gt;    7, 5, 4, 3, 3, 4, 5, 8,&amp;lt;br/&amp;gt;    7, 5, 4, 4, 4, 4, 5, 8,&amp;lt;br/&amp;gt;    7, 5, 5, 5, 5, 5, 5, 8,&amp;lt;br/&amp;gt;    7, 6, 6, 6, 6, 6, 6, 8,&amp;lt;br/&amp;gt;};&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/**
Number of expanding steps (explosions) for a rook
*/&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; repsR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
    &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;This does one step of the explosion.&lt;br /&gt;
We have a lot of work to avoid overflows, wrap around the unwanted bits.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;= init               &amp;amp;gt;&amp;amp;gt;= 8               *= 0x10281         &amp;amp;amp;= mask            at |= bb&amp;lt;br/&amp;gt; . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .     . . . . . . . .     . . . 1 . . . .    . . . 1 . . . .    . . . 1 . . . .&amp;lt;br/&amp;gt; . . . 1 . . . .     . . . . . . . .     . . 1 . 1 . . .    . . . . . . . .    . . . 1 . . . .&amp;lt;br/&amp;gt; . . 1 s 1 . . .     . . . 1 . . . .     . 1 . 1 . 1 . .    . 1 . s . 1 . .    . 1 1 s 1 1 . .&amp;lt;br/&amp;gt; . . . 1 . . . .     . . 1 . 1 . . .     . . 1 . 1 . . .    . . . . . . . .    . . . 1 . . . .&amp;lt;br/&amp;gt; . . . . . . . .     . . . 1 . . . .     . . . 1 . . . .    . . . 1 . . . .    . . . 1 . . . .&amp;lt;br/&amp;gt; . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .&amp;lt;br/&amp;gt;                                       and nasty overflows&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard rookAttacks( int sq, const Bitboard &amp;amp;amp;free )&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    Bitboard msk = maskR[sq];   // The mask kills scattered bits&amp;lt;br/&amp;gt;    Bitboard bb  = initR[sq];   // This drives the expansion/explosion. Here is the start.&amp;lt;br/&amp;gt;    Bitboard at  = bb;          // Collecting the resulting attacks&amp;lt;br/&amp;gt;    Bitboard cl  = at;          // Clears some intermediate overflows&amp;lt;br/&amp;gt;    Bitboard ov;                // A nasty overflow bit when 4 directions in first step are possible.&amp;lt;br/&amp;gt;                                // Not nessessary on left side of board for repsR[sq] = 4 or 5.&amp;lt;br/&amp;gt;                                // Invent new numbers?&amp;lt;br/&amp;gt;    // Perhaps it would be easier and faster to use rankR[][] on all ranks.&amp;lt;br/&amp;gt;    // But I like the &#039;explosive&#039; algorithm. And I want to show that it works.&amp;lt;br/&amp;gt;int repsLeft = 0; // will be overwritten&amp;lt;br/&amp;gt;    bb &amp;amp;amp;= free;&amp;lt;br/&amp;gt;    bb &amp;amp;gt;&amp;amp;gt;= 8;&amp;lt;br/&amp;gt;    switch ( repsR[sq] )&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;      case 8:&amp;lt;br/&amp;gt;        bb *= 0x00010081;&amp;lt;br/&amp;gt;        repsLeft = 5;&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 7:&amp;lt;br/&amp;gt;        bb *= 0x00010201;&amp;lt;br/&amp;gt;        repsLeft = 5;&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 6:&amp;lt;br/&amp;gt;        bb *= 0x00010281;&amp;lt;br/&amp;gt;        bb &amp;amp;amp;= ~(C64(1) &amp;amp;lt;&amp;amp;lt; (sq - 6));      // Clears for b-squares a nasty overflow from south-west-first-step to h file&amp;lt;br/&amp;gt;        repsLeft = 5;&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 5:&amp;lt;br/&amp;gt;        bb *= 0x00010281;&amp;lt;br/&amp;gt;        ov = (C64(1) &amp;amp;lt;&amp;amp;lt; (sq + 3));&amp;lt;br/&amp;gt;        bb |= (bb &amp;amp;amp; ov) &amp;amp;gt;&amp;amp;gt; 1;&amp;lt;br/&amp;gt;        bb &amp;amp;amp;= ~ov;&amp;lt;br/&amp;gt;        bb &amp;amp;amp;= ~(C64(1) &amp;amp;lt;&amp;amp;lt; (sq - 6));      // Clears for b-squares a nasty overflow from south-west-first-step to h file&amp;lt;br/&amp;gt;        repsLeft = 4;&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 4:&amp;lt;br/&amp;gt;        bb *= 0x00010281;&amp;lt;br/&amp;gt;        ov = (C64(1) &amp;amp;lt;&amp;amp;lt; (sq + 3));&amp;lt;br/&amp;gt;        bb |= (bb &amp;amp;amp; ov) &amp;amp;gt;&amp;amp;gt; 1;&amp;lt;br/&amp;gt;        bb &amp;amp;amp;= ~ov;&amp;lt;br/&amp;gt;        repsLeft = 3;&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 3:&amp;lt;br/&amp;gt;        bb *= 0x00010281;&amp;lt;br/&amp;gt;        ov = (C64(1) &amp;amp;lt;&amp;amp;lt; (sq + 3));&amp;lt;br/&amp;gt;        bb |= (bb &amp;amp;amp; ov) &amp;amp;gt;&amp;amp;gt; 1;&amp;lt;br/&amp;gt;        bb &amp;amp;amp;= ~ov;&amp;lt;br/&amp;gt;        repsLeft = 2;&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      }&amp;lt;br/&amp;gt;      default:&amp;lt;br/&amp;gt;      /* reaching here is an error */&amp;lt;br/&amp;gt;      break;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;    bb &amp;amp;amp;= msk; at |= bb;&amp;lt;br/&amp;gt;    while(repsLeft&amp;amp;#45;- &amp;amp;gt; 0)&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;        bb &amp;amp;amp;= free; bb &amp;amp;amp;= ~cl;&amp;lt;br/&amp;gt;        cl = at;&amp;lt;br/&amp;gt;        bb &amp;amp;gt;&amp;amp;gt;= 8; bb *= 0x00010281; bb &amp;amp;amp;= msk; at |= bb;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;    if ( sq &amp;amp;lt; 8 ) // or do this before the switch&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;        int a1a8 = free ;&amp;lt;br/&amp;gt;        at |= rankR[sq][a1a8 &amp;amp;amp; 0x7e];&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;    return at;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/*
= init               &amp;gt;&amp;gt;= 8               *= 0x10281         &amp;amp;= mask            at |= bb
 . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .
 . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .
 . . . . . . . .     . . . . . . . .     . . . 1 . . . .    . . . 1 . . . .    . . . 1 . . . .
 . . . 1 . . . .     . . . . . . . .     . . 1 . 1 . . .    . . . . . . . .    . . . 1 . . . .
 . . 1 s 1 . . .     . . . 1 . . . .     . 1 . 1 . 1 . .    . 1 . s . 1 . .    . 1 1 s 1 1 . .
 . . . 1 . . . .     . . 1 . 1 . . .     . . 1 . 1 . . .    . . . . . . . .    . . . 1 . . . .
 . . . . . . . .     . . . 1 . . . .     . . . 1 . . . .    . . . 1 . . . .    . . . 1 . . . .
 . . . . . . . .     . . . . . . . .     . . . . . . . .    . . . . . . . .    . . . . . . . .
                                       and nasty overflows
*/&lt;/span&gt;
Bitboard rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq, &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; Bitboard &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    Bitboard msk &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; maskR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;// The mask kills scattered bits&lt;/span&gt;
    Bitboard bb  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; initR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;// This drives the expansion/explosion. Here is the start.&lt;/span&gt;
    Bitboard at  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;          &lt;span class=&quot;co1&quot;&gt;// Collecting the resulting attacks&lt;/span&gt;
    Bitboard cl  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; at&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;          &lt;span class=&quot;co1&quot;&gt;// Clears some intermediate overflows&lt;/span&gt;
    Bitboard ov&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;                &lt;span class=&quot;co1&quot;&gt;// A nasty overflow bit when 4 directions in first step are possible.&lt;/span&gt;
                                &lt;span class=&quot;co1&quot;&gt;// Not nessessary on left side of board for repsR[sq] = 4 or 5.&lt;/span&gt;
                                &lt;span class=&quot;co1&quot;&gt;// Invent new numbers?&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// Perhaps it would be easier and faster to use rankR[][] on all ranks.&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// But I like the &#039;explosive&#039; algorithm. And I want to show that it works.&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; repsLeft &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// will be overwritten&lt;/span&gt;
    bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; repsR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00010081&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        repsLeft &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00010201&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        repsLeft &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00010281&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;      &lt;span class=&quot;co1&quot;&gt;// Clears for b-squares a nasty overflow from south-west-first-step to h file&lt;/span&gt;
        repsLeft &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00010281&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        ov &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; ov&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~ov&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;      &lt;span class=&quot;co1&quot;&gt;// Clears for b-squares a nasty overflow from south-west-first-step to h file&lt;/span&gt;
        repsLeft &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00010281&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        ov &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; ov&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~ov&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        repsLeft &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00010281&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        ov &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; ov&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~ov&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        repsLeft &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;coMULTI&quot;&gt;/* reaching here is an error */&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; msk&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;repsLeft&lt;span class=&quot;sy2&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~cl&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        cl &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; at&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        bb &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00010281&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; bb &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; msk&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bb&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// or do this before the switch&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; a1a8 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        at &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rankR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;a1a8 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x7e&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; at&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;There are some possible optimisations when the repsR[] array is modified in the corners during&lt;br /&gt;
the game or search. Some numbers 9, 10, 11 combined with additional switch cases can work&lt;br /&gt;
as a shortcut for rooks in the corners behind pawns.&lt;br /&gt;
&lt;br /&gt;
In the function rookAttacks() rankR is the well know simple lookup table from other bitboard algorithms.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int rankR[8][128];&amp;lt;br/&amp;gt;void makeRankR()&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    for ( int sq = 0; sq &amp;amp;lt; 8; ++sq )&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;        for ( int i = 0; i &amp;amp;lt; 128; i += 2 )&amp;lt;br/&amp;gt;        {&amp;lt;br/&amp;gt;            int rr = 0;&amp;lt;br/&amp;gt;            int j;&amp;lt;br/&amp;gt;            for ( j = sq - 1; j &amp;amp;gt;= 0; &amp;amp;#45;-j )&amp;lt;br/&amp;gt;            {&amp;lt;br/&amp;gt;                rr |= (1 &amp;amp;lt;&amp;amp;lt; j);&amp;lt;br/&amp;gt;                if ( !(i &amp;amp;amp; (1 &amp;amp;lt;&amp;amp;lt; j)) )  // the 1 bits are the free squares&amp;lt;br/&amp;gt;                    break;&amp;lt;br/&amp;gt;            }&amp;lt;br/&amp;gt;            for ( j = sq + 1; j &amp;amp;lt; 8; ++j )&amp;lt;br/&amp;gt;            {&amp;lt;br/&amp;gt;                rr |= (1 &amp;amp;lt;&amp;amp;lt; j);&amp;lt;br/&amp;gt;                if ( !(i &amp;amp;amp; (1 &amp;amp;lt;&amp;amp;lt; j)) )  // the 1 bits are the free squares&amp;lt;br/&amp;gt;                    break;&amp;lt;br/&amp;gt;            }&amp;lt;br/&amp;gt;            rankR[sq][i  ] = rr;&amp;lt;br/&amp;gt;            rankR[sq][i+1] = rr;&amp;lt;br/&amp;gt;        }&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rankR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;128&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt; makeRankR&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;sq &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;128&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
            &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; j&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; j &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; j &lt;span class=&quot;sy1&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;--&lt;/span&gt;j &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
                rr &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; j&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;i &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; j&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// the 1 bits are the free squares&lt;/span&gt;
                    &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
            &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; j &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; j &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;j &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
                rr &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; j&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;i &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; j&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// the 1 bits are the free squares&lt;/span&gt;
                    &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
            rankR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i  &lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rr&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
            rankR&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rr&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:9 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:22:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Results&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:22 --&gt;Results&lt;/h1&gt;
 The results can be masked or combined just like in other attack bitboards.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;Get a bitboard with all positions set to 1 which can be attacked&amp;lt;br/&amp;gt;from a rook or queen on the square.&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard Board::orthogonal_attacks( byte square ) const&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    Bitboard free = ~(wpieces_ | bpieces_); // from the board representation in the board class&amp;lt;br/&amp;gt;    Bitboard result = rookAttacks( square, free );&amp;lt;br/&amp;gt;    return result;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;/*&amp;lt;br/&amp;gt;Get a bitboard with all positions set to 1 which can be attacked&amp;lt;br/&amp;gt;from a bishop or queen on the square.&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard Board::diagonal_attacks( byte square ) const&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    Bitboard free = ~(wpieces_ | bpieces_); // from the board representation in the board class&amp;lt;br/&amp;gt;    Bitboard result = bishopAttacks( square, free );&amp;lt;br/&amp;gt;    return result;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/*
Get a bitboard with all positions set to 1 which can be attacked
from a rook or queen on the square.
*/&lt;/span&gt;
Bitboard Board&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;orthogonal_attacks&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byte square &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    Bitboard &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;wpieces_ &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; bpieces_&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// from the board representation in the board class&lt;/span&gt;
    Bitboard result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; result&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;coMULTI&quot;&gt;/*
Get a bitboard with all positions set to 1 which can be attacked
from a bishop or queen on the square.
*/&lt;/span&gt;
Bitboard Board&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;diagonal_attacks&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byte square &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    Bitboard &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;wpieces_ &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; bpieces_&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// from the board representation in the board class&lt;/span&gt;
    Bitboard result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; result&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;Another usage requires masks&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:11:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;const Bitboard dirMaskRight[8] =&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    // 0, line_h, line_gh, line_fh, line_eh, line_dh, line_ch, line_bh,&amp;lt;br/&amp;gt;    0, C64(0x0101010101010101), C64(0x0303030303030303), C64(0x0707070707070707), C64(0x0f0f0f0f0f0f0f0f),&amp;lt;br/&amp;gt;    C64(0x1f1f1f1f1f1f1f1f), C64(0x3f3f3f3f3f3f3f3f), C64(0x7f7f7f7f7f7f7f7f)&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;const Bitboard dirMaskLeft[8] =&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    // line_ag, line_af, line_ae, line_ad, line_ac, line_ab, line_a, 0,&amp;lt;br/&amp;gt;    C64(0xfefefefefefefefe), C64(0xfcfcfcfcfcfcfcfc), C64(0xf8f8f8f8f8f8f8f8), C64(0xf0f0f0f0f0f0f0f0),&amp;lt;br/&amp;gt;    C64(0xe0e0e0e0e0e0e0e0), C64(0xc0c0c0c0c0c0c0c0), C64(0x8080808080808080), 0&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;const Bitboard dirMaskUp[8] =&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    // row_28, row_38, row_48, row_58, row_68, row_78, row_8, 0,&amp;lt;br/&amp;gt;    C64(0xffffffffffffff00), C64(0xffffffffffff0000), C64(0xffffffffff000000), C64(0xffffffff00000000),&amp;lt;br/&amp;gt;    C64(0xffffff0000000000), C64(0xffff000000000000), C64(0xff00000000000000), 0&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;const Bitboard dirMaskDown[8] =&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    // 0, row_1, row_12, row_13, row_14, row_15, row_16, row_17,&amp;lt;br/&amp;gt;    0, C64(0x00000000000000ff), C64(0x000000000000ffff), C64(0x0000000000ffffff), C64(0x00000000ffffffff),&amp;lt;br/&amp;gt;    C64(0x000000ffffffffff), C64(0x0000ffffffffffff), C64(0x00ffffffffffffff)&amp;lt;br/&amp;gt;};&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; Bitboard dirMaskRight&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// 0, line_h, line_gh, line_fh, line_eh, line_dh, line_ch, line_bh,&lt;/span&gt;
    &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0303030303030303&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0707070707070707&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0f0f0f0f0f0f0f0f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
    C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x1f1f1f1f1f1f1f1f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x3f3f3f3f3f3f3f3f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; Bitboard dirMaskLeft&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// line_ag, line_af, line_ae, line_ad, line_ac, line_ab, line_a, 0,&lt;/span&gt;
    C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfcfcfcfcfcfcfcfc&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xf8f8f8f8f8f8f8f8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xf0f0f0f0f0f0f0f0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
    C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xe0e0e0e0e0e0e0e0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xc0c0c0c0c0c0c0c0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x8080808080808080&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; Bitboard dirMaskUp&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// row_28, row_38, row_48, row_58, row_68, row_78, row_8, 0,&lt;/span&gt;
    C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xffffffffffffff00&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xffffffffffff0000&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xffffffffff000000&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xffffffff00000000&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
    C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xffffff0000000000&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xffff000000000000&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xff00000000000000&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; Bitboard dirMaskDown&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// 0, row_1, row_12, row_13, row_14, row_15, row_16, row_17,&lt;/span&gt;
    &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x00000000000000ff&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x000000000000ffff&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0000000000ffffff&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x00000000ffffffff&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
    C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x000000ffffffffff&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0000ffffffffffff&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;, C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x00ffffffffffffff&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:11 --&gt;to generate attacks in one direction.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:12:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt;Get a bitboard with all positions set to 1 which can be attacked&amp;lt;br/&amp;gt;from a bishop, rook or queen on the square moving in the direction.&amp;lt;br/&amp;gt;*/&amp;lt;br/&amp;gt;Bitboard Board::direction_attacks( byte square, byte dir ) const&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;    Bitboard result;&amp;lt;br/&amp;gt;    Bitboard free = ~(wpieces_ | bpieces_); // from the board representation in the board class&amp;lt;br/&amp;gt;    // 4 3 2&amp;lt;br/&amp;gt;    // 5 0 1&amp;lt;br/&amp;gt;    // 6 7 8&amp;lt;br/&amp;gt;    switch ( dir )&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;      case 1:&amp;lt;br/&amp;gt;        result = rookAttacks( square, free );&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskRight[square &amp;amp;amp; 7];&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 5:&amp;lt;br/&amp;gt;        result = rookAttacks( square, free );&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskLeft[square &amp;amp;amp; 7];&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 7:&amp;lt;br/&amp;gt;        result = rookAttacks( square, free );&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskDown[square &amp;amp;gt;&amp;amp;gt; 3];&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 3:&amp;lt;br/&amp;gt;        result = rookAttacks( square, free );&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskUp[square &amp;amp;gt;&amp;amp;gt; 3];&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 8:&amp;lt;br/&amp;gt;        result = bishopAttacks( square, free );&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskRight[square &amp;amp;amp; 7];&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskDown[square &amp;amp;gt;&amp;amp;gt; 3];&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 4:&amp;lt;br/&amp;gt;        result = bishopAttacks( square, free );&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskLeft[square &amp;amp;amp; 7];&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskUp[square &amp;amp;gt;&amp;amp;gt; 3];&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 2:&amp;lt;br/&amp;gt;        result = bishopAttacks( square, free );&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskRight[square &amp;amp;amp; 7];&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskUp[square &amp;amp;gt;&amp;amp;gt; 3];&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      case 6:&amp;lt;br/&amp;gt;        result = bishopAttacks( square, free );&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskLeft[square &amp;amp;amp; 7];&amp;lt;br/&amp;gt;        result &amp;amp;amp;= dirMaskDown[square &amp;amp;gt;&amp;amp;gt; 3];&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;      default:&amp;lt;br/&amp;gt;        result = 0;&amp;lt;br/&amp;gt;        break;&amp;lt;br/&amp;gt;    }&amp;lt;br/&amp;gt;    return result;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;coMULTI&quot;&gt;/*
Get a bitboard with all positions set to 1 which can be attacked
from a bishop, rook or queen on the square moving in the direction.
*/&lt;/span&gt;
Bitboard Board&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;direction_attacks&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; byte square, byte dir &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    Bitboard result&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    Bitboard &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;wpieces_ &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; bpieces_&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// from the board representation in the board class&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// 4 3 2&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// 5 0 1&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;// 6 7 8&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; dir &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskRight&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskLeft&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskDown&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskUp&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskRight&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskDown&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskLeft&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskUp&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskRight&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskUp&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; square, &lt;span class=&quot;kw3&quot;&gt;free&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskLeft&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        result &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; dirMaskDown&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;square &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
        result &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; result&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:12 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:24:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:24 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:84:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=4523&amp;amp;start=80&quot; rel=&quot;nofollow&quot;&gt;Re: Compact Bitboard Attacks&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Harald%20L%C3%BC%C3%9Fen&quot;&gt;Harald Lüßen&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, September 13, 2006&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:84 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:26:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:26 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:013:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Exploding Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Exploding Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Exploding_Bitboards includeBody-Exploding%20Bitboards includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Elephant&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Elephant&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 19, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Exploding+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Exploding Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 9, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Harald+L%C3%BC%C3%9Fen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Harald Lüßen&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 20, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sherwin+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sherwin Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 20, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:013 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>First Rank Attacks</title>
      <link>https://chessprogramming.wikispaces.com/First+Rank+Attacks</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/First+Rank+Attacks</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/First+Rank+Attacks</comments>
      <pubDate>Sat, 28 Aug 2010 21:33:55 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:16:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:16 --&gt;&lt;!-- ws:start:WikiTextTocRule:17: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Introduction to Occupancy Lookup&quot;&gt;Introduction to Occupancy Lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:17 --&gt;&lt;!-- ws:start:WikiTextTocRule:18: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Introduction to Occupancy Lookup-One Byte Only&quot;&gt;One Byte Only&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:18 --&gt;&lt;!-- ws:start:WikiTextTocRule:19: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Introduction to Occupancy Lookup-Overdetermined?&quot;&gt;Overdetermined?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:19 --&gt;&lt;!-- ws:start:WikiTextTocRule:20: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Introduction to Occupancy Lookup-The Outer Squares&quot;&gt;The Outer Squares&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:20 --&gt;&lt;!-- ws:start:WikiTextTocRule:21: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Attacks on all Ranks&quot;&gt;Attacks on all Ranks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:21 --&gt;&lt;!-- ws:start:WikiTextTocRule:22: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:22 --&gt;&lt;!-- ws:start:WikiTextTocRule:23: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:23 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * First Rank Attacks&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The technique of &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; lookups is base for &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;rotated-&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;kindergarten&lt;/a&gt; -bitboards.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:4:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Introduction to Occupancy Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:4 --&gt;Introduction to Occupancy Lookup&lt;/h1&gt;
 The first &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;rank&lt;/a&gt; is the ideal line to introduce occupancy lookups.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:6:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Introduction to Occupancy Lookup-One Byte Only&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:6 --&gt;One Byte Only&lt;/h2&gt;
 Assume we (temporary) reduce the chess-board to one &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;rank&lt;/a&gt;. Occupancy bitboard is one &lt;a class=&quot;wiki_link&quot; href=&quot;/Byte&quot;&gt;byte&lt;/a&gt; with up to 256 states. A &lt;a class=&quot;wiki_link&quot; href=&quot;/Rook&quot;&gt;rook&lt;/a&gt; attack-set from one of the eight &lt;a class=&quot;wiki_link&quot; href=&quot;/Squares&quot;&gt;squares&lt;/a&gt; (&lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;file&lt;/a&gt;) on this single rank is also only one byte. Thus we can construct an &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt; of bytes[256][8], indexed by all 256 occupancies and 8 files, to lookup the pre-calculated rank-attack bytes.&lt;br /&gt;
&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:44:&amp;lt;img src=&amp;quot;/file/view/firstRank.JPG/47379251/firstRank.JPG&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;img src=&quot;/file/view/firstRank.JPG/47379251/firstRank.JPG&quot; alt=&quot;firstRank.JPG&quot; title=&quot;firstRank.JPG&quot; /&gt;&lt;!-- ws:end:WikiTextLocalImageRule:44 --&gt;&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Occupancy of the first rank = 01001010B&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:45:&amp;lt;img src=&amp;quot;/file/view/firstRankA.JPG/47379293/firstRankA.JPG&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;img src=&quot;/file/view/firstRankA.JPG/47379293/firstRankA.JPG&quot; alt=&quot;firstRankA.JPG&quot; title=&quot;firstRankA.JPG&quot; /&gt;&lt;!-- ws:end:WikiTextLocalImageRule:45 --&gt;&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Rank-attacks ::= f (e-file, Occupancy) = 01110110B&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;BYTE arrFirstRankAttacks256x8[256][8]; // 2048 Bytes = 2KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;firstRankAttack = arrFirstRankAttacks256x8[rankOccupancy][squareOnRank];&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;BYTE arrFirstRankAttacks256x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 2048 Bytes = 2KByte&lt;/span&gt;
&amp;nbsp;
firstRankAttack &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; arrFirstRankAttacks256x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;rankOccupancy&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;squareOnRank&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:8:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Introduction to Occupancy Lookup-Overdetermined?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:8 --&gt;Overdetermined?&lt;/h2&gt;
 In fact both indices seem somehow overdetermined, since the rook is already member of occupancy. But rather than to make the redundant rook-bit disappear to use only the remaining seven occupancy bits, with half table size - which is not that cheap and simple either - we better decide to uncouple this items to eventually pass (virtual) rook squares, not actually member of occupancy. We better rely on another property to reduce the table fourfold.&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:24:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@TheOuterSquares&amp;quot; title=&amp;quot;Anchor: TheOuterSquares&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;TheOuterSquares&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:24 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:10:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Introduction to Occupancy Lookup-The Outer Squares&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:10 --&gt;The Outer Squares&lt;/h2&gt;
 If we think about to the occupancy lookup, we may recognize that the outer squares don&#039;t matter. There are no more squares behind. The outer squares are either attacked or not - independent from their occupancy state. We can use the &lt;strong&gt;six inner bits&lt;/strong&gt; only as lookup-index with two additional cheap instructions.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;BYTE arrFirstRankAttacks64x8[64][8]; // 512 Bytes = 1/2KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;firstRankAttack = arrFirstRankAttacks64x8[(rankOccupancy &amp;amp;gt;&amp;amp;gt; 1)&amp;amp;amp; 63][squareOnRank];&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;BYTE arrFirstRankAttacks64x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 512 Bytes = 1/2KByte&lt;/span&gt;
&amp;nbsp;
firstRankAttack &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; arrFirstRankAttacks64x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rankOccupancy &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;squareOnRank&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:25:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@AttacksOnAllRanks&amp;quot; title=&amp;quot;Anchor: AttacksOnAllRanks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;AttacksOnAllRanks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:25 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:12:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Attacks on all Ranks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:12 --&gt;Attacks on all Ranks&lt;/h1&gt;
 Since it is simple to shift ranks up and down, the general rank attack getter is already handy.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;BYTE arrFirstRankAttacks64x8[64*8]; // 512 Bytes = 1/2KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rankAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   unsigned int file = sq &amp;amp;amp;  7;&amp;lt;br/&amp;gt;   unsigned int rkx8 = sq &amp;amp;amp; 56; // rank * 8&amp;lt;br/&amp;gt;   occ = (occ &amp;amp;gt;&amp;amp;gt; rkx8) &amp;amp;amp; 2*63;&amp;lt;br/&amp;gt;   U64 attacks = arrFirstRankAttacks64x8[4*occ + file];&amp;lt;br/&amp;gt;   return attacks &amp;amp;lt;&amp;amp;lt; rkx8;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;BYTE arrFirstRankAttacks64x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 512 Bytes = 1/2KByte&lt;/span&gt;
&amp;nbsp;
U64 rankAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; file &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rkx8 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;56&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// rank * 8&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; rkx8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 attacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; arrFirstRankAttacks64x8&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;occ &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; file&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; rkx8&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;The &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt; is defined one-dimensional, and has to indexed by 8*occ + file. The reason was playing the optimization game and to safe the right shift one, but to scale by 4 instead of 8, which is done by the address calculation unit anyway.&lt;br /&gt;
&lt;br /&gt;
This routine may complete the &lt;a class=&quot;wiki_link&quot; href=&quot;/Hyperbola%20Quintessence&quot;&gt;Hyperbola Quintessence&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:14:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:14 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:03:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;First Rank Attacks&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;First Rank Attacks&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-First_Rank_Attacks includeBody-First%20Rank%20Attacks includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Amoeba&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Amoeba&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 19, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Amundsen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Amundsen&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 3, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Android-Chess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Android-Chess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Best+Magics+so+far&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Best Magics so far&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 13, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/BMI2&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;BMI2&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 6, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Brainless&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Brainless&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 24, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Byte&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Byte&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 5, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chesley&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chesley&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 25, 2012&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Classical+Approach&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Classical Approach&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 28, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Congruent+Modulo+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Congruent Modulo Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 26, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dumb&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dumb&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 10, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dumb7Fill&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dumb7Fill&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Efficient Generation of Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/First+Rank+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;First Rank Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 28, 2010&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fridel+Fainshtein&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fridel Fainshtein&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 8, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hiding+the+Implementation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hiding the Implementation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 3, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hyperbola+Quintessence&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hyperbola Quintessence&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 25, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kindergarten+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kindergarten Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kurt&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kurt&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 20, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Magic+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Magic Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 13, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Occupancy+of+any+Line&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Occupancy of any Line&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 16, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Prophet&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Prophet&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rabbit&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rabbit&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 5, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Roberto+Waldteufel&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Roberto Waldteufel&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rotated+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rotated Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 7, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sayuri&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sayuri&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/The+switch+Approach&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;The switch Approach&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2010&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Vajolet&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Vajolet&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Wing&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Wing&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Winglet&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Winglet&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 26, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/X-ray+Attacks+%28Bitboards%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;X-ray Attacks (Bitboards)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 31, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Yaakov+HaCohen-Kerner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Yaakov HaCohen-Kerner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 23, 2014&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:03 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Hashing Dictionaries</title>
      <link>https://chessprogramming.wikispaces.com/Hashing+Dictionaries</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Hashing+Dictionaries</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Hashing+Dictionaries</comments>
      <pubDate>Sat, 01 Mar 2014 13:31:56 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:28:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:28 --&gt;&lt;!-- ws:start:WikiTextTocRule:29: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Avoiding Rotated Bitboards with Direct Lookup&quot;&gt;Avoiding Rotated Bitboards with Direct Lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:29 --&gt;&lt;!-- ws:start:WikiTextTocRule:30: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Avoiding Rotated Bitboards with Direct Lookup-Abstract&quot;&gt;Abstract&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:30 --&gt;&lt;!-- ws:start:WikiTextTocRule:31: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:31 --&gt;&lt;!-- ws:start:WikiTextTocRule:32: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#External Links-Class Libraries&quot;&gt;Class Libraries&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:32 --&gt;&lt;!-- ws:start:WikiTextTocRule:33: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:33 --&gt;&lt;!-- ws:start:WikiTextTocRule:34: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:34 --&gt;&lt;!-- ws:start:WikiTextTocRule:35: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:35 --&gt;&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Hashing Dictionaries&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
This approach using associate arrays or &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table&quot;&gt;hash tables&lt;/a&gt; was introduced in the &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal&quot;&gt;ICGA Journal&lt;/a&gt; (June 2007) by &lt;a class=&quot;wiki_link&quot; href=&quot;/Sam%20Tannous&quot;&gt;Sam Tannous&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:8:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Sam%20Tannous&amp;quot;&amp;gt;Sam Tannous&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;2007&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://arxiv.org/abs/0704.3773&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Avoiding Rotated Bitboards with Direct Lookup&amp;lt;/a&amp;gt;&amp;lt;/em&amp;gt;. &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/ICGA%20Journal#30_2&amp;quot;&amp;gt;ICGA Journal, Vol. 30, No. 2&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://arxiv.org/PS_cache/arxiv/pdf/0704/0704.3773v2.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;pdf&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:8 --&gt;. Like other &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; lookup approaches it works line-wise for ranks, files, diagonals and anti-diagonals. It uses hash arrays from an interpreted, high level language, &lt;a class=&quot;wiki_link&quot; href=&quot;/Python&quot;&gt;Python&lt;/a&gt;:&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;tt&gt;Many high level programming languages (notably &lt;a class=&quot;wiki_link&quot; href=&quot;/Python&quot;&gt;Python&lt;/a&gt; (van Rossum, 1993)) have useful predefined data structures (e.g. associative arrays) which are dynamically resizable hash tables that resolve collisions by probing techniques. The basic lookup function used in Python is based on Algorithm D: Open Addressing with Double Hashing from Section 6.4 in Knuth&lt;/tt&gt; &lt;!-- ws:start:WikiTextRefRule:14:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Donald%20Knuth&amp;quot;&amp;gt;Donald Knuth&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1998&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;The Art of Computer Programming&amp;lt;/em&amp;gt;. Volume 3, Sorting and Searching. Addison Wesley. ISBN 0201896850&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:14 --&gt;.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:16:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Avoiding Rotated Bitboards with Direct Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:16 --&gt;Avoiding Rotated Bitboards with Direct Lookup&lt;/h1&gt;
 Sam Tannous compared this approach to a &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt; implementation in Python and found direct lookup favorable for move generation. In languages like &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt;, targeting 64-bit cpus like &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt;, or even in &lt;a class=&quot;wiki_link&quot; href=&quot;/Java&quot;&gt;Java&lt;/a&gt;, it is likely another story if one compares &lt;em&gt;Open Addressing with Double Hashing&lt;/em&gt; with &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;rotated&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table#PerfectHashing&quot;&gt;perfect hashing&lt;/a&gt; techniques like &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;Kindergarten&lt;/a&gt; or even &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:18:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Avoiding Rotated Bitboards with Direct Lookup-Abstract&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:18 --&gt;Abstract&lt;/h2&gt;
Quoted from &lt;em&gt;Avoiding Rotated Bitboards with Direct Lookup&lt;/em&gt;: &lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;tt&gt;This paper describes an approach for obtaining direct access to the attacked squares of sliding pieces without resorting to rotated bitboards. The technique involves creating four &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table&quot;&gt;hash tables&lt;/a&gt; using the built in hash arrays from an interpreted, high level language. The rank, file, and diagonal occupancy are first isolated by masking the desired portion of the board. The attacked squares are then directly retrieved from the hash tables. Maintaining incrementally updated rotated bitboards becomes unnecessary as does all the updating, mapping and shifting required to access the attacked squares. Finally, rotated bitboard move generation speed is compared with that of the direct hash table lookup method.&lt;/tt&gt;&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:20:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:20 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.employees.org/%7Estannous/&quot; rel=&quot;nofollow&quot;&gt;Sam Tannous homepage&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:22:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;External Links-Class Libraries&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:22 --&gt;Class Libraries&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://docs.python.org/lib/module-UserDict.html&quot; rel=&quot;nofollow&quot;&gt;UserDict - Class wrapper for dictionary objects&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://docs.python.org/lib/lib.html&quot; rel=&quot;nofollow&quot;&gt;Python Library Reference&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://docs.python.org/lib/defaultdict-objects.html&quot; rel=&quot;nofollow&quot;&gt;defaultdict objects&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://docs.python.org/lib/lib.html&quot; rel=&quot;nofollow&quot;&gt;Python Library Reference&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://doc.trolltech.com/2.3/qmap.html&quot; rel=&quot;nofollow&quot;&gt;QMap Class Reference&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://doc.trolltech.com/2.3/index.html&quot; rel=&quot;nofollow&quot;&gt;Qt On-line Reference Documentation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://msdn.microsoft.com/en-us/library/s897094z%28VS.80%29.aspx&quot; rel=&quot;nofollow&quot;&gt;CMap Class&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://msdn.microsoft.com/en-us/library/d06h2x6e%28VS.80%29.aspx&quot; rel=&quot;nofollow&quot;&gt;MFC Library Reference&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:24:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:24 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:117:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Sam%20Tannous&quot;&gt;Sam Tannous&lt;/a&gt; (&lt;strong&gt;2007&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://arxiv.org/abs/0704.3773&quot; rel=&quot;nofollow&quot;&gt;Avoiding Rotated Bitboards with Direct Lookup&lt;/a&gt;&lt;/em&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal#30_2&quot;&gt;ICGA Journal, Vol. 30, No. 2&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://arxiv.org/PS_cache/arxiv/pdf/0704/0704.3773v2.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Donald%20Knuth&quot;&gt;Donald Knuth&lt;/a&gt; (&lt;strong&gt;1998&lt;/strong&gt;). &lt;em&gt;The Art of Computer Programming&lt;/em&gt;. Volume 3, Sorting and Searching. Addison Wesley. ISBN 0201896850&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:117 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:26:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:26 --&gt;What links here?&lt;/h1&gt;
&lt;!-- ws:start:WikiTextIncludeRule:00:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Hashing Dictionaries&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Hashing Dictionaries&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Hashing_Dictionaries includeBody-Hashing%20Dictionaries includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Congruent+Modulo+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Congruent Modulo Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 26, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Efficient Generation of Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hash+Table&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hash Table&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hashing+Dictionaries&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hashing Dictionaries&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 1, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mark+Levene&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mark Levene&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Python&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Python&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 31, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sam+Tannous&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sam Tannous&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 1, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Shatranj+%28toolkit%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Shatranj (toolkit)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 16, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Trevor+Fenner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Trevor Fenner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2015&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:00 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Hiding the Implementation</title>
      <link>https://chessprogramming.wikispaces.com/Hiding+the+Implementation</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Hiding+the+Implementation</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Hiding+the+Implementation</comments>
      <pubDate>Thu, 03 Feb 2011 11:04:13 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Hiding the Implementation&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
None rotated approaches as mentioned in&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Classical%20Approach#Wrapper&quot;&gt;Classical Approach&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#AttacksOnAllRanks&quot;&gt;Rank Attacks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Hyperbola%20Quintessence&quot;&gt;Hyperbola Quintessence&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Obstruction%20Difference&quot;&gt;Obstruction Difference&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;Kindergarten Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/The%20switch%20Approach&quot;&gt;The switch Approach&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/SIMD%20techniques&quot;&gt;SIMD techniques&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
can hide the implementation details behind a stateless interface:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq);&amp;lt;br/&amp;gt;U64 antiDiagAttacks(U64 occ, enumSquare sq);&amp;lt;br/&amp;gt;U64 fileAttacks    (U64 occ, enumSquare sq);&amp;lt;br/&amp;gt;U64 rankAttacks    (U64 occ, enumSquare sq);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks    (U64 occ, enumSquare sq);&amp;lt;br/&amp;gt;U64 bishopAttacks  (U64 occ, enumSquare sq);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 queenAttacks   (U64 occ, enumSquare sq);&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;U64 diagonalAttacks(U64 occ, enumSquare sq);
U64 antiDiagAttacks(U64 occ, enumSquare sq);
U64 fileAttacks    (U64 occ, enumSquare sq);
U64 rankAttacks    (U64 occ, enumSquare sq);
&amp;nbsp;
U64 rookAttacks    (U64 occ, enumSquare sq);
U64 bishopAttacks  (U64 occ, enumSquare sq);
&amp;nbsp;
U64 queenAttacks   (U64 occ, enumSquare sq);&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;br /&gt;
In &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt; / &lt;a class=&quot;wiki_link&quot; href=&quot;/Cpp&quot;&gt;C++&lt;/a&gt; one may use &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Header_file&quot; rel=&quot;nofollow&quot;&gt;header files&lt;/a&gt; with exclusive, conditional compiled inlined routines, as combinations and variations of the mentioned approaches. Initialization should be implemented by conditional compile switches in various implementation files (c, cpp). Favorite should be &lt;strong&gt;bishopAttack&lt;/strong&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;magic bitboards&lt;/a&gt; due to the relative small table less than 38KByte, while magic &lt;strong&gt;rookattacks&lt;/strong&gt; takes more than 20 times the space so far.&lt;br /&gt;
&lt;br /&gt;
As always with &lt;a class=&quot;wiki_link&quot; href=&quot;/Space-Time%20Tradeoff&quot;&gt;space-time tradeoff&lt;/a&gt; - it depends on the cache- and &lt;a class=&quot;wiki_link&quot; href=&quot;/Memory&quot;&gt;memory&lt;/a&gt; using and &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Memory_footprint&quot; rel=&quot;nofollow&quot;&gt;footprint&lt;/a&gt; of a individual chess program - on a particular hardware architecture - which solution is preferable and faster. &lt;a class=&quot;wiki_link&quot; href=&quot;/Perft&quot;&gt;Perft&lt;/a&gt; frameworks likely prefer larger tables but less computation. So far L1 &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Cache&quot; rel=&quot;nofollow&quot;&gt;Cache&lt;/a&gt; is a rare resource, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Translation_Lookaside_Buffer&quot; rel=&quot;nofollow&quot;&gt;Translation Lookaside Buffer&lt;/a&gt; als well.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:2:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:2 --&gt;External Links&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Information_hiding&quot; rel=&quot;nofollow&quot;&gt;Information hiding from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:4:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:4 --&gt;What links here?&lt;/h1&gt;
&lt;!-- ws:start:WikiTextIncludeRule:01:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@component=&amp;amp;quot;backlinks&amp;amp;quot; page=&amp;amp;quot;Hiding the Implementation&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: component=&amp;amp;quot;backlinks&amp;amp;quot; page=&amp;amp;quot;Hiding the Implementation&amp;amp;quot; limit=&amp;amp;quot;20&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Hiding_the_Implementation includeBody-Hiding%20the%20Implementation includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fridel+Fainshtein&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fridel Fainshtein&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 8, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hiding+the+Implementation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hiding the Implementation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 3, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kindergarten+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kindergarten Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Yaakov+HaCohen-Kerner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Yaakov HaCohen-Kerner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 23, 2014&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:01 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Hyperbola Quintessence</title>
      <link>https://chessprogramming.wikispaces.com/Hyperbola+Quintessence</link>
      <dc:creator>camleon</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Hyperbola+Quintessence</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Hyperbola+Quintessence</comments>
      <pubDate>Sat, 25 Mar 2017 14:31:28 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Hyperbola Quintessence&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:162:&amp;lt;a href=&amp;quot;http://www.puckergallery.com/artists/bak_chess/bak_chess_all.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/Reflexion.jpg/157859941/313x258/Reflexion.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;height: 258px; width: 313px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://www.puckergallery.com/artists/bak_chess/bak_chess_all.html&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/Reflexion.jpg/157859941/313x258/Reflexion.jpg&quot; alt=&quot;Reflexion.jpg&quot; title=&quot;Reflexion.jpg&quot; style=&quot;height: 258px; width: 313px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:162 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;&lt;strong&gt;Hyperbola Quintessence&lt;/strong&gt; applies the &lt;a class=&quot;wiki_link&quot; href=&quot;/Subtracting%20a%20rook%20from%20a%20blocking%20piece&quot;&gt;o^(o-2r)-trick&lt;/a&gt; also for vertical or diagonal &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#NegativeRays&quot;&gt;negative Rays&lt;/a&gt; - by reversing the bit-order of up to one bit per rank or &lt;a class=&quot;wiki_link&quot; href=&quot;/Byte&quot;&gt;byte&lt;/a&gt; with a &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#FlipVertically&quot;&gt;vertical flip&lt;/a&gt; aka &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64#gpinstructions&quot;&gt;bswap&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:15:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://msdn.microsoft.com/en-us/library/a3140177.aspx&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;_byteswap_uint64&amp;lt;/a&amp;gt; Visual C++ Developer Center - Run-Time Library Reference&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:15 --&gt; . It is somehow a resurrection of the &lt;a class=&quot;wiki_link&quot; href=&quot;/Reverse%20Bitboards&quot;&gt;reverse bitboards&lt;/a&gt; idea of &lt;a class=&quot;wiki_link&quot; href=&quot;/Ryan%20Mack&quot;&gt;Ryan Mack&#039;s&lt;/a&gt; &lt;em&gt;Hyperbola Project&lt;/em&gt; on the fly, and was created by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;. Improvements by &lt;a class=&quot;wiki_link&quot; href=&quot;/Aleks%20Peshkov&quot;&gt;Aleks Peshkov&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:20:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;amp;p=140314&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Aleks%20Peshkov&amp;quot;&amp;gt;Aleks Peshkov&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 25, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Timeline#2007&amp;quot;&amp;gt;2007&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:20 --&gt; made it applicable and competitive.&lt;br /&gt;
&lt;!-- ws:start:WikiTextIncludeRule:014:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/page?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; title=&amp;quot;Include page: page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;

&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a href=&quot;/Square%20Mapping%20Considerations&quot;&gt;&lt;img src=&quot;/file/view/mapping.JPG/93134172/mapping.JPG&quot; alt=&quot;mapping.JPG&quot; title=&quot;mapping.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;em&gt;Code samples and bitboard diagrams rely on &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations#LittleEndianRankFileMapping&quot;&gt;Little endian file and rank mapping&lt;/a&gt;&lt;/em&gt;.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:end:WikiTextIncludeRule:014 --&gt;&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#Bak&quot;&gt;Samuel Bak&lt;/a&gt; - Reflexion, 1990 &lt;!-- ws:start:WikiTextRefRule:23:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.puckergallery.com/artists/bak_chess/bak_chess_all.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;The Game of War&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.puckergallery.com/artists/bak_index/bak_publications.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Samuel Bak - represented by Pucker Gallery since 1969&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:23 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:77:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:77 --&gt;&lt;!-- ws:start:WikiTextTocRule:78: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Reverse Math&quot;&gt;Reverse Math&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:78 --&gt;&lt;!-- ws:start:WikiTextTocRule:79: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Source Code&quot;&gt;Source Code&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:79 --&gt;&lt;!-- ws:start:WikiTextTocRule:80: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Source Code-C&quot;&gt;C&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:80 --&gt;&lt;!-- ws:start:WikiTextTocRule:81: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Source Code-Generalized set-wise attacks&quot;&gt;Generalized set-wise attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:81 --&gt;&lt;!-- ws:start:WikiTextTocRule:82: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Source Code-x86-64 assembly&quot;&gt;x86-64 assembly&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:82 --&gt;&lt;!-- ws:start:WikiTextTocRule:83: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Source Code-Java&quot;&gt;Java&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:83 --&gt;&lt;!-- ws:start:WikiTextTocRule:84: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#AMD&#039;s SIMD Future in 2011&quot;&gt;AMD&#039;s SIMD Future in 2011&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:84 --&gt;&lt;!-- ws:start:WikiTextTocRule:85: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:85 --&gt;&lt;!-- ws:start:WikiTextTocRule:86: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forum Posts&quot;&gt;Forum Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:86 --&gt;&lt;!-- ws:start:WikiTextTocRule:87: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:87 --&gt;&lt;!-- ws:start:WikiTextTocRule:88: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#External Links-Hyperbola&quot;&gt;Hyperbola&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:88 --&gt;&lt;!-- ws:start:WikiTextTocRule:89: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#External Links-Quintessence&quot;&gt;Quintessence&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:89 --&gt;&lt;!-- ws:start:WikiTextTocRule:90: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#External Links-Misc&quot;&gt;Misc&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:90 --&gt;&lt;!-- ws:start:WikiTextTocRule:91: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:91 --&gt;&lt;!-- ws:start:WikiTextTocRule:92: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:92 --&gt;&lt;!-- ws:start:WikiTextTocRule:93: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:93 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:47:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Reverse Math&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:47 --&gt;Reverse Math&lt;/h1&gt;
 Assume following masked &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; on a &lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;file&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Diagonals&quot;&gt;diagonal&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Anti-Diagonals&quot;&gt;anti-diagonal&lt;/a&gt; - for simplicity as a flat byte (in a real bitboard with masked files or diagonals you have 6..8 scratch-bits between the bits of this byte). Thus, vertical flip reverses the bits of this byte.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;o&#039; = reverse(o)&amp;lt;br/&amp;gt;r&#039; = reverse(r)&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;       normal    reversed&amp;lt;br/&amp;gt; o     11010101  10101011 o&#039; occupancy including slider&amp;lt;br/&amp;gt; r     00010000  00001000 r&#039; slider&amp;lt;br/&amp;gt; o-r   11000101  10100011 o&#039;-r&#039;  1. sub clears the slider&amp;lt;br/&amp;gt; o-2r  10110101  10011011 o&#039;-2r&#039; 2. sub borrows &amp;amp;quot;one&amp;amp;quot; from next blocker&amp;lt;br/&amp;gt;       |......|  \....../&amp;lt;br/&amp;gt;normal 10110101   \..../&amp;lt;br/&amp;gt;       11011001 &amp;amp;lt;&amp;amp;#45;-XXXX   re-reverse&amp;lt;br/&amp;gt;single&amp;lt;br/&amp;gt;xor    01101100 -&amp;amp;gt; to get the attack set&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;o&#039; = reverse(o)
r&#039; = reverse(r)
&amp;nbsp;
       normal    reversed
 o     11010101  10101011 o&#039; occupancy including slider
 r     00010000  00001000 r&#039; slider
 o-r   11000101  10100011 o&#039;-r&#039;  1. sub clears the slider
 o-2r  10110101  10011011 o&#039;-2r&#039; 2. sub borrows &amp;quot;one&amp;quot; from next blocker
       |......|  \....../
normal 10110101   \..../
       11011001 &amp;lt;--XXXX   re-reverse
single
xor    01101100 -&amp;gt; to get the attack set&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;The first subtraction of (o-2r) is done implicitly by masking off the line, removing the slider from the occupied set. The second subtraction borrows a &amp;quot;one&amp;quot; from the next nearest blocker in msb-direction, falling through all unset bits outside the line. Of course, if no blocker is available, it borrows a &amp;quot;one&amp;quot; in usual arithmetical manner from the hidden 2^N. Only the changed bits (from original o, o&#039;) are the appropriate sliding attacks, including the blocker but excluding the slider. The result finally needs to be intersected with the same line mask as previously the occupancy, to clear the wrapped borrow one bits outside the file or diagonal. The fine optimization by &lt;a class=&quot;wiki_link&quot; href=&quot;/Aleks%20Peshkov&quot;&gt;Aleks Peshkov&lt;/a&gt; covers the final &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Union&quot;&gt;union&lt;/a&gt; of &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#PositiveRays&quot;&gt;positive&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#NegativeRays&quot;&gt;negative ray-attacks&lt;/a&gt;. Since opposed &lt;a class=&quot;wiki_link&quot; href=&quot;/Rays#RayDirections&quot;&gt;ray-directions&lt;/a&gt; are always disjoint sets, using &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#ExclusiveOr&quot;&gt;xor&lt;/a&gt; instead of &lt;em&gt;bitwise or&lt;/em&gt; safes two instructions per line-attack. That is because bit-reversal or any &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating&quot;&gt;mirroring or flipping&lt;/a&gt; is own inverse and distributive over xor.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;reverse(a ^ b) == reverse (a) ^ reverse(b)&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;reverse(a ^ b) == reverse (a) ^ reverse(b)&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;thus&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;lineAttacks = o^(o-2r) ^ reverse((o&#039;-2r&#039;)^o&#039;)&amp;lt;br/&amp;gt;lineAttacks = o^(o-2r) ^ reverse( o&#039;-2r&#039;) ^ reverse(o&#039;)&amp;lt;br/&amp;gt;lineAttacks = o^(o-2r) ^ reverse( o&#039;-2r&#039;) ^ o&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;lineAttacks = o^(o-2r) ^ reverse((o&#039;-2r&#039;)^o&#039;)
lineAttacks = o^(o-2r) ^ reverse( o&#039;-2r&#039;) ^ reverse(o&#039;)
lineAttacks = o^(o-2r) ^ reverse( o&#039;-2r&#039;) ^ o&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;and finally&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;lineAttacks =   (o-2r) ^ reverse( o&#039;-2r&#039;)&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;lineAttacks =   (o-2r) ^ reverse( o&#039;-2r&#039;)&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;Beside shorter code this reduces register pressure - and clearly outperforms &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;kindergarten bitboards&lt;/a&gt; - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Instructions_Per_Cycle&quot; rel=&quot;nofollow&quot;&gt;ipc&lt;/a&gt;-wise, in code size and memory requirements.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:49:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Source Code&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:49 --&gt;Source Code&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextHeadingRule:51:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Source Code-C&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:51 --&gt;C&lt;/h2&gt;
 The three &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt;-routines only differ by the line-mask applied:&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64 forward, reverse;&amp;lt;br/&amp;gt;   forward = occ &amp;amp;amp; smsk[sq].diagonalMaskEx;&amp;lt;br/&amp;gt;   reverse  = _byteswap_uint64(forward);&amp;lt;br/&amp;gt;   forward -= smsk[sq].bitMask;&amp;lt;br/&amp;gt;   reverse -= _byteswap_uint64(smsk[sq].bitMask);&amp;lt;br/&amp;gt;   forward ^= _byteswap_uint64(reverse);&amp;lt;br/&amp;gt;   forward &amp;amp;amp;= smsk[sq].diagonalMaskEx;&amp;lt;br/&amp;gt;   return forward;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 antiDiagAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64 forward, reverse;&amp;lt;br/&amp;gt;   forward  = occ &amp;amp;amp; smsk[sq].antidiagMaskEx;&amp;lt;br/&amp;gt;   reverse  = _byteswap_uint64(forward);&amp;lt;br/&amp;gt;   forward -= smsk[sq].bitMask;&amp;lt;br/&amp;gt;   reverse -= _byteswap_uint64(smsk[sq].bitMask);&amp;lt;br/&amp;gt;   forward ^= _byteswap_uint64(reverse);&amp;lt;br/&amp;gt;   forward &amp;amp;amp;= smsk[sq].antidiagMaskEx;&amp;lt;br/&amp;gt;   return forward;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64 forward, reverse;&amp;lt;br/&amp;gt;   forward  = occ &amp;amp;amp; smsk[sq].fileMaskEx;&amp;lt;br/&amp;gt;   reverse  = _byteswap_uint64(forward);&amp;lt;br/&amp;gt;   forward -= smsk[sq].bitMask;&amp;lt;br/&amp;gt;   reverse -= _byteswap_uint64(smsk[sq].bitMask);&amp;lt;br/&amp;gt;   forward ^= _byteswap_uint64(reverse);&amp;lt;br/&amp;gt;   forward &amp;amp;amp;= smsk[sq].fileMaskEx;&amp;lt;br/&amp;gt;   return forward;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   return diagonalAttacks (occ, sq)&amp;lt;br/&amp;gt;        + antiDiagAttacks (occ, sq);&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 forward, reverse&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;diagonalMaskEx&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   reverse  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;forward&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitMask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   reverse &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitMask&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;reverse&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;diagonalMaskEx&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; forward&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 antiDiagAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 forward, reverse&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;antidiagMaskEx&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   reverse  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;forward&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitMask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   reverse &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitMask&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;reverse&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;antidiagMaskEx&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; forward&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 fileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 forward, reverse&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;fileMaskEx&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   reverse  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;forward&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitMask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   reverse &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;bitMask&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _byteswap_uint64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;reverse&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forward &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;fileMaskEx&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; forward&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; diagonalAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; antiDiagAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:94:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@ArrayOfStructs&amp;quot; title=&amp;quot;Anchor: ArrayOfStructs&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;ArrayOfStructs&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:94 --&gt;&lt;br /&gt;
For better locality of the &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board&quot;&gt;line-attacks&lt;/a&gt; on the otherwise empty board, we may use an properly aligned array of structs.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;struct&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   U64 bitMask;         // 1 &amp;amp;lt;&amp;amp;lt; sq for convenience&amp;lt;br/&amp;gt;   U64 diagonalMaskEx;&amp;lt;br/&amp;gt;   U64 antidiagMaskEx;&amp;lt;br/&amp;gt;   U64 fileMaskEx;&amp;lt;br/&amp;gt;} smsk[64]; // 2 KByte&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 bitMask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;         &lt;span class=&quot;co1&quot;&gt;// 1 &amp;lt;&amp;lt; sq for convenience&lt;/span&gt;
   U64 diagonalMaskEx&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 antidiagMaskEx&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 fileMaskEx&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; smsk&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 2 KByte&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;Using &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64#gpinstructions&quot;&gt;bswap&lt;/a&gt; makes it quite competitive for bishops and files, on &lt;a class=&quot;wiki_link&quot; href=&quot;/AMD&quot;&gt;AMD&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Athlon_64&quot; rel=&quot;nofollow&quot;&gt;K8&lt;/a&gt; or &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/AMD_K10&quot; rel=&quot;nofollow&quot;&gt;K10&lt;/a&gt; it has a latency of one cycle with a throughput of 1/3, like other cheap instructions. However, &lt;a class=&quot;wiki_link&quot; href=&quot;/Intel&quot;&gt;Intel&lt;/a&gt; is tad slower - while the recent &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Intel_Core_2&quot; rel=&quot;nofollow&quot;&gt;Core 2 duo&lt;/a&gt; processors perform 128-bit SIMD-instructions with 128-bit alus, that is bitwise logical instructions with a latency of one cycle and throughput of 1/3, the general purpose bswap-instruction takes four cycles with a throughput of one. In &lt;em&gt;Intel 64 and IA32 Architectures Optimization Reference Manual&lt;/em&gt; &lt;!-- ws:start:WikiTextRefRule:25:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.intel.com/assets/pdf/manual/248966.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Intel 64 and IA32 Architectures Optimization Reference Manual&amp;lt;/a&amp;gt; (pdf)&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:25 --&gt; , it is therefor recommend (5.6.5. endian conversion) to use the &lt;a class=&quot;wiki_link&quot; href=&quot;/SSSE3&quot;&gt;SSSE3&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/SSSE3#Pshufb&quot;&gt;pshufb&lt;/a&gt; instruction to swap bytes, available through intrinsic &lt;!-- ws:start:WikiTextRefRule:27:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://msdn.microsoft.com/en-us/library/bb531427.aspx&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;_mm_shuffle_epi8&amp;lt;/a&amp;gt; Visual C++ Developer Center - Run-Time Library Reference&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:27 --&gt; , see &lt;a class=&quot;wiki_link&quot; href=&quot;/SSSE3#SSSE3Version&quot;&gt;SSSE3 Hyperbola Quintessence&lt;/a&gt; for bishop attacks.&lt;br /&gt;
&lt;br /&gt;
As long there is no fast bit reversal instruction, there is no general solution for all four lines, and the rook attack-getter still needs some standard technique for the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#AttacksOnAllRanks&quot;&gt;rank-attacks&lt;/a&gt;. Tim Cooijmans proposed to map the rank to the main diagonal before applying HQ, and to re-map the calculated attacks back to the original rank &lt;!-- ws:start:WikiTextRefRule:30:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://timcooijmans.blogspot.co.uk/2014/04/hyperbola-quintessence-for-rooks-along.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Hyperbola Quintessence for rooks along ranks&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://www.blogger.com/profile/11033414990764447420&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Tim Cooijmans&amp;lt;/a&amp;gt;, April 6, 2014&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-6&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-6&quot;&gt;[6]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:30 --&gt; .&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:53:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Source Code-Generalized set-wise attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:53 --&gt;Generalized set-wise attacks&lt;/h2&gt;
 &lt;br /&gt;
Hyperbola quintessence can be generalized to work on whole sets of sliding pieces instead on individual pieces, whose ranks to be masked. The problem arising, when not masking the rank of the piece is that attacks wrap around the board during subtraction. This is shown below:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;     ........       ........                            11111111&amp;lt;br/&amp;gt;     ........       ........                            11111111&amp;lt;br/&amp;gt;     ........       ........                            11111111&amp;lt;br/&amp;gt; r = ........ , o = ........ this leads to   o - 2*r =  11111111&amp;lt;br/&amp;gt;     ........       ........                            11111111&amp;lt;br/&amp;gt;     ........       ........                            11111111&amp;lt;br/&amp;gt;     ....1...       ....1...                            11111...&amp;lt;br/&amp;gt;     ........       ........                            ........&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;instead of&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;........&amp;lt;br/&amp;gt;........&amp;lt;br/&amp;gt;........&amp;lt;br/&amp;gt;........&amp;lt;br/&amp;gt;........&amp;lt;br/&amp;gt;........&amp;lt;br/&amp;gt;11111...&amp;lt;br/&amp;gt;........&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;     ........       ........                            11111111
     ........       ........                            11111111
     ........       ........                            11111111
 r = ........ , o = ........ this leads to   o - 2*r =  11111111
     ........       ........                            11111111
     ........       ........                            11111111
     ....1...       ....1...                            11111...
     ........       ........                            ........
&amp;nbsp;
instead of
&amp;nbsp;
........
........
........
........
........
........
11111...
........&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;This is not the intended result. It can be avioded, by bitwise adding an overflow barrier on the right-hand side. Afterwards this barrier needs to be removed from the attack set:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;u64 right = 0x0101010101010101ULL;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;     ......1.      1..1..1.                              1...1111&amp;lt;br/&amp;gt;     ....1...      1...1...                              .1111..1&amp;lt;br/&amp;gt;     ......1.      11....1.                              1.111111&amp;lt;br/&amp;gt;r =  .....1..  o = .11..1..   now: ((o | right) - 2*r) = .1.111.1&amp;lt;br/&amp;gt;     ........      ........                              ........&amp;lt;br/&amp;gt;     ......1.      ......1.                              1111111.&amp;lt;br/&amp;gt;     .......1      .......1                              1111111.&amp;lt;br/&amp;gt;     1.......      1.......                              1......1&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Note, that the 4th rank was not flooded by the subtraction! Next, the blockers are removed as usual:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;                          ...111.1&amp;lt;br/&amp;gt;                          1111...1&amp;lt;br/&amp;gt;                          .11111.1&amp;lt;br/&amp;gt;o ^ ((o | right) - 2*r) = ..111..1&amp;lt;br/&amp;gt;                          ........&amp;lt;br/&amp;gt;                          111111..&amp;lt;br/&amp;gt;                          11111111&amp;lt;br/&amp;gt;                          .......1&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;The last step is to remove the barrier at the right side that became visible after the last operation.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;                                     ...111..&amp;lt;br/&amp;gt;                                     1111...&amp;lt;br/&amp;gt;                                     .11111..&amp;lt;br/&amp;gt;(o ^ ((o | right) - 2*r) &amp;amp;amp; ~right =  ..111...&amp;lt;br/&amp;gt;                                     ........&amp;lt;br/&amp;gt;                                     111111..&amp;lt;br/&amp;gt;                                     1111111.&amp;lt;br/&amp;gt;                                     ........&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;This is the correct attack set for the left direction.&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;u64 right = 0x0101010101010101ULL;
&amp;nbsp;
     ......1.      1..1..1.                              1...1111
     ....1...      1...1...                              .1111..1
     ......1.      11....1.                              1.111111
r =  .....1..  o = .11..1..   now: ((o | right) - 2*r) = .1.111.1
     ........      ........                              ........
     ......1.      ......1.                              1111111.
     .......1      .......1                              1111111.
     1.......      1.......                              1......1
&amp;nbsp;
Note, that the 4th rank was not flooded by the subtraction! Next, the blockers are removed as usual:
&amp;nbsp;
                          ...111.1
                          1111...1
                          .11111.1
o ^ ((o | right) - 2*r) = ..111..1
                          ........
                          111111..
                          11111111
                          .......1
&amp;nbsp;
The last step is to remove the barrier at the right side that became visible after the last operation.
&amp;nbsp;
                                     ...111..
                                     1111...
                                     .11111..
(o ^ ((o | right) - 2*r) &amp;amp; ~right =  ..111...
                                     ........
                                     111111..
                                     1111111.
                                     ........
&amp;nbsp;
This is the correct attack set for the left direction.
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;the complete algorithm for the left direction is therefore:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;const u64 right = 0x0101010101010101ULL;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;u64 leftAttacks = ((o ^ ((o | right) - 2*r) &amp;amp;amp; ~right);&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;const u64 right = 0x0101010101010101ULL;
&amp;nbsp;
u64 leftAttacks = ((o ^ ((o | right) - 2*r) &amp;amp; ~right);&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;For the right-hand direction, the bits need to be reversed rank-wise.&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:55:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Source Code-x86-64 assembly&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:55 --&gt;x86-64 assembly&lt;/h2&gt;
 The VC2005 generated &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64&quot;&gt;x86-64&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Assembly&quot;&gt;assembly&lt;/a&gt; of bishopAttacks indicates what &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Instructions_Per_Cycle&quot; rel=&quot;nofollow&quot;&gt;ipc&lt;/a&gt;-monster Hyperbola Quintessence is:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;occ$ = 16&amp;lt;br/&amp;gt;sq$ = 24&amp;lt;br/&amp;gt;?bishopAttacks@@YA_K_KI@Z PROC&amp;lt;br/&amp;gt;  00000   40 53                push    rbx&amp;lt;br/&amp;gt;  00002   8b c2                mov    eax, edx&amp;lt;br/&amp;gt;  00004   4c 8d 15 00 00 00 00 lea    r10, OFFSET FLAT:?smsk&amp;lt;br/&amp;gt;  0000b   48 c1 e0 05          shl    rax, 5&amp;lt;br/&amp;gt;  0000f   4a 8b 5c 10 08       mov    rbx, QWORD PTR [rax+r10+8]  ; diagonalMaskEx&amp;lt;br/&amp;gt;  00014   4e 8b 4c 10 10       mov    r9,  QWORD PTR [rax+r10+16] ; antidiagMaskEx&amp;lt;br/&amp;gt;  00019   4e 8b 14 10          mov    r10, QWORD PTR [rax+r10]    ; r := 1 &amp;amp;lt;&amp;amp;lt; sq&amp;lt;br/&amp;gt;  0001d   4c 8b db             mov    r11, rbx                    ; diagonalMaskEx&amp;lt;br/&amp;gt;  00020   49 8b d1             mov    rdx, r9                     ; antidiagMaskEx&amp;lt;br/&amp;gt;  00023   4d 8b c2             mov    r8, r10                     ; r := 1 &amp;amp;lt;&amp;amp;lt; sq&amp;lt;br/&amp;gt;  00026   48 23 d1             and    rdx, rcx                    ; anti &amp;amp;amp; occ&amp;lt;br/&amp;gt;  00029   4c 23 d9             and    r11, rcx                    ; dia  &amp;amp;amp; occ&amp;lt;br/&amp;gt;  0002c   49 0f c8             bswap  r8                          ; r&#039;&amp;lt;br/&amp;gt;  0002f   48 8b c2             mov    rax, rdx                    ; ant&amp;lt;br/&amp;gt;  00032   49 8b cb             mov    rcx, r11                    ; dia&amp;lt;br/&amp;gt;  00035   49 2b d2             sub    rdx, r10                    ; ant - r&amp;lt;br/&amp;gt;  00038   48 0f c8             bswap  rax                         ; ant&#039;&amp;lt;br/&amp;gt;  0003b   48 0f c9             bswap  rcx                         ; dia&#039;&amp;lt;br/&amp;gt;  0003e   4d 2b da             sub    r11, r10                    ; dia - r&amp;lt;br/&amp;gt;  00041   49 2b c0             sub    rax, r8                     ; ant&#039; - r&#039;&amp;lt;br/&amp;gt;  00044   49 2b c8             sub    rcx, r8                     ; dia&#039; - r&#039;&amp;lt;br/&amp;gt;  00047   48 0f c8             bswap  rax                         ;(ant&#039; - r&#039;)&#039;&amp;lt;br/&amp;gt;  0004a   48 0f c9             bswap  rcx                         ;(dia&#039; - r&#039;)&#039;&amp;lt;br/&amp;gt;  0004d   48 33 c2             xor    rax, rdx                    ; ant := (ant&#039; - r&#039;)&#039; ^ (ant - r)&amp;lt;br/&amp;gt;  00050   49 33 cb             xor    rcx, r11                    ; dia := (dia&#039; - r&#039;)&#039; ^ (dia - r)&amp;lt;br/&amp;gt;  00053   49 23 c1             and    rax, r9                     ; ant &amp;amp;amp;= antidiagMaskEx&amp;lt;br/&amp;gt;  00056   48 23 cb             and    rcx, rbx                    ; dia &amp;amp;amp;= diagonalMaskEx&amp;lt;br/&amp;gt;  00059   48 03 c1             add    rax, rcx                    ; attacks := dia + ant&amp;lt;br/&amp;gt;  0005c   5b                   pop    rbx&amp;lt;br/&amp;gt;  0005d   c3                   ret    0&amp;lt;br/&amp;gt;?bishopAttacks@@YA_K_KI@Z ENDP&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;occ$ = 16
sq$ = 24
?bishopAttacks@@YA_K_KI@Z PROC
  00000   40 53                push    rbx
  00002   8b c2                mov    eax, edx
  00004   4c 8d 15 00 00 00 00 lea    r10, OFFSET FLAT:?smsk
  0000b   48 c1 e0 05          shl    rax, 5
  0000f   4a 8b 5c 10 08       mov    rbx, QWORD PTR [rax+r10+8]  ; diagonalMaskEx
  00014   4e 8b 4c 10 10       mov    r9,  QWORD PTR [rax+r10+16] ; antidiagMaskEx
  00019   4e 8b 14 10          mov    r10, QWORD PTR [rax+r10]    ; r := 1 &amp;lt;&amp;lt; sq
  0001d   4c 8b db             mov    r11, rbx                    ; diagonalMaskEx
  00020   49 8b d1             mov    rdx, r9                     ; antidiagMaskEx
  00023   4d 8b c2             mov    r8, r10                     ; r := 1 &amp;lt;&amp;lt; sq
  00026   48 23 d1             and    rdx, rcx                    ; anti &amp;amp; occ
  00029   4c 23 d9             and    r11, rcx                    ; dia  &amp;amp; occ
  0002c   49 0f c8             bswap  r8                          ; r&#039;
  0002f   48 8b c2             mov    rax, rdx                    ; ant
  00032   49 8b cb             mov    rcx, r11                    ; dia
  00035   49 2b d2             sub    rdx, r10                    ; ant - r
  00038   48 0f c8             bswap  rax                         ; ant&#039;
  0003b   48 0f c9             bswap  rcx                         ; dia&#039;
  0003e   4d 2b da             sub    r11, r10                    ; dia - r
  00041   49 2b c0             sub    rax, r8                     ; ant&#039; - r&#039;
  00044   49 2b c8             sub    rcx, r8                     ; dia&#039; - r&#039;
  00047   48 0f c8             bswap  rax                         ;(ant&#039; - r&#039;)&#039;
  0004a   48 0f c9             bswap  rcx                         ;(dia&#039; - r&#039;)&#039;
  0004d   48 33 c2             xor    rax, rdx                    ; ant := (ant&#039; - r&#039;)&#039; ^ (ant - r)
  00050   49 33 cb             xor    rcx, r11                    ; dia := (dia&#039; - r&#039;)&#039; ^ (dia - r)
  00053   49 23 c1             and    rax, r9                     ; ant &amp;amp;= antidiagMaskEx
  00056   48 23 cb             and    rcx, rbx                    ; dia &amp;amp;= diagonalMaskEx
  00059   48 03 c1             add    rax, rcx                    ; attacks := dia + ant
  0005c   5b                   pop    rbx
  0005d   c3                   ret    0
?bishopAttacks@@YA_K_KI@Z ENDP&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:9 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:95:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Java&amp;quot; title=&amp;quot;Anchor: Java&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Java&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:95 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:57:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Source Code-Java&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:57 --&gt;Java&lt;/h2&gt;
 &lt;a class=&quot;wiki_link&quot; href=&quot;/Java&quot;&gt;Java&lt;/a&gt; programmer may try &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Long.html#reverseBytes%28long%29&quot; rel=&quot;nofollow&quot;&gt;Long.reverseBytes&lt;/a&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;java5&amp;quot;&amp;gt;    static private final long[] bitMask = {&amp;lt;br/&amp;gt;        0x0000000000000001, 0x0000000000000002, 0x0000000000000004, 0x0000000000000008,&amp;lt;br/&amp;gt;        0x0000000000000010, 0x0000000000000020, 0x0000000000000040, 0x0000000000000080,&amp;lt;br/&amp;gt;        ...&amp;lt;br/&amp;gt;    };&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;    static private final long[] diagonalMaskEx = {&amp;lt;br/&amp;gt;        0x8040201008040200, 0x0080402010080400, 0x0000804020100800, 0x0000008040201000,&amp;lt;br/&amp;gt;        0x0000000080402000, 0x0000000000804000, 0x0000000000008000, 0x0000000000000000,&amp;lt;br/&amp;gt;        ...&amp;lt;br/&amp;gt;    };&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;    /**&amp;lt;br/&amp;gt;     * @param occ - occupancy&amp;lt;br/&amp;gt;     *        sq  - from square&amp;lt;br/&amp;gt;     * @return diagonal attacks from sq with occupancy occ&amp;lt;br/&amp;gt;     */&amp;lt;br/&amp;gt;    static public long diagonalAttacks(long occ, int sq)&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;       long forward = occ &amp;amp;amp; diagonalMaskEx[sq];&amp;lt;br/&amp;gt;       long reverse = Long.reverseBytes(forward);&amp;lt;br/&amp;gt;       forward -= bitMask[sq];&amp;lt;br/&amp;gt;       reverse -= bitMask[sq^56];&amp;lt;br/&amp;gt;       forward ^= Long.reverseBytes(reverse);&amp;lt;br/&amp;gt;       forward &amp;amp;amp;= diagonalMaskEx[sq];&amp;lt;br/&amp;gt;       return forward;&amp;lt;br/&amp;gt;    }&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.java5  {font-family:monospace;}
.java5 .imp {font-weight: bold; color: red;}
.java5 .kw1 {color: #000000;  font-weight: bold;}
.java5 .kw2 {color: #000000; font-weight: bold;}
.java5 .kw3 {color: #006600; font-weight: bold;}
.java5 .kw4 {color: #006600; font-weight: bold;}
.java5 .kw5 {color: #003399; font-weight: bold;}
.java5 .kw6 {color: #003399; font-weight: bold;}
.java5 .kw7 {color: #003399; font-weight: bold;}
.java5 .kw8 {color: #003399; font-weight: bold;}
.java5 .kw9 {color: #003399; font-weight: bold;}
.java5 .kw10 {color: #003399; font-weight: bold;}
.java5 .kw11 {color: #003399; font-weight: bold;}
.java5 .kw12 {color: #003399; font-weight: bold;}
.java5 .kw13 {color: #003399; font-weight: bold;}
.java5 .kw14 {color: #003399; font-weight: bold;}
.java5 .kw15 {color: #003399; font-weight: bold;}
.java5 .kw16 {color: #003399; font-weight: bold;}
.java5 .kw17 {color: #003399; font-weight: bold;}
.java5 .kw18 {color: #003399; font-weight: bold;}
.java5 .kw19 {color: #003399; font-weight: bold;}
.java5 .kw20 {color: #003399; font-weight: bold;}
.java5 .kw21 {color: #003399; font-weight: bold;}
.java5 .kw22 {color: #003399; font-weight: bold;}
.java5 .kw23 {color: #003399; font-weight: bold;}
.java5 .kw24 {color: #003399; font-weight: bold;}
.java5 .kw25 {color: #003399; font-weight: bold;}
.java5 .kw26 {color: #003399; font-weight: bold;}
.java5 .kw27 {color: #003399; font-weight: bold;}
.java5 .kw28 {color: #003399; font-weight: bold;}
.java5 .kw29 {color: #003399; font-weight: bold;}
.java5 .kw30 {color: #003399; font-weight: bold;}
.java5 .kw31 {color: #003399; font-weight: bold;}
.java5 .kw32 {color: #003399; font-weight: bold;}
.java5 .kw33 {color: #003399; font-weight: bold;}
.java5 .kw34 {color: #003399; font-weight: bold;}
.java5 .kw35 {color: #003399; font-weight: bold;}
.java5 .kw36 {color: #003399; font-weight: bold;}
.java5 .kw37 {color: #003399; font-weight: bold;}
.java5 .kw38 {color: #003399; font-weight: bold;}
.java5 .kw39 {color: #003399; font-weight: bold;}
.java5 .kw40 {color: #003399; font-weight: bold;}
.java5 .kw41 {color: #003399; font-weight: bold;}
.java5 .kw42 {color: #003399; font-weight: bold;}
.java5 .kw43 {color: #003399; font-weight: bold;}
.java5 .kw44 {color: #003399; font-weight: bold;}
.java5 .kw45 {color: #003399; font-weight: bold;}
.java5 .kw46 {color: #003399; font-weight: bold;}
.java5 .kw47 {color: #003399; font-weight: bold;}
.java5 .kw48 {color: #003399; font-weight: bold;}
.java5 .kw49 {color: #003399; font-weight: bold;}
.java5 .kw50 {color: #003399; font-weight: bold;}
.java5 .kw51 {color: #003399; font-weight: bold;}
.java5 .kw52 {color: #003399; font-weight: bold;}
.java5 .kw53 {color: #003399; font-weight: bold;}
.java5 .kw54 {color: #003399; font-weight: bold;}
.java5 .kw55 {color: #003399; font-weight: bold;}
.java5 .kw56 {color: #003399; font-weight: bold;}
.java5 .kw57 {color: #003399; font-weight: bold;}
.java5 .kw58 {color: #003399; font-weight: bold;}
.java5 .kw59 {color: #003399; font-weight: bold;}
.java5 .kw60 {color: #003399; font-weight: bold;}
.java5 .kw61 {color: #003399; font-weight: bold;}
.java5 .kw62 {color: #003399; font-weight: bold;}
.java5 .kw63 {color: #003399; font-weight: bold;}
.java5 .kw64 {color: #003399; font-weight: bold;}
.java5 .kw65 {color: #003399; font-weight: bold;}
.java5 .kw66 {color: #003399; font-weight: bold;}
.java5 .kw67 {color: #003399; font-weight: bold;}
.java5 .kw68 {color: #003399; font-weight: bold;}
.java5 .kw69 {color: #003399; font-weight: bold;}
.java5 .kw70 {color: #003399; font-weight: bold;}
.java5 .kw71 {color: #003399; font-weight: bold;}
.java5 .kw72 {color: #003399; font-weight: bold;}
.java5 .kw73 {color: #003399; font-weight: bold;}
.java5 .kw74 {color: #003399; font-weight: bold;}
.java5 .kw75 {color: #003399; font-weight: bold;}
.java5 .kw76 {color: #003399; font-weight: bold;}
.java5 .kw77 {color: #003399; font-weight: bold;}
.java5 .kw78 {color: #003399; font-weight: bold;}
.java5 .kw79 {color: #003399; font-weight: bold;}
.java5 .kw80 {color: #003399; font-weight: bold;}
.java5 .kw81 {color: #003399; font-weight: bold;}
.java5 .kw82 {color: #003399; font-weight: bold;}
.java5 .kw83 {color: #003399; font-weight: bold;}
.java5 .kw84 {color: #003399; font-weight: bold;}
.java5 .kw85 {color: #003399; font-weight: bold;}
.java5 .kw86 {color: #003399; font-weight: bold;}
.java5 .kw87 {color: #003399; font-weight: bold;}
.java5 .kw88 {color: #003399; font-weight: bold;}
.java5 .kw89 {color: #003399; font-weight: bold;}
.java5 .kw90 {color: #003399; font-weight: bold;}
.java5 .kw91 {color: #003399; font-weight: bold;}
.java5 .kw92 {color: #003399; font-weight: bold;}
.java5 .kw93 {color: #003399; font-weight: bold;}
.java5 .kw94 {color: #003399; font-weight: bold;}
.java5 .kw95 {color: #003399; font-weight: bold;}
.java5 .kw96 {color: #003399; font-weight: bold;}
.java5 .kw97 {color: #003399; font-weight: bold;}
.java5 .kw98 {color: #003399; font-weight: bold;}
.java5 .kw99 {color: #003399; font-weight: bold;}
.java5 .kw100 {color: #003399; font-weight: bold;}
.java5 .kw101 {color: #003399; font-weight: bold;}
.java5 .kw102 {color: #003399; font-weight: bold;}
.java5 .kw103 {color: #003399; font-weight: bold;}
.java5 .kw104 {color: #003399; font-weight: bold;}
.java5 .kw105 {color: #003399; font-weight: bold;}
.java5 .kw106 {color: #003399; font-weight: bold;}
.java5 .kw107 {color: #003399; font-weight: bold;}
.java5 .kw108 {color: #003399; font-weight: bold;}
.java5 .kw109 {color: #003399; font-weight: bold;}
.java5 .kw110 {color: #003399; font-weight: bold;}
.java5 .kw111 {color: #003399; font-weight: bold;}
.java5 .kw112 {color: #003399; font-weight: bold;}
.java5 .kw113 {color: #003399; font-weight: bold;}
.java5 .kw114 {color: #003399; font-weight: bold;}
.java5 .kw115 {color: #003399; font-weight: bold;}
.java5 .kw116 {color: #003399; font-weight: bold;}
.java5 .kw117 {color: #003399; font-weight: bold;}
.java5 .kw118 {color: #003399; font-weight: bold;}
.java5 .kw119 {color: #003399; font-weight: bold;}
.java5 .kw120 {color: #003399; font-weight: bold;}
.java5 .kw121 {color: #003399; font-weight: bold;}
.java5 .kw122 {color: #003399; font-weight: bold;}
.java5 .kw123 {color: #003399; font-weight: bold;}
.java5 .kw124 {color: #003399; font-weight: bold;}
.java5 .kw125 {color: #003399; font-weight: bold;}
.java5 .kw126 {color: #003399; font-weight: bold;}
.java5 .kw127 {color: #003399; font-weight: bold;}
.java5 .kw128 {color: #003399; font-weight: bold;}
.java5 .kw129 {color: #003399; font-weight: bold;}
.java5 .kw130 {color: #003399; font-weight: bold;}
.java5 .kw131 {color: #003399; font-weight: bold;}
.java5 .kw132 {color: #003399; font-weight: bold;}
.java5 .kw133 {color: #003399; font-weight: bold;}
.java5 .kw134 {color: #003399; font-weight: bold;}
.java5 .kw135 {color: #003399; font-weight: bold;}
.java5 .kw136 {color: #003399; font-weight: bold;}
.java5 .kw137 {color: #003399; font-weight: bold;}
.java5 .kw138 {color: #003399; font-weight: bold;}
.java5 .kw139 {color: #003399; font-weight: bold;}
.java5 .kw140 {color: #003399; font-weight: bold;}
.java5 .kw141 {color: #003399; font-weight: bold;}
.java5 .kw142 {color: #003399; font-weight: bold;}
.java5 .kw143 {color: #003399; font-weight: bold;}
.java5 .kw144 {color: #003399; font-weight: bold;}
.java5 .kw145 {color: #003399; font-weight: bold;}
.java5 .kw146 {color: #003399; font-weight: bold;}
.java5 .kw147 {color: #003399; font-weight: bold;}
.java5 .kw148 {color: #003399; font-weight: bold;}
.java5 .kw149 {color: #003399; font-weight: bold;}
.java5 .kw150 {color: #003399; font-weight: bold;}
.java5 .kw151 {color: #003399; font-weight: bold;}
.java5 .kw152 {color: #003399; font-weight: bold;}
.java5 .kw153 {color: #003399; font-weight: bold;}
.java5 .kw154 {color: #003399; font-weight: bold;}
.java5 .kw155 {color: #003399; font-weight: bold;}
.java5 .kw156 {color: #003399; font-weight: bold;}
.java5 .kw157 {color: #003399; font-weight: bold;}
.java5 .kw158 {color: #003399; font-weight: bold;}
.java5 .kw159 {color: #003399; font-weight: bold;}
.java5 .kw160 {color: #003399; font-weight: bold;}
.java5 .kw161 {color: #003399; font-weight: bold;}
.java5 .kw162 {color: #003399; font-weight: bold;}
.java5 .kw163 {color: #003399; font-weight: bold;}
.java5 .kw164 {color: #003399; font-weight: bold;}
.java5 .kw165 {color: #003399; font-weight: bold;}
.java5 .kw166 {color: #003399; font-weight: bold;}
.java5 .co1 {color: #666666; font-style: italic;}
.java5 .co2 {color: #006699;}
.java5 .co3 {color: #008000; font-style: italic; font-weight: bold;}
.java5 .coMULTI {color: #666666; font-style: italic;}
.java5 .es0 {color: #000099; font-weight: bold;}
.java5 .br0 {color: #009900;}
.java5 .sy0 {color: #339933;}
.java5 .st0 {color: #0000ff;}
.java5 .nu0 {color: #cc66cc;}
.java5 .me1 {color: #006633;}
.java5 .me2 {color: #006633;}
.java5 span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;java5&quot;&gt;    &lt;span class=&quot;kw2&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; bitMask = &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        0x0000000000000001, 0x0000000000000002, 0x0000000000000004, 0x0000000000000008,
        0x0000000000000010, 0x0000000000000020, 0x0000000000000040, 0x0000000000000080,
        ...
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw2&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; diagonalMaskEx = &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
        0x8040201008040200, 0x0080402010080400, 0x0000804020100800, 0x0000008040201000,
        0x0000000080402000, 0x0000000000804000, 0x0000000000008000, 0x0000000000000000,
        ...
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;co3&quot;&gt;/**
     * @param occ - occupancy
     *        sq  - from square
     * @return diagonal attacks from sq with occupancy occ
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; occ, &lt;span class=&quot;kw3&quot;&gt;int&lt;/span&gt; sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
       &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; forward = occ &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt; diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; reverse = &lt;a href=&quot;http://java.sun.com/j2se/1%2E5%2E0/docs/api/java/lang/Long.html&quot;&gt;&lt;span class=&quot;kw21&quot;&gt;Long&lt;/span&gt;&lt;/a&gt;.&lt;span class=&quot;me1&quot;&gt;reverseBytes&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;forward&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       forward -= bitMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       reverse -= bitMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq^&lt;span class=&quot;nu0&quot;&gt;56&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       forward ^= &lt;a href=&quot;http://java.sun.com/j2se/1%2E5%2E0/docs/api/java/lang/Long.html&quot;&gt;&lt;span class=&quot;kw21&quot;&gt;Long&lt;/span&gt;&lt;/a&gt;.&lt;span class=&quot;me1&quot;&gt;reverseBytes&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;reverse&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       forward &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;= diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; forward&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Long.html#reverse%28long%29&quot; rel=&quot;nofollow&quot;&gt;Long.reverse&lt;/a&gt; for a generalized attack getter even for ranks is too expensive, except a &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Java_Virtual_Machine&quot; rel=&quot;nofollow&quot;&gt;JVM&lt;/a&gt; can use a machine instruction rather than a &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#Rotationby180degrees&quot;&gt;bit-reversal&lt;/a&gt; routine:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:11:
&amp;lt;pre class=&amp;quot;java5&amp;quot;&amp;gt;    /**&amp;lt;br/&amp;gt;     * @param occ  - occupancy&amp;lt;br/&amp;gt;     *        line - {0..3} {rank, file, diagonal, antidiagonal}&amp;lt;br/&amp;gt;     *        sq   - from square&amp;lt;br/&amp;gt;     * @return attacks from sq on line with occupancy occ&amp;lt;br/&amp;gt;     */&amp;lt;br/&amp;gt;    static public long attacks(long occ, int line, int sq)&amp;lt;br/&amp;gt;    {&amp;lt;br/&amp;gt;       long forward = occ &amp;amp;amp; maskEx[sq][line];&amp;lt;br/&amp;gt;       long reverse = Long.reverse(forward);&amp;lt;br/&amp;gt;       forward -= bitMask[sq];&amp;lt;br/&amp;gt;       reverse -= bitMask[sq^63];&amp;lt;br/&amp;gt;       forward ^= Long.reverse(reverse);&amp;lt;br/&amp;gt;       forward &amp;amp;amp;= maskEx[sq][line];&amp;lt;br/&amp;gt;       return forward;&amp;lt;br/&amp;gt;    }&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.java5  {font-family:monospace;}
.java5 .imp {font-weight: bold; color: red;}
.java5 .kw1 {color: #000000;  font-weight: bold;}
.java5 .kw2 {color: #000000; font-weight: bold;}
.java5 .kw3 {color: #006600; font-weight: bold;}
.java5 .kw4 {color: #006600; font-weight: bold;}
.java5 .kw5 {color: #003399; font-weight: bold;}
.java5 .kw6 {color: #003399; font-weight: bold;}
.java5 .kw7 {color: #003399; font-weight: bold;}
.java5 .kw8 {color: #003399; font-weight: bold;}
.java5 .kw9 {color: #003399; font-weight: bold;}
.java5 .kw10 {color: #003399; font-weight: bold;}
.java5 .kw11 {color: #003399; font-weight: bold;}
.java5 .kw12 {color: #003399; font-weight: bold;}
.java5 .kw13 {color: #003399; font-weight: bold;}
.java5 .kw14 {color: #003399; font-weight: bold;}
.java5 .kw15 {color: #003399; font-weight: bold;}
.java5 .kw16 {color: #003399; font-weight: bold;}
.java5 .kw17 {color: #003399; font-weight: bold;}
.java5 .kw18 {color: #003399; font-weight: bold;}
.java5 .kw19 {color: #003399; font-weight: bold;}
.java5 .kw20 {color: #003399; font-weight: bold;}
.java5 .kw21 {color: #003399; font-weight: bold;}
.java5 .kw22 {color: #003399; font-weight: bold;}
.java5 .kw23 {color: #003399; font-weight: bold;}
.java5 .kw24 {color: #003399; font-weight: bold;}
.java5 .kw25 {color: #003399; font-weight: bold;}
.java5 .kw26 {color: #003399; font-weight: bold;}
.java5 .kw27 {color: #003399; font-weight: bold;}
.java5 .kw28 {color: #003399; font-weight: bold;}
.java5 .kw29 {color: #003399; font-weight: bold;}
.java5 .kw30 {color: #003399; font-weight: bold;}
.java5 .kw31 {color: #003399; font-weight: bold;}
.java5 .kw32 {color: #003399; font-weight: bold;}
.java5 .kw33 {color: #003399; font-weight: bold;}
.java5 .kw34 {color: #003399; font-weight: bold;}
.java5 .kw35 {color: #003399; font-weight: bold;}
.java5 .kw36 {color: #003399; font-weight: bold;}
.java5 .kw37 {color: #003399; font-weight: bold;}
.java5 .kw38 {color: #003399; font-weight: bold;}
.java5 .kw39 {color: #003399; font-weight: bold;}
.java5 .kw40 {color: #003399; font-weight: bold;}
.java5 .kw41 {color: #003399; font-weight: bold;}
.java5 .kw42 {color: #003399; font-weight: bold;}
.java5 .kw43 {color: #003399; font-weight: bold;}
.java5 .kw44 {color: #003399; font-weight: bold;}
.java5 .kw45 {color: #003399; font-weight: bold;}
.java5 .kw46 {color: #003399; font-weight: bold;}
.java5 .kw47 {color: #003399; font-weight: bold;}
.java5 .kw48 {color: #003399; font-weight: bold;}
.java5 .kw49 {color: #003399; font-weight: bold;}
.java5 .kw50 {color: #003399; font-weight: bold;}
.java5 .kw51 {color: #003399; font-weight: bold;}
.java5 .kw52 {color: #003399; font-weight: bold;}
.java5 .kw53 {color: #003399; font-weight: bold;}
.java5 .kw54 {color: #003399; font-weight: bold;}
.java5 .kw55 {color: #003399; font-weight: bold;}
.java5 .kw56 {color: #003399; font-weight: bold;}
.java5 .kw57 {color: #003399; font-weight: bold;}
.java5 .kw58 {color: #003399; font-weight: bold;}
.java5 .kw59 {color: #003399; font-weight: bold;}
.java5 .kw60 {color: #003399; font-weight: bold;}
.java5 .kw61 {color: #003399; font-weight: bold;}
.java5 .kw62 {color: #003399; font-weight: bold;}
.java5 .kw63 {color: #003399; font-weight: bold;}
.java5 .kw64 {color: #003399; font-weight: bold;}
.java5 .kw65 {color: #003399; font-weight: bold;}
.java5 .kw66 {color: #003399; font-weight: bold;}
.java5 .kw67 {color: #003399; font-weight: bold;}
.java5 .kw68 {color: #003399; font-weight: bold;}
.java5 .kw69 {color: #003399; font-weight: bold;}
.java5 .kw70 {color: #003399; font-weight: bold;}
.java5 .kw71 {color: #003399; font-weight: bold;}
.java5 .kw72 {color: #003399; font-weight: bold;}
.java5 .kw73 {color: #003399; font-weight: bold;}
.java5 .kw74 {color: #003399; font-weight: bold;}
.java5 .kw75 {color: #003399; font-weight: bold;}
.java5 .kw76 {color: #003399; font-weight: bold;}
.java5 .kw77 {color: #003399; font-weight: bold;}
.java5 .kw78 {color: #003399; font-weight: bold;}
.java5 .kw79 {color: #003399; font-weight: bold;}
.java5 .kw80 {color: #003399; font-weight: bold;}
.java5 .kw81 {color: #003399; font-weight: bold;}
.java5 .kw82 {color: #003399; font-weight: bold;}
.java5 .kw83 {color: #003399; font-weight: bold;}
.java5 .kw84 {color: #003399; font-weight: bold;}
.java5 .kw85 {color: #003399; font-weight: bold;}
.java5 .kw86 {color: #003399; font-weight: bold;}
.java5 .kw87 {color: #003399; font-weight: bold;}
.java5 .kw88 {color: #003399; font-weight: bold;}
.java5 .kw89 {color: #003399; font-weight: bold;}
.java5 .kw90 {color: #003399; font-weight: bold;}
.java5 .kw91 {color: #003399; font-weight: bold;}
.java5 .kw92 {color: #003399; font-weight: bold;}
.java5 .kw93 {color: #003399; font-weight: bold;}
.java5 .kw94 {color: #003399; font-weight: bold;}
.java5 .kw95 {color: #003399; font-weight: bold;}
.java5 .kw96 {color: #003399; font-weight: bold;}
.java5 .kw97 {color: #003399; font-weight: bold;}
.java5 .kw98 {color: #003399; font-weight: bold;}
.java5 .kw99 {color: #003399; font-weight: bold;}
.java5 .kw100 {color: #003399; font-weight: bold;}
.java5 .kw101 {color: #003399; font-weight: bold;}
.java5 .kw102 {color: #003399; font-weight: bold;}
.java5 .kw103 {color: #003399; font-weight: bold;}
.java5 .kw104 {color: #003399; font-weight: bold;}
.java5 .kw105 {color: #003399; font-weight: bold;}
.java5 .kw106 {color: #003399; font-weight: bold;}
.java5 .kw107 {color: #003399; font-weight: bold;}
.java5 .kw108 {color: #003399; font-weight: bold;}
.java5 .kw109 {color: #003399; font-weight: bold;}
.java5 .kw110 {color: #003399; font-weight: bold;}
.java5 .kw111 {color: #003399; font-weight: bold;}
.java5 .kw112 {color: #003399; font-weight: bold;}
.java5 .kw113 {color: #003399; font-weight: bold;}
.java5 .kw114 {color: #003399; font-weight: bold;}
.java5 .kw115 {color: #003399; font-weight: bold;}
.java5 .kw116 {color: #003399; font-weight: bold;}
.java5 .kw117 {color: #003399; font-weight: bold;}
.java5 .kw118 {color: #003399; font-weight: bold;}
.java5 .kw119 {color: #003399; font-weight: bold;}
.java5 .kw120 {color: #003399; font-weight: bold;}
.java5 .kw121 {color: #003399; font-weight: bold;}
.java5 .kw122 {color: #003399; font-weight: bold;}
.java5 .kw123 {color: #003399; font-weight: bold;}
.java5 .kw124 {color: #003399; font-weight: bold;}
.java5 .kw125 {color: #003399; font-weight: bold;}
.java5 .kw126 {color: #003399; font-weight: bold;}
.java5 .kw127 {color: #003399; font-weight: bold;}
.java5 .kw128 {color: #003399; font-weight: bold;}
.java5 .kw129 {color: #003399; font-weight: bold;}
.java5 .kw130 {color: #003399; font-weight: bold;}
.java5 .kw131 {color: #003399; font-weight: bold;}
.java5 .kw132 {color: #003399; font-weight: bold;}
.java5 .kw133 {color: #003399; font-weight: bold;}
.java5 .kw134 {color: #003399; font-weight: bold;}
.java5 .kw135 {color: #003399; font-weight: bold;}
.java5 .kw136 {color: #003399; font-weight: bold;}
.java5 .kw137 {color: #003399; font-weight: bold;}
.java5 .kw138 {color: #003399; font-weight: bold;}
.java5 .kw139 {color: #003399; font-weight: bold;}
.java5 .kw140 {color: #003399; font-weight: bold;}
.java5 .kw141 {color: #003399; font-weight: bold;}
.java5 .kw142 {color: #003399; font-weight: bold;}
.java5 .kw143 {color: #003399; font-weight: bold;}
.java5 .kw144 {color: #003399; font-weight: bold;}
.java5 .kw145 {color: #003399; font-weight: bold;}
.java5 .kw146 {color: #003399; font-weight: bold;}
.java5 .kw147 {color: #003399; font-weight: bold;}
.java5 .kw148 {color: #003399; font-weight: bold;}
.java5 .kw149 {color: #003399; font-weight: bold;}
.java5 .kw150 {color: #003399; font-weight: bold;}
.java5 .kw151 {color: #003399; font-weight: bold;}
.java5 .kw152 {color: #003399; font-weight: bold;}
.java5 .kw153 {color: #003399; font-weight: bold;}
.java5 .kw154 {color: #003399; font-weight: bold;}
.java5 .kw155 {color: #003399; font-weight: bold;}
.java5 .kw156 {color: #003399; font-weight: bold;}
.java5 .kw157 {color: #003399; font-weight: bold;}
.java5 .kw158 {color: #003399; font-weight: bold;}
.java5 .kw159 {color: #003399; font-weight: bold;}
.java5 .kw160 {color: #003399; font-weight: bold;}
.java5 .kw161 {color: #003399; font-weight: bold;}
.java5 .kw162 {color: #003399; font-weight: bold;}
.java5 .kw163 {color: #003399; font-weight: bold;}
.java5 .kw164 {color: #003399; font-weight: bold;}
.java5 .kw165 {color: #003399; font-weight: bold;}
.java5 .kw166 {color: #003399; font-weight: bold;}
.java5 .co1 {color: #666666; font-style: italic;}
.java5 .co2 {color: #006699;}
.java5 .co3 {color: #008000; font-style: italic; font-weight: bold;}
.java5 .coMULTI {color: #666666; font-style: italic;}
.java5 .es0 {color: #000099; font-weight: bold;}
.java5 .br0 {color: #009900;}
.java5 .sy0 {color: #339933;}
.java5 .st0 {color: #0000ff;}
.java5 .nu0 {color: #cc66cc;}
.java5 .me1 {color: #006633;}
.java5 .me2 {color: #006633;}
.java5 span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;java5&quot;&gt;    &lt;span class=&quot;co3&quot;&gt;/**
     * @param occ  - occupancy
     *        line - {0..3} {rank, file, diagonal, antidiagonal}
     *        sq   - from square
     * @return attacks from sq on line with occupancy occ
     */&lt;/span&gt;
    &lt;span class=&quot;kw2&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; attacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; occ, &lt;span class=&quot;kw3&quot;&gt;int&lt;/span&gt; line, &lt;span class=&quot;kw3&quot;&gt;int&lt;/span&gt; sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
       &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; forward = occ &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt; maskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;line&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; reverse = &lt;a href=&quot;http://java.sun.com/j2se/1%2E5%2E0/docs/api/java/lang/Long.html&quot;&gt;&lt;span class=&quot;kw21&quot;&gt;Long&lt;/span&gt;&lt;/a&gt;.&lt;span class=&quot;me1&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;forward&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       forward -= bitMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       reverse -= bitMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq^&lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       forward ^= &lt;a href=&quot;http://java.sun.com/j2se/1%2E5%2E0/docs/api/java/lang/Long.html&quot;&gt;&lt;span class=&quot;kw21&quot;&gt;Long&lt;/span&gt;&lt;/a&gt;.&lt;span class=&quot;me1&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;reverse&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       forward &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;= maskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;line&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; forward&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:11 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:59:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc6&quot;&gt;&lt;a name=&quot;AMD&#039;s SIMD Future in 2011&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:59 --&gt;AMD&#039;s SIMD Future in 2011&lt;/h1&gt;
 In 2007 &lt;a class=&quot;wiki_link&quot; href=&quot;/AMD&quot;&gt;AMD&lt;/a&gt; announced the hypothetical &lt;a class=&quot;wiki_link&quot; href=&quot;/SSE5&quot;&gt;SSE5&lt;/a&gt; instruction set &lt;!-- ws:start:WikiTextRefRule:33:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://developer.amd.com/cpu/SSE5/Pages/default.aspx&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;128-Bit SSE5 Instruction Set&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://developer.amd.com/pages/default.aspx&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;AMD Developer Central&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-7&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-7&quot;&gt;[7]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:33 --&gt; with a PPERM instruction &lt;!-- ws:start:WikiTextRefRule:35:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.enrupt.com/index.php/2008/09/03/sse5_permutations&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;SSE5 permutations&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-8&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-8&quot;&gt;[8]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:35 --&gt; , which would be able to reverse vectors of two bitboards. In May 2009 AMD revised &lt;a class=&quot;wiki_link&quot; href=&quot;/SSE5&quot;&gt;SSE5&lt;/a&gt;, to become more compatible with Intel&#039;s &lt;a class=&quot;wiki_link&quot; href=&quot;/AVX&quot;&gt;Advanced Vector Extensions&lt;/a&gt;, and also expanding the SIMD-register width from 128 to 256-bit, the renamed &lt;a class=&quot;wiki_link&quot; href=&quot;/XOP&quot;&gt;XOP&lt;/a&gt; instruction set &lt;!-- ws:start:WikiTextRefRule:37:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/XOP_instruction_set&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;XOP instruction set from Wikipedia&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-9&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-9&quot;&gt;[9]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:37 --&gt; . However, the successor of the planned PPERM SSE5-instruction is now called &lt;a class=&quot;wiki_link&quot; href=&quot;/XOP#VPPERM&quot;&gt;VPPERM&lt;/a&gt;, but still works on 128-bit XMM registers &lt;!-- ws:start:WikiTextRefRule:39:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://support.amd.com/us/Embedded_TechDocs/43479.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Volume 6: 128-Bit and 256-Bit XOP, FMA4 and CVT16 Instructions&amp;lt;/a&amp;gt; (pdf), see VPPERM pg. 221&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-10&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-10&quot;&gt;[10]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:39 --&gt; . VPPERM instruction requires four operands (xmm-registers):&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:12:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt; VPPERM dest, src1, src2, selector&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt; VPPERM dest, src1, src2, selector&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:12 --&gt;For each of 16 destination bytes the corresponding selector-byte addresses one of 32 input bytes (from src1, src2) and a logical operation including bit-reversal:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:13:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;char src[32];   // src2:src1&amp;lt;br/&amp;gt;char select[16];&amp;lt;br/&amp;gt;char dest[16];&amp;lt;br/&amp;gt;for (int i = 0; i &amp;amp;lt; 16; i++) {&amp;lt;br/&amp;gt;   char opera = select[i] &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; 5; // unsigned shift&amp;lt;br/&amp;gt;   char idx32 = select[i] &amp;amp;amp; 31;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   switch ( opera ) {&amp;lt;br/&amp;gt;      case 0: dest[i] =  src[idx32]; break;&amp;lt;br/&amp;gt;      case 1: dest[i] = ~src[idx32]; break;&amp;lt;br/&amp;gt;      case 2: dest[i] =  bitreverse( src[idx32]); break;&amp;lt;br/&amp;gt;      case 3: dest[i] = ~bitreverse( src[idx32]); break;&amp;lt;br/&amp;gt;      case 4: dest[i] = 0x00; break;&amp;lt;br/&amp;gt;      case 5: dest[i] = 0xFF; break;&amp;lt;br/&amp;gt;      case 6: dest[i] =  src[idx32] &amp;amp;gt;&amp;amp;gt; 7;  break; // signed shift&amp;lt;br/&amp;gt;      case 7: dest[i] = ~src[idx32] &amp;amp;gt;&amp;amp;gt; 7;  break; // signed shift&amp;lt;br/&amp;gt;   }&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; src&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;// src2:src1&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; select&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; i&lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; opera &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; select&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// unsigned shift&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; idx32 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; select&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span class=&quot;kw1&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; opera &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  src&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;idx32&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~src&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;idx32&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  bitreverse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; src&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;idx32&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~bitreverse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; src&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;idx32&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x00&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0xFF&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  src&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;idx32&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// signed shift&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt; dest&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ~src&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;idx32&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// signed shift&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:13 --&gt;Since VPPERM can simultaneously reverse bits and bytes, it can for instance reverse two bitboards in one run, even from different sources, to make Hyperbola Quintessence work for all four lines.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:61:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:61 --&gt;See also&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Reverse%20Bitboards&quot;&gt;Reverse Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Obstruction%20Difference&quot;&gt;Obstruction Difference&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/SBAMG&quot;&gt;SBAMG&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/SSSE3#SSSE3Version&quot;&gt;SSSE3 Hyperbola Quintessence&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Subtracting%20a%20Rook%20from%20a%20Blocking%20Piece&quot;&gt;Subtracting a Rook from a Blocking Piece&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:63:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:63 --&gt;Forum Posts&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=140314&quot; rel=&quot;nofollow&quot;&gt;Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Aleks%20Peshkov&quot;&gt;Aleks Peshkov&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 25, 2007&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=25979&quot; rel=&quot;nofollow&quot;&gt;Hyperbola Quiesscene: hardly any improvement&lt;/a&gt; by trojanfoe, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 13, 2009&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=58795&quot; rel=&quot;nofollow&quot;&gt;Comparison of bitboard attack-getter variants&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Sven%20Sch%C3%BCle&quot;&gt;Sven Schüle&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 04, 2016&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=58667&amp;amp;start=106&quot; rel=&quot;nofollow&quot;&gt;Re: The wrong way&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Aleks%20Peshkov&quot;&gt;Aleks Peshkov&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 05, 2016 » &lt;a class=&quot;wiki_link&quot; href=&quot;/SSSE3#SSSE3Version&quot;&gt;SSSE3 Hyperbola Quintessence&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:65:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc9&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:65 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.youtube.com/watch?v=bCH4YK6oq8M&amp;amp;list=SPQV5mozTHmacMeRzJCW_8K3qw2miYqd0c&amp;amp;index=9&quot; rel=&quot;nofollow&quot;&gt;Sliding Pieces (Part 1) - Advanced Java Chess Engine Tutorial 8&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Jonathan%20Warkentin&quot;&gt;Jonathan Warkentin&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://timcooijmans.blogspot.co.uk/2014/04/hyperbola-quintessence-for-rooks-along.html&quot; rel=&quot;nofollow&quot;&gt;Hyperbola Quintessence for rooks along ranks&lt;/a&gt; by &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://www.blogger.com/profile/11033414990764447420&quot; rel=&quot;nofollow&quot;&gt;Tim Cooijmans&lt;/a&gt;, April 6, 2014 &lt;!-- ws:start:WikiTextRefRule:43:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=58795&amp;amp;amp;start=10&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Comparison of bitboard attack-getter variants&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Matthew%20R.%20Brades&amp;quot;&amp;gt;Matthew R. Brades&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, January 04, 2016&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-11&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-11&quot;&gt;[11]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:43 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:67:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc10&quot;&gt;&lt;a name=&quot;External Links-Hyperbola&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:67 --&gt;Hyperbola&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Hyperbola&quot; rel=&quot;nofollow&quot;&gt;Hyperbola from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.paideiaschool.org/TeacherPages/Steve_Sigur/resources/Eulerian%20hyperbola/Eulerian%20hyperbola.html&quot; rel=&quot;nofollow&quot;&gt;The Eulerian Hyperbola&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.mathwords.com/f/foci_hyperbola.htm&quot; rel=&quot;nofollow&quot;&gt;Foci of a Hyperbola&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.mathwords.com/&quot; rel=&quot;nofollow&quot;&gt;mathwords.com&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:69:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc11&quot;&gt;&lt;a name=&quot;External Links-Quintessence&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:69 --&gt;Quintessence&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Quintessence&quot; rel=&quot;nofollow&quot;&gt;Quintessence from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Quintessence_(physics)&quot; rel=&quot;nofollow&quot;&gt;Quintessence (physics) from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Aether_(classical_element)#Fifth_element&quot; rel=&quot;nofollow&quot;&gt;Quintessence the Fifth Element from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:71:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc12&quot;&gt;&lt;a name=&quot;External Links-Misc&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:71 --&gt;Misc&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#Focus&quot;&gt;Focus&lt;/a&gt; - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Hocus_Pocus_%28song%29&quot; rel=&quot;nofollow&quot;&gt;Hocus Pocus&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Pinkpop_Festival&quot; rel=&quot;nofollow&quot;&gt;Pinkpop Festival&lt;/a&gt; 1972, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Geleen&quot; rel=&quot;nofollow&quot;&gt;Geleen&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:44:&amp;lt;img src=&amp;quot;http://www.wikispaces.com/site/embedthumbnail/custom/23950926?h=0&amp;amp;w=0&amp;quot; class=&amp;quot;WikiMedia WikiMediaCustom&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;custom&amp;amp;quot; key=&amp;amp;quot;23950926&amp;amp;quot;&amp;quot; title=&amp;quot;Custom Media&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/5-adsDeltaM?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:44 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:73:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc13&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:73 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:304:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://msdn.microsoft.com/en-us/library/a3140177.aspx&quot; rel=&quot;nofollow&quot;&gt;_byteswap_uint64&lt;/a&gt; Visual C++ Developer Center - Run-Time Library Reference&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=140314&quot; rel=&quot;nofollow&quot;&gt;Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Aleks%20Peshkov&quot;&gt;Aleks Peshkov&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 25, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2007&quot;&gt;2007&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.puckergallery.com/artists/bak_chess/bak_chess_all.html&quot; rel=&quot;nofollow&quot;&gt;The Game of War&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.puckergallery.com/artists/bak_index/bak_publications.html&quot; rel=&quot;nofollow&quot;&gt;Samuel Bak - represented by Pucker Gallery since 1969&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.intel.com/assets/pdf/manual/248966.pdf&quot; rel=&quot;nofollow&quot;&gt;Intel 64 and IA32 Architectures Optimization Reference Manual&lt;/a&gt; (pdf)&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://msdn.microsoft.com/en-us/library/bb531427.aspx&quot; rel=&quot;nofollow&quot;&gt;_mm_shuffle_epi8&lt;/a&gt; Visual C++ Developer Center - Run-Time Library Reference&lt;/li&gt;
&lt;li id=&quot;cite_note-6&quot;&gt;&lt;a href=&quot;#cite_ref-6&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://timcooijmans.blogspot.co.uk/2014/04/hyperbola-quintessence-for-rooks-along.html&quot; rel=&quot;nofollow&quot;&gt;Hyperbola Quintessence for rooks along ranks&lt;/a&gt; by &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://www.blogger.com/profile/11033414990764447420&quot; rel=&quot;nofollow&quot;&gt;Tim Cooijmans&lt;/a&gt;, April 6, 2014&lt;/li&gt;
&lt;li id=&quot;cite_note-7&quot;&gt;&lt;a href=&quot;#cite_ref-7&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://developer.amd.com/cpu/SSE5/Pages/default.aspx&quot; rel=&quot;nofollow&quot;&gt;128-Bit SSE5 Instruction Set&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://developer.amd.com/pages/default.aspx&quot; rel=&quot;nofollow&quot;&gt;AMD Developer Central&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-8&quot;&gt;&lt;a href=&quot;#cite_ref-8&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.enrupt.com/index.php/2008/09/03/sse5_permutations&quot; rel=&quot;nofollow&quot;&gt;SSE5 permutations&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-9&quot;&gt;&lt;a href=&quot;#cite_ref-9&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/XOP_instruction_set&quot; rel=&quot;nofollow&quot;&gt;XOP instruction set from Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-10&quot;&gt;&lt;a href=&quot;#cite_ref-10&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://support.amd.com/us/Embedded_TechDocs/43479.pdf&quot; rel=&quot;nofollow&quot;&gt;Volume 6: 128-Bit and 256-Bit XOP, FMA4 and CVT16 Instructions&lt;/a&gt; (pdf), see VPPERM pg. 221&lt;/li&gt;
&lt;li id=&quot;cite_note-11&quot;&gt;&lt;a href=&quot;#cite_ref-11&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=58795&amp;amp;start=10&quot; rel=&quot;nofollow&quot;&gt;Re: Comparison of bitboard attack-getter variants&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Matthew%20R.%20Brades&quot;&gt;Matthew R. Brades&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 04, 2016&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:304 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:75:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc14&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:75 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:015:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Hyperbola Quintessence&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;60&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Hyperbola Quintessence&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;60&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Hyperbola_Quintessence includeBody-Hyperbola%20Quintessence includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Aleks+Peshkov&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Aleks Peshkov&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 13, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Amoeba&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Amoeba&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 19, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dumb&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dumb&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 10, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Efficient Generation of Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Endianness&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Endianness&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 25, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fill+Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fill Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 6, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/First+Rank+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;First Rank Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 28, 2010&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Flipping+Mirroring+and+Rotating&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Flipping Mirroring and Rotating&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 14, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/General+Setwise+Operations&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;General Setwise Operations&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hiding+the+Implementation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hiding the Implementation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 3, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hyperbola+Quintessence&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hyperbola Quintessence&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 25, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Java&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Java&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Jonathan+Warkentin&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Jonathan Warkentin&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 29, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Karlo+Bala+Jr.&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Karlo Bala Jr.&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 19, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kindergarten+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kindergarten Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kogge-Stone+Algorithm&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kogge-Stone Algorithm&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 17, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Parallel+Prefix+Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Parallel Prefix Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 22, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Reverse+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Reverse Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 29, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Ryan+Mack&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Ryan Mack&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 18, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SBAMG&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SBAMG&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 4, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SIMD+techniques&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SIMD techniques&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SSSE3&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SSSE3&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 8, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Subtracting+a+Rook+from+a+Blocking+Piece&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Subtracting a Rook from a Blocking Piece&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 2, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Syed+Fahad&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Syed Fahad&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/XOP&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;XOP&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 8, 2017&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:015 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Kindergarten Bitboards</title>
      <link>https://chessprogramming.wikispaces.com/Kindergarten+Bitboards</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Kindergarten+Bitboards</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Kindergarten+Bitboards</comments>
      <pubDate>Tue, 01 Aug 2017 19:55:05 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Kindergarten Bitboards&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:597:&amp;lt;a href=&amp;quot;http://www.imj.org.il/imagine/collections/item.asp?itemNum=194576&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/Group_of_Masks.jpg/157881193/232x303/Group_of_Masks.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;height: 303px; width: 232px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://www.imj.org.il/imagine/collections/item.asp?itemNum=194576&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/Group_of_Masks.jpg/157881193/232x303/Group_of_Masks.jpg&quot; alt=&quot;Group_of_Masks.jpg&quot; title=&quot;Group_of_Masks.jpg&quot; style=&quot;height: 303px; width: 232px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:597 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;&lt;strong&gt;Kindergarten&lt;/strong&gt; bitboards &lt;!-- ws:start:WikiTextRefRule:18:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;amp;t=5958&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Magic Bitboards Explained!&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Michael%20Sherwin&amp;quot;&amp;gt;Michael Sherwin&amp;lt;/a&amp;gt; and reply by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Gerd%20Isenberg&amp;quot;&amp;gt;Gerd Isenberg&amp;lt;/a&amp;gt; to call it Kindergarten Bitboards, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, December 4, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Timeline#2006&amp;quot;&amp;gt;2006&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:18 --&gt; was a kind of interactive forum development &lt;!-- ws:start:WikiTextRefRule:23:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=4523&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Compact Bitboard Attacks&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Tom%20Likens&amp;quot;&amp;gt;Tom Likens&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, March 14, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Timeline#2006&amp;quot;&amp;gt;2006&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:23 --&gt; with a lot of meanders &lt;!-- ws:start:WikiTextRefRule:28:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.stmintz.com/ccc/index.php?id=489834&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;rotated bitboards obsolete?&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Gerd%20Isenberg&amp;quot;&amp;gt;Gerd Isenberg&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, February 26, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Timeline#2006&amp;quot;&amp;gt;2006&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:28 --&gt; . There were two issues involved - first to calculate the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy%20of%20any%20Line&quot;&gt;occupancy of any line&lt;/a&gt; from the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupied bitboard&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:32:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.stmintz.com/ccc/index.php?id=491079&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Some thoughts on Dann Corbit&#039;s rotated alternative&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Steffan%20Westcott&amp;quot;&amp;gt;Steffan Westcott&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, March 03, 2006&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:32 --&gt; - and second, compact and dense lookup tables.&lt;br /&gt;
&lt;br /&gt;
As a quintessence &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt; came up with this nomination. It relies on fast 64-bit multiplication, but is otherwise quite resource friendly and a compromise between calculation and table-size.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#Klee&quot;&gt;Paul Klee&lt;/a&gt;, Group of Masks, 1939 &lt;!-- ws:start:WikiTextRefRule:34:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.imj.org.il/imagine/collections/viewDataE5.asp?case=Modern%20Art&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;IMAGINE - The Israel Museum&#039;s searchable collections database&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:34 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:75:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:75 --&gt;&lt;!-- ws:start:WikiTextTocRule:76: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Ranks and Diagonals&quot;&gt;Ranks and Diagonals&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:76 --&gt;&lt;!-- ws:start:WikiTextTocRule:77: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#File-Attacks&quot;&gt;File-Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:77 --&gt;&lt;!-- ws:start:WikiTextTocRule:78: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Shared Rank Lookup&quot;&gt;Shared Rank Lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:78 --&gt;&lt;!-- ws:start:WikiTextTocRule:79: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#x32-bit Versions&quot;&gt;32-bit Versions&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:79 --&gt;&lt;!-- ws:start:WikiTextTocRule:80: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Magic Compression&quot;&gt;Magic Compression&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:80 --&gt;&lt;!-- ws:start:WikiTextTocRule:81: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:81 --&gt;&lt;!-- ws:start:WikiTextTocRule:82: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forum Posts&quot;&gt;Forum Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:82 --&gt;&lt;!-- ws:start:WikiTextTocRule:83: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:83 --&gt;&lt;!-- ws:start:WikiTextTocRule:84: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:84 --&gt;&lt;!-- ws:start:WikiTextTocRule:85: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:85 --&gt;&lt;!-- ws:start:WikiTextTocRule:86: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:86 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:55:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Ranks and Diagonals&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:55 --&gt;Ranks and Diagonals&lt;/h1&gt;
 &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;Ranks&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/diagonals&quot;&gt;diagonals&lt;/a&gt; - that is their appropriate &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#LineAttacks&quot;&gt;line-mask&lt;/a&gt; by square-index - are first intersected by the occupancy of the whole board. Doesn&#039;t matter whether the slider itself is cleared or not - it is redundant anyway, considered by the pre-calculated lookup-table.&lt;br /&gt;
&lt;br /&gt;
Since there is only up to one bit per file, the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Multiplication&quot;&gt;north-fill multiplication&lt;/a&gt; by the A-file maps the diagonal to the 8th rank. Or - since we only need the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;inner six bits&lt;/a&gt;, we combine the required shift left one by multiplying with the B-file. Shifting right the product by 58 (64-6) leaves the six-bit occupancy-index in the 0..63 range. For instance the diagonal-attacks of a bishop on d4. &#039;A&#039;-&#039;H&#039; represent the masked occupied bits along this diagonal, which are either zero or one.&lt;br /&gt;
&lt;!-- ws:start:WikiTextIncludeRule:013:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/page?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; title=&amp;quot;Include page: page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;

&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a href=&quot;/Square%20Mapping%20Considerations&quot;&gt;&lt;img src=&quot;/file/view/mapping.JPG/93134172/mapping.JPG&quot; alt=&quot;mapping.JPG&quot; title=&quot;mapping.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;em&gt;Code samples and bitboard diagrams rely on &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations#LittleEndianRankFileMapping&quot;&gt;Little endian file and rank mapping&lt;/a&gt;&lt;/em&gt;.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:end:WikiTextIncludeRule:013 --&gt;&lt;br /&gt;
We need &#039;B&#039;-&#039;G&#039; as six bit number:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;masked line      *  B-File           =  B-G upper six       occupancy 6 bit&amp;lt;br/&amp;gt;. . . . . . . H     . 1 . . . . . .     . A[B C . E F G]    . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . G .     . 1 . . . . . .     . A B C . E F G     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . F . .     . 1 . . . . . .     . A B C . E F .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . E . . .     . 1 . . . . . .     . A B C . E . .  &amp;amp;gt;&amp;amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .  *  . 1 . . . . . .  =  . A B C . . . .  58 . . . . . . . .&amp;lt;br/&amp;gt;. . C . . . . .     . 1 . . . . . .     . A B C . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. B . . . . . .     . 1 . . . . . .     . A B . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;A . . . . . . .     . 1 . . . . . .     . A . . . . . .    [B C . E F G]. .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;masked line      *  B-File           =  B-G upper six       occupancy 6 bit
. . . . . . . H     . 1 . . . . . .     . A[B C . E F G]    . . . . . . . .
. . . . . . G .     . 1 . . . . . .     . A B C . E F G     . . . . . . . .
. . . . . F . .     . 1 . . . . . .     . A B C . E F .     . . . . . . . .
. . . . E . . .     . 1 . . . . . .     . A B C . E . .  &amp;gt;&amp;gt; . . . . . . . .
. . . . . . . .  *  . 1 . . . . . .  =  . A B C . . . .  58 . . . . . . . .
. . C . . . . .     . 1 . . . . . .     . A B C . . . .     . . . . . . . .
. B . . . . . .     . 1 . . . . . .     . A B . . . . .     . . . . . . . .
A . . . . . . .     . 1 . . . . . .     . A . . . . . .    [B C . E F G]. .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;The pre-calculated lookup-table contains the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks&quot;&gt;attacks of the first rank&lt;/a&gt; - but eight copies in each &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;rank&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Byte&quot;&gt;byte&lt;/a&gt;. It is indexed by the six bit occupied-state (&#039;B&#039;-&#039;G&#039;) and the &lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;file&lt;/a&gt; of the slider&#039;s &lt;a class=&quot;wiki_link&quot; href=&quot;/Squares&quot;&gt;square&lt;/a&gt;. It needs to be intersected with the same line-mask as formerly the occupancy - to map the first rank attack bits to the appropriate line - that&#039;s all. Appropriate pre-calculated attack bits are represented by &#039;a&#039;-&#039;h&#039;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;8 copies of rank      the attack set&amp;lt;br/&amp;gt;attacks &amp;amp;amp; l-mask  -&amp;amp;gt;  of this line&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . . h&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . g .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . f . .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . e . . .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       . . c . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       . b . . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       a . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;8 copies of rank      the attack set
attacks &amp;amp; l-mask  -&amp;gt;  of this line
a b c . e f g h       . . . . . . . h
a b c . e f g h       . . . . . . g .
a b c . e f g h       . . . . . f . .
a b c . e f g h       . . . . e . . .
a b c . e f g h       . . . . . . . .
a b c . e f g h       . . c . . . . .
a b c . e f g h       . b . . . . . .
a b c . e f g h       a . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;Since all &lt;a class=&quot;wiki_link&quot; href=&quot;/ranks&quot;&gt;ranks&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/diagonals&quot;&gt;diagonals&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/anti-diagonals&quot;&gt;anti-diagonals&lt;/a&gt; are properly file-aligned, it works perfectly with some redundant occupied bits for shorter diagonals as well, like here the outer bit &#039;B&#039;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;masked line      *  B-File           =  B-G upper six       occupancy 6 bit&amp;lt;br/&amp;gt;. . . . . . . .     . 1 . . . . . .     H .[B C . E F G]    . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . H     . 1 . . . . . .     . . B C . E F G     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . G .     . 1 . . . . . .     . . B C . E F G     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . F . .     . 1 . . . . . .     . . B C . E F .  &amp;amp;gt;&amp;amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;. . . . E . . .  *  . 1 . . . . . .  =  . . B C . E . .  58 . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . 1 . . . . . .     . . B C . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . C . . . . .     . 1 . . . . . .     . . B C . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. B . . . . . .     . 1 . . . . . .     . . B . . . . .    [B C . E F G]. .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;masked line      *  B-File           =  B-G upper six       occupancy 6 bit
. . . . . . . .     . 1 . . . . . .     H .[B C . E F G]    . . . . . . . .
. . . . . . . H     . 1 . . . . . .     . . B C . E F G     . . . . . . . .
. . . . . . G .     . 1 . . . . . .     . . B C . E F G     . . . . . . . .
. . . . . F . .     . 1 . . . . . .     . . B C . E F .  &amp;gt;&amp;gt; . . . . . . . .
. . . . E . . .  *  . 1 . . . . . .  =  . . B C . E . .  58 . . . . . . . .
. . . . . . . .     . 1 . . . . . .     . . B C . . . .     . . . . . . . .
. . C . . . . .     . 1 . . . . . .     . . B C . . . .     . . . . . . . .
. B . . . . . .     . 1 . . . . . .     . . B . . . . .    [B C . E F G]. .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;Appropriate pre-calculated attack bits are represented by &#039;b&#039;-&#039;h&#039; here:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;8 copies of rank      the attack set   or  the attack set&amp;lt;br/&amp;gt;attacks &amp;amp;amp; l-mask  -&amp;amp;gt;  of this line     -&amp;amp;gt;  of the shorter diagonal&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . . h      . . . . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . g .      . . . . . . . h&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . f . .      . . . . . . g .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . e . . .      . . . . . f . .&amp;lt;br/&amp;gt;a b c . e f g h       . . . . . . . .      . . . . e . . .&amp;lt;br/&amp;gt;a b c . e f g h       . . c . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       . b . . . . . .      . . c . . . . .&amp;lt;br/&amp;gt;a b c . e f g h       a . . . . . . .      . b . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;8 copies of rank      the attack set   or  the attack set
attacks &amp;amp; l-mask  -&amp;gt;  of this line     -&amp;gt;  of the shorter diagonal
a b c . e f g h       . . . . . . . h      . . . . . . . .
a b c . e f g h       . . . . . . g .      . . . . . . . h
a b c . e f g h       . . . . . f . .      . . . . . . g .
a b c . e f g h       . . . . e . . .      . . . . . f . .
a b c . e f g h       . . . . . . . .      . . . . e . . .
a b c . e f g h       . . c . . . . .      . . . . . . . .
a b c . e f g h       . b . . . . . .      . . c . . . . .
a b c . e f g h       a . . . . . . .      . b . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;Wasn&#039;t that simple? That is why it is called &lt;strong&gt;kindergarten&lt;/strong&gt; bitboards!&lt;br /&gt;
&lt;br /&gt;
The trick is to share one 4KByte table by three line-directions by re-using the mask for a final intersection. Of course one may use the calculated occupied state to index &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;rotated bitboards&lt;/a&gt; like tables of 32KByte each. But dividing the table size by 3*8 on the cost of that additional &#039;and&#039; (and keeping the mask inside a register) is tempting. Of course - like always with computation versus memory issues - it depends on the cache- and memory using and footprint inside a particular chess program and the hardware architecture, which solution is preferable. So far L1 &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Cache&quot; rel=&quot;nofollow&quot;&gt;Cache&lt;/a&gt; is a rare resource, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Translation_Lookaside_Buffer&quot; rel=&quot;nofollow&quot;&gt;Translation Lookaside Buffer&lt;/a&gt; als well.&lt;br /&gt;
&lt;br /&gt;
Like other none rotated approaches, namely &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;magic bitboards&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Hyperbola%20Quintessence#ArrayOfStructs&quot;&gt;hyperbola quintessence&lt;/a&gt;, the nice thing is that one can &lt;a class=&quot;wiki_link&quot; href=&quot;/Hiding%20the%20Implementation&quot;&gt;hide the implementation details&lt;/a&gt; behind a stateless interface. In &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt; /&lt;a class=&quot;wiki_link&quot; href=&quot;/Cpp&quot;&gt;C++&lt;/a&gt; one may use &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Header_file&quot; rel=&quot;nofollow&quot;&gt;header files&lt;/a&gt; with exclusive, conditional compiled inlined routines, as combinations and variations of the mentioned approaches.&lt;br /&gt;
&lt;br /&gt;
The three routines only differ by the line-mask applied. As pointed out by &lt;a class=&quot;wiki_link&quot; href=&quot;/Aleks%20Peshkov&quot;&gt;Aleks Peshkov&lt;/a&gt;, it is smarter to index by file, occupancy, since fillUpAttacks[sq&amp;amp;7] may be shared by two (bishop) or three (queen) line-attack getters.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 fillUpAttacks[8][64];  // 4 KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 bFile = C64(0x0202020202020202);&amp;lt;br/&amp;gt;   occ = (diagonalMaskEx[sq] &amp;amp;amp; occ) * bFile &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   return diagonalMaskEx[sq] &amp;amp;amp; fillUpAttacks[sq&amp;amp;amp;7][occ];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 antiDiagAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 bFile = C64(0x0202020202020202);&amp;lt;br/&amp;gt;   occ = (antidiagMaskEx[sq] &amp;amp;amp; occ) * bFile &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   return antidiagMaskEx[sq] &amp;amp;amp; fillUpAttacks[sq&amp;amp;amp;7][occ];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rankAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 bFile = C64(0x0202020202020202);&amp;lt;br/&amp;gt;   occ = (rankMaskEx[sq] &amp;amp;amp; occ) * bFile &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   return rankMaskEx[sq] &amp;amp;amp; fillUpAttacks[sq&amp;amp;amp;7][occ];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 fillUpAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 4 KByte&lt;/span&gt;
&amp;nbsp;
U64 diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 bFile &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0202020202020202&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; bFile &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; fillUpAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 antiDiagAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 bFile &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0202020202020202&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;antidiagMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; bFile &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; antidiagMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; fillUpAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 rankAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 bFile &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0202020202020202&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rankMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; bFile &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; rankMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; fillUpAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;One may use similar structs for the line-masks than the &lt;a class=&quot;wiki_link&quot; href=&quot;/Hyperbola%20Quintessence#ArrayOfStructs&quot;&gt;hyperbola quintessence&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:87:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@FileAttacks&amp;quot; title=&amp;quot;Anchor: FileAttacks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;FileAttacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:87 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:57:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;File-Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:57 --&gt;File-Attacks&lt;/h1&gt;
 &lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;Files&lt;/a&gt; need tad more work. Shift the board left (arithmetical right!) to the A-file to mask it. To get the inner six bits, a &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#FiletoaRank&quot;&gt;flip-multiplication&lt;/a&gt; by the c2-h7 diagonal is applied with further shift right 58. The lookup-table contains the A-file attacks, which are shifted &amp;quot;back&amp;quot; to the original file.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 aFileAttacks [8][64];  // 4 KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 aFile   = C64(0x0101010101010101);&amp;lt;br/&amp;gt;   const U64 diac2h7 = C64(0x0080402010080400);&amp;lt;br/&amp;gt;   occ = aFile  &amp;amp;amp; (occ &amp;amp;gt;&amp;amp;gt; (sq&amp;amp;amp;7));&amp;lt;br/&amp;gt;   occ = (diac2h7 *  occ ) &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   return aFileAttacks[sq&amp;amp;gt;&amp;amp;gt;3][occ] &amp;amp;lt;&amp;amp;lt; (sq&amp;amp;amp;7);&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 aFileAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 4 KByte&lt;/span&gt;
&amp;nbsp;
U64 fileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 aFile   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 diac2h7 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0080402010080400&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; aFile  &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;diac2h7 &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;  occ &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; aFileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;This is how it works:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;masked A-file    *  c2-h7 Diagonal    =  occupancy&amp;lt;br/&amp;gt;H . . . . . . .     . . . . . . . .     . .[G F E D C B]    . . . . . . . .&amp;lt;br/&amp;gt;G . . . . . . .     . . . . . . . 1     . . F E D C B A     . . . . . . . .&amp;lt;br/&amp;gt;F . . . . . . .     . . . . . . 1 .     . . E D C B A .     . . . . . . . .&amp;lt;br/&amp;gt;E . . . . . . .     . . . . . 1 . .     . . D C B A . .  &amp;amp;gt;&amp;amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;D . . . . . . .  *  . . . . 1 . . .  =  . . C B A . . .  58 . . . . . . . .&amp;lt;br/&amp;gt;C . . . . . . .     . . . 1 . . . .     . . B A . . . .     . . . . . . . .&amp;lt;br/&amp;gt;B . . . . . . .     . . 1 . . . . .     . . A . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;A . . . . . . .     . . . . . . . .     . . . . . . . .    [G F E D C B]. .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;masked A-file    *  c2-h7 Diagonal    =  occupancy
H . . . . . . .     . . . . . . . .     . .[G F E D C B]    . . . . . . . .
G . . . . . . .     . . . . . . . 1     . . F E D C B A     . . . . . . . .
F . . . . . . .     . . . . . . 1 .     . . E D C B A .     . . . . . . . .
E . . . . . . .     . . . . . 1 . .     . . D C B A . .  &amp;gt;&amp;gt; . . . . . . . .
D . . . . . . .  *  . . . . 1 . . .  =  . . C B A . . .  58 . . . . . . . .
C . . . . . . .     . . . 1 . . . .     . . B A . . . .     . . . . . . . .
B . . . . . . .     . . 1 . . . . .     . . A . . . . .     . . . . . . . .
A . . . . . . .     . . . . . . . .     . . . . . . . .    [G F E D C B]. .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;Note that the six inner bit occupancy is reversed - considered in the pre-calculated aFileAttacks &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt;. This reversed lookup was justified to share first rank-attacks by all directions - with a dense lookup of 512 Byte. But the 4KByte tables outperform the additional multiplications and shift of the dense version - and one may alternatively multiply with the flipped diagonal, the c7-h2 anti-diagonal:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;masked A-file    *  c7-h2 AntiDiag   =  occupancy&amp;lt;br/&amp;gt;H . . . . . . .     . . . . . . . .     . .[B C D E F G]    . . . . . . . .&amp;lt;br/&amp;gt;G . . . . . . .     . . 1 . . . . .     . . A B C D E F     . . . . . . . .&amp;lt;br/&amp;gt;F . . . . . . .     . . . 1 . . . .     . . . A B C D E     . . . . . . . .&amp;lt;br/&amp;gt;E . . . . . . .     . . . . 1 . . .     . . . . A B C D  &amp;amp;gt;&amp;amp;gt; . . . . . . . .&amp;lt;br/&amp;gt;D . . . . . . .  *  . . . . . 1 . .  =  . . . . . A B C  58 . . . . . . . .&amp;lt;br/&amp;gt;C . . . . . . .     . . . . . . 1 .     . . . . . . A B     . . . . . . . .&amp;lt;br/&amp;gt;B . . . . . . .     . . . . . . . 1     . . . . . . . A     . . . . . . . .&amp;lt;br/&amp;gt;A . . . . . . .     . . . . . . . .     . . . . . . . .    [B C D E F G]. .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;masked A-file    *  c7-h2 AntiDiag   =  occupancy
H . . . . . . .     . . . . . . . .     . .[B C D E F G]    . . . . . . . .
G . . . . . . .     . . 1 . . . . .     . . A B C D E F     . . . . . . . .
F . . . . . . .     . . . 1 . . . .     . . . A B C D E     . . . . . . . .
E . . . . . . .     . . . . 1 . . .     . . . . A B C D  &amp;gt;&amp;gt; . . . . . . . .
D . . . . . . .  *  . . . . . 1 . .  =  . . . . . A B C  58 . . . . . . . .
C . . . . . . .     . . . . . . 1 .     . . . . . . A B     . . . . . . . .
B . . . . . . .     . . . . . . . 1     . . . . . . . A     . . . . . . . .
A . . . . . . .     . . . . . . . .     . . . . . . . .    [B C D E F G]. .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:59:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Shared Rank Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:59 --&gt;Shared Rank Lookup&lt;/h1&gt;
 As often, &lt;a class=&quot;wiki_link&quot; href=&quot;/Space-Time%20Tradeoff&quot;&gt;computation versus memory size&lt;/a&gt;. One may share a 512Byte Lookup of the first rank by all lines with some trailing computation. Multiplying with the A-file (fill north) for ranks and diagonals, and multiplying with the diagonal for the file. Likely the additional multiplication don&#039;t pays off.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;const BYTE firstRankAttacks[8][64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 aFile   = C64(0x0101010101010101);&amp;lt;br/&amp;gt;   const U64 hFile   = C64(0x8080808080808080);&amp;lt;br/&amp;gt;   const U64 diaa1h8 = C64(0x8040201008040201);&amp;lt;br/&amp;gt;   const U64 diac2h7 = C64(0x0080402010080400);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   unsigned int f = sq &amp;amp;amp; 7;&amp;lt;br/&amp;gt;   occ =   aFile   &amp;amp;amp; (occ   &amp;amp;gt;&amp;amp;gt;  f);&amp;lt;br/&amp;gt;   occ = ( diac2h7 *  occ ) &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   occ =   diaa1h8 * firstRankAttacks[(sq^56)&amp;amp;gt;&amp;amp;gt;3][occ];&amp;lt;br/&amp;gt;   return ( hFile  &amp;amp;amp;  occ ) &amp;amp;gt;&amp;amp;gt; (f^7);&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   const U64 aFile = C64(0x0101010101010101);&amp;lt;br/&amp;gt;   const U64 bFile = C64(0x0202020202020202);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   unsigned int f = sq &amp;amp;amp; 7;&amp;lt;br/&amp;gt;   occ  =  diagonalMaskEx[sq] &amp;amp;amp; occ;&amp;lt;br/&amp;gt;   occ  = (bFile * occ ) &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   occ  =  aFile *  firstRankAttacks[f][occ];&amp;lt;br/&amp;gt;   return  diagonalMaskEx[sq] &amp;amp;amp; occ;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; BYTE firstRankAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 fileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 aFile   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 hFile   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x8080808080808080&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 diaa1h8 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x8040201008040201&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 diac2h7 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0080402010080400&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; f &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;   aFile   &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ   &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; diac2h7 &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;  occ &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;   diaa1h8 &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; firstRankAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;56&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; hFile  &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;  occ &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f&lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 aFile &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 bFile &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0202020202020202&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; f &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bFile &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; occ &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  aFile &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;  firstRankAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;  diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:61:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;x32-bit Versions&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:61 --&gt;32-bit Versions&lt;/h1&gt;
 One other variation of the memory versus computation theme was encouraged by 32-bit mode. 64-bit multiplication is quite expensive in 32-bit mode - a call using three imuls. Thus, it is more efficient to use shift-or plus 32-bit multiplication, which might in fact be used in 64-bit mode as well. &lt;a class=&quot;wiki_link&quot; href=&quot;/Piotr%20Cichy&quot;&gt;Piotr Cichy&lt;/a&gt; proposed a multiplication less &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;parallel prefix shift&lt;/a&gt; approach similar to &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy%20of%20any%20Line&quot;&gt;Occupancy of any Line&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:38:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=29296&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Kindergarten bitboards without multiplying&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Piotr%20Cichy&amp;quot;&amp;gt;Piotr Cichy&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 07, 2009&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-6&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-6&quot;&gt;[6]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:38 --&gt; , which is a good alternative for processors with slow multiplication.&lt;br /&gt;
&lt;br /&gt;
An efficient and tricky file-approach was introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Zach%20Wegner&quot;&gt;Zach Wegner&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:42:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?topic_view=threads&amp;amp;amp;p=26851&amp;amp;amp;t=4523&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Zach&#039;s tricky 32-bit approach&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Zach%20Wegner&amp;quot;&amp;gt;Zach Wegner&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, August 22, 2006&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-7&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-7&quot;&gt;[7]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:42 --&gt;, using a 32KByte, &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;rotated like&lt;/a&gt; lookup-table:&lt;br /&gt;
&lt;tt&gt;It is quite strange, yes, but it is an out of order mapping. There are only 5 bits because each bit in the factor maps more than one bit. The trick here is the odd shift 29, so that the multiply does not overflow individual bits. I have since found that 25 and 27 will work with the same magic&lt;/tt&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;occ&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;a . . . . . . .&amp;lt;br/&amp;gt;b . . . . . . .    occ | occ &amp;amp;gt;&amp;amp;gt; 29    * 0x01041041 with the index bracketed&amp;lt;br/&amp;gt;c . . . . . . .    ...\               ...\               ...\&amp;lt;br/&amp;gt;d . . . . . . .    d . . . . . . .    1 . . . . . . .    d a[f c e b d a]&amp;lt;br/&amp;gt;e . . . . . . .    e . . a . . . .    . . 1 . . . . .    e b . a f c e b&amp;lt;br/&amp;gt;f . . . . . . .    f . . b . . . .    . . . . 1 . . .    f c . b . . f c&amp;lt;br/&amp;gt;. . . . . . . .    . . . c . . . .    1 . . . . . 1 .    . . . c . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;occ
. . . . . . . .
a . . . . . . .
b . . . . . . .    occ | occ &amp;gt;&amp;gt; 29    * 0x01041041 with the index bracketed
c . . . . . . .    ...\               ...\               ...\
d . . . . . . .    d . . . . . . .    1 . . . . . . .    d a[f c e b d a]
e . . . . . . .    e . . a . . . .    . . 1 . . . . .    e b . a f c e b
f . . . . . . .    f . . b . . . .    . . . . 1 . . .    f c . b . . f c
. . . . . . . .    . . . c . . . .    1 . . . . . 1 .    . . . c . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:9 --&gt;&lt;tt&gt;The interesting thing is that this works for any masked file. In fact if it was shifted to the a-file, you could get away with the 3-bit factor 0x00041040 (but using a shift of 23).&lt;/tt&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 arrFileAttacks[64][64]; // [sq][occ64] 32KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ &amp;amp;amp;= fileMask[sq];&amp;lt;br/&amp;gt;   U32 fold  = (U32)occ | (U32)(occ &amp;amp;gt;&amp;amp;gt; 29);&amp;lt;br/&amp;gt;   U32 occ64 = fold * 0x01041041 &amp;amp;gt;&amp;amp;gt; 26;&amp;lt;br/&amp;gt;   return arrFileAttacks[sq][occ64];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 arrFileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// [sq][occ64] 32KByte&lt;/span&gt;
&amp;nbsp;
U64 fileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; fileMask&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U32 fold  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U32&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;occ &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U32&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;29&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U32 occ64 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; fold &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x01041041&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;26&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; arrFileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ64&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;&lt;br /&gt;
Ranks and diagonals are trivial, this version favors rotated like memory size for less computation and same operations than file-attacks. One may therefor generalize the routine by a line-direction parameter:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:11:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 arrDiagonalAttacks[64][64]; // [sq][occ64] 32KByte&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 diagonalAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ &amp;amp;amp;= diagonalMaskEx[sq];&amp;lt;br/&amp;gt;   U32 fold  = (U32)occ | (U32)(occ &amp;amp;gt;&amp;amp;gt; 32);&amp;lt;br/&amp;gt;   U32 occ64 = fold * 0x02020202 &amp;amp;gt;&amp;amp;gt; 26;&amp;lt;br/&amp;gt;   return arrDiagonalAttacks[sq][occ64];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 arrDiagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// [sq][occ64] 32KByte&lt;/span&gt;
&amp;nbsp;
U64 diagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; diagonalMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U32 fold  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U32&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;occ &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U32&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U32 occ64 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; fold &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x02020202&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;26&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; arrDiagonalAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ64&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:11 --&gt;A similar approach was proposed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Andrew%20Fan&quot;&gt;Andrew Fan&lt;/a&gt; in 2009, been active in his &lt;a class=&quot;wiki_link&quot; href=&quot;/FireFly&quot;&gt;own engine&lt;/a&gt; for a few years (2006 earliest recorded file time) &lt;!-- ws:start:WikiTextRefRule:46:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;amp;t=50616&amp;amp;amp;p=192200&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;32-bit Magic experiments&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Andrew%20Fan&amp;quot;&amp;gt;Andrew Fan&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, December 03, 2009&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-8&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-8&quot;&gt;[8]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:46 --&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:88:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@MagicCompression&amp;quot; title=&amp;quot;Anchor: MagicCompression&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;MagicCompression&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:88 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:63:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Magic Compression&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:63 --&gt;Magic Compression&lt;/h1&gt;
 So far Kindergarten bitboards performs a &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table#PerfectHashing&quot;&gt;perfect hashing&lt;/a&gt; of the up to six relevant and scattered occupied bits of any line to a six-bit index - which is a bijective mapping of 64 different occupancies per line to 64 indices for the precalculated attack sets.&lt;br /&gt;
&lt;br /&gt;
If we have a closer look to the attack sets, say of a rook on the a-file, we enumerate far less disjoint sets. A rook on a1 (a8) has seven different attack-sets on that file, depending on the occupancy of a2-a7. On a2 (a7) there is even one attack set less, on a3 (a6) 2 times 5 and on a4 (a5) 3 times 4 attack-sets. Thus, there are {7, 6, 10, 12, 12, 10, 6, 7} disjoint attack-sets per square on line, or 70 in total over all eight squares.&lt;br /&gt;
&lt;br /&gt;
While kindergarten bitboards apply a minimal perfect mapping of scattered bits to a six-bit index, the mapping of the attack-sets is surjective, since each of the 64 occupancies maps only up to 12 distinct sets. Of course that is because occupancies &amp;quot;behind&amp;quot; the first blocker are redundant and map the same attack.&lt;br /&gt;
&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Grant%20Osborne&quot;&gt;Grant Osborne&lt;/a&gt; came up with the idea, derived from &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;magic bitboards&lt;/a&gt; - to use different &amp;quot;magic&amp;quot; factors per square (rank), where multiplication may produce carries and enough so called constructive collisions to gain only five or even four bit indices and therefor denser tables. Since different squares may have different table sizes (16 or 32 entries), a Java-like &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt; is used for the attacks, in C implemented as array of pointers to the arbitrary sized attack tables. The variable right shift by either 60 or 59 is encoded inside the otherwise redundant upper six bits of the magic factor, as mentioned in &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#IncorporatingtheShift&quot;&gt;incorporating the shift&lt;/a&gt; of magic bitboards.&lt;br /&gt;
&lt;br /&gt;
Grant&#039;s proposal, so far with {5,4,4,5,5,4,4,5} bit ranges for the lookups per square for vertical rook attacks, results in a 1.5 KByte array instead the 4KByte of the initial Kindergarten file attack getter &lt;!-- ws:start:WikiTextRefRule:50:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;amp;p=198660&amp;amp;amp;t=21329&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: How to reduce the &amp;amp;quot;bits&amp;amp;quot; used in a magic number&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Grant%20Osborne&amp;quot;&amp;gt;Grant Osborne&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, July 04, 2008&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-9&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-9&quot;&gt;[9]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:50 --&gt; . Whether the effort of the rank-indexed magic-factor plus additional pointer indirection pays off the memory saving is another question, and should be tried inside a concrete chess program with its individual cache- and memory footprint.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:12:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 aFileAttacks[4*32+4*16]; // 1.5KByte&amp;lt;br/&amp;gt;U64 aPtrFileAttacks[8]; // points to appropriate aFileAttacks&amp;lt;br/&amp;gt;U64 fileMagic[8] = {&amp;lt;br/&amp;gt;   0xEFFFA39DB01B23A3, // 5-bit&amp;lt;br/&amp;gt;   0xF024691A3227FF42, // 4-bit&amp;lt;br/&amp;gt;   0xF2808817CAD6FF0C, // 4-bit see below&amp;lt;br/&amp;gt;   0xED6EDFBE467977D5, // 5-bit&amp;lt;br/&amp;gt;   0xEC87CB0D961EC43A, // 5-bit&amp;lt;br/&amp;gt;   0xF2FF594E14D8801C, // 4-bit&amp;lt;br/&amp;gt;   0xF2FF5D69D4E3E7D6, // 4-bit&amp;lt;br/&amp;gt;   0xEE404B349599FF88  // 5-bit&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   unsigned int file = sq &amp;amp;amp;  7;&amp;lt;br/&amp;gt;   unsigned int rank = sq &amp;amp;gt;&amp;amp;gt; 3;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   occ =  0x0001010101010100 &amp;amp;amp; (occ &amp;amp;gt;&amp;amp;gt; file);&amp;lt;br/&amp;gt;   occ = (fileMagic[rank] * occ) &amp;amp;gt;&amp;amp;gt; (fileMagic[rank] &amp;amp;gt;&amp;amp;gt; 58);  // four&amp;amp;amp;five bit index&amp;lt;br/&amp;gt;   return *(aPtrFileAttacks[rank] + occ) &amp;amp;lt;&amp;amp;lt; file;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 aFileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 1.5KByte&lt;/span&gt;
U64 aPtrFileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// points to appropriate aFileAttacks&lt;/span&gt;
U64 fileMagic&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xEFFFA39DB01B23A3&lt;/span&gt;, &lt;span class=&quot;co1&quot;&gt;// 5-bit&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xF024691A3227FF42&lt;/span&gt;, &lt;span class=&quot;co1&quot;&gt;// 4-bit&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xF2808817CAD6FF0C&lt;/span&gt;, &lt;span class=&quot;co1&quot;&gt;// 4-bit see below&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xED6EDFBE467977D5&lt;/span&gt;, &lt;span class=&quot;co1&quot;&gt;// 5-bit&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xEC87CB0D961EC43A&lt;/span&gt;, &lt;span class=&quot;co1&quot;&gt;// 5-bit&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xF2FF594E14D8801C&lt;/span&gt;, &lt;span class=&quot;co1&quot;&gt;// 4-bit&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xF2FF5D69D4E3E7D6&lt;/span&gt;, &lt;span class=&quot;co1&quot;&gt;// 4-bit&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xEE404B349599FF88&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 5-bit&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 fileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; file &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rank &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;nu12&quot;&gt;0x0001010101010100&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; file&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;fileMagic&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;rank&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;fileMagic&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;rank&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// four&amp;amp;five bit index&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;aPtrFileAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;rank&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; occ&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; file&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:12 --&gt;The table demonstrates how it works for file-attack of the a3 rook with a four bit range only five relevant occupied bits, since a3 is member of the inner six bits. The empirical determined factor is 0xF2808817CAD6FF0C, six upper bits contain the right shift for the product, for this square shift 60:&lt;br /&gt;
&lt;tt&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;th&gt;occupancy (A-File)&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;product&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;index 0..15&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;attack set&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o - outer squares don&#039;t care&lt;br /&gt;
x - empty or any piece&lt;br /&gt;
. - empty&lt;br /&gt;
b - Blocker - any piece&lt;br /&gt;
R - Rook&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;occupancy *&lt;br /&gt;
0xF2808817CAD6FF0C&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;upper&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Nibble&quot;&gt;nibble&lt;/a&gt;&lt;br /&gt;
in&lt;br /&gt;
product&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;1 attacked&lt;br /&gt;
. not attacked&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
x&lt;br /&gt;
x&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
R&lt;br /&gt;
b&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1. attack-set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000010101000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x3A28F9D5E2FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;3&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001010101000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x3934F9D5E2FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;3&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000000101000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x6329EDD5E2FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;6&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000010001000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x6F51FAC9E2FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;6&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001000101000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x6235EDD5E2FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;6&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001010001000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x6E5DFAC9E2FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;6&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x9852EEC9E2FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;9&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001000001000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x975EEEC9E2FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;9&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
x&lt;br /&gt;
x&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
R&lt;br /&gt;
.&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2. attack set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000000001000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x17CAD6FF0C000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;1&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001000001000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x16D6D6FF0C000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;1&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000010101000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xB9A0E20B0C000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;11&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001010101000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xB8ACE20B0C000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;11&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000000101000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xE2A1D60B0C000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;14&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000010001000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xEEC9E2FF0C000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;14&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001000101000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xE1ADD60B0C000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;14&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001010001000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xEDD5E2FF0C000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;14&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000001000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
x&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
.&lt;br /&gt;
R&lt;br /&gt;
b&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3. attack set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001010100000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x216A22D6D6FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;2&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000101000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000010100000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x225E22D6D6FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;2&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000101000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000000100000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x4B5F16D6D6FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;4&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000101000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001000100000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x4A6B16D6D6FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;4&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000101000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
x&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
.&lt;br /&gt;
R&lt;br /&gt;
.&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;4. attack set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000010100000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xA1D60B0C00000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;10&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000101000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001010100000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xA0E20B0C00000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;10&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000101000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000000100000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xCAD6FF0C00000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;12&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000101000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001000100000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xC9E2FF0C00000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;12&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000000101000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
R&lt;br /&gt;
b&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;5. attack set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;.&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000010000000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x578723CAD6FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;5&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000010101000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001010000000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x569323CAD6FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;5&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000010101000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
R&lt;br /&gt;
.&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;6. attack set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;.&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000010000000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xD6FF0C0000000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;13&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000010101000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001010000000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xD60B0C0000000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;13&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0000010101000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
b&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
R&lt;br /&gt;
b&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;7. attack set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001000000000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x7F9417CAD6FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;7&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0001010101000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
b&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
R&lt;br /&gt;
.&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;8. attack set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0001000000000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0xFF0C000000000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;15&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0001010101000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
R&lt;br /&gt;
b&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;9. attack set&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000000000000100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x808817CAD6FF0C00&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;8&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0101010101000100&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;o&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
R&lt;br /&gt;
.&lt;br /&gt;
o&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;10. attack set,&lt;br /&gt;
no blocker&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
.&lt;br /&gt;
1&lt;br /&gt;
1&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;0x0000000000000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;0x0000000000000000&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: center;&quot;&gt;0&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;0x0101010101000101&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;/tt&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:65:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:65 --&gt;See also&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#RankFileAndDiagonal&quot;&gt;Flipping, Mirroring and Rotating of Rank, File and Diagonal&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy%20of%20any%20Line&quot;&gt;Occupancy of any Line&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/OliThink#SlidingPieceAttacks&quot;&gt;Sliding Piece Attacks in OliThink&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Winglet#SlidingAttacks&quot;&gt;Sliding Piece Attacks in Winglet&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:67:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:67 --&gt;Forum Posts&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://groups.google.com/d/msg/rec.games.chess.computer/YvFagyuVogw/2vNJw_qT8IYJ&quot; rel=&quot;nofollow&quot;&gt;Re: Rotated bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Urban%20Koistinen&quot;&gt;Urban Koistinen&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, October 31, 1997 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy%20of%20any%20Line#CollapsedFiles&quot;&gt;Collapsed files&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy%20of%20any%20Line#CollapsedRanks&quot;&gt;Collapsed ranks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=489834&quot; rel=&quot;nofollow&quot;&gt;rotated bitboards obsolete?&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, February 26, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=491079&quot; rel=&quot;nofollow&quot;&gt;Re: Some thoughts on Dann Corbit&#039;s rotated alternative&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 03, 2006&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=4523&quot; rel=&quot;nofollow&quot;&gt;Compact Bitboard Attacks&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Tom%20Likens&quot;&gt;Tom Likens&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, March 14, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?topic_view=threads&amp;amp;p=26851&amp;amp;t=4523&quot; rel=&quot;nofollow&quot;&gt;Zach&#039;s tricky 32-bit approach&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Zach%20Wegner&quot;&gt;Zach Wegner&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, August 22, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=5958&quot; rel=&quot;nofollow&quot;&gt;Magic Bitboards Explained!&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Michael%20Sherwin&quot;&gt;Michael Sherwin&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, December 04, 2006&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=24724&quot; rel=&quot;nofollow&quot;&gt;Kindergarten Bitboard Approach by Gerd Isenberg&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Edsel%20Apostol&quot;&gt;Edsel Apostol&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, November 05, 2008 » &lt;a class=&quot;wiki_link&quot; href=&quot;/OliThink&quot;&gt;OliThink&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=29296&quot; rel=&quot;nofollow&quot;&gt;Kindergarten bitboards without multiplying&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Piotr%20Cichy&quot;&gt;Piotr Cichy&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 07, 2009&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=30742&quot; rel=&quot;nofollow&quot;&gt;Kindergarten Bitboard help&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gregory%20Strong&quot;&gt;Gregory Strong&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, November 22, 2009&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=50616&amp;amp;p=192200&quot; rel=&quot;nofollow&quot;&gt;32-bit Magic experiments&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Andrew%20Fan&quot;&gt;Andrew Fan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, December 03, 2009 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;Magic Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=31348&quot; rel=&quot;nofollow&quot;&gt;Kindergarten bitboards and Xiangqi move genaration?&lt;/a&gt; by Han Chengye, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, December 30, 2009 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Chinese%20Chess&quot;&gt;Chinese Chess&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:69:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:69 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Kindergarten&quot; rel=&quot;nofollow&quot;&gt;Kindergarten from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#GeorgeBenson&quot;&gt;George Benson&lt;/a&gt; -  &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/This_Masquerade&quot; rel=&quot;nofollow&quot;&gt;This Masquerade&lt;/a&gt;, 1976, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:51:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/youtube/T8eXCdjdSHE?h=315&amp;amp;w=560&amp;quot; class=&amp;quot;WikiMedia WikiMediaYoutube&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;youtube&amp;amp;quot; key=&amp;amp;quot;T8eXCdjdSHE&amp;amp;quot; width=&amp;amp;quot;560&amp;amp;quot;&amp;quot; title=&amp;quot;YouTube Video&amp;quot;height=&amp;quot;315&amp;quot; width=&amp;quot;560&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/T8eXCdjdSHE&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:51 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#PatMetheny&quot;&gt;Pat Metheny&lt;/a&gt; and friends - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/This_Masquerade&quot; rel=&quot;nofollow&quot;&gt;This Masquerade&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Jazz_Baltica&quot; rel=&quot;nofollow&quot;&gt;Jazz Baltica&lt;/a&gt;, July 6, 2003, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Nils_Landgren_%28musician%29&quot; rel=&quot;nofollow&quot;&gt;Nils Landgren&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#LarsDanielsson&quot;&gt;Lars Danielsson&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Wolfgang_Haffner&quot; rel=&quot;nofollow&quot;&gt;Wolfgang Haffner&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Esbj%C3%B6rn_Svensson&quot; rel=&quot;nofollow&quot;&gt;Esbjörn Svensson&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#PatMetheny&quot;&gt;Pat Metheny&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#MichaelBrecker&quot;&gt;Michael Brecker&lt;/a&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:52:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/custom/23645450?h=0&amp;amp;w=0&amp;quot; class=&amp;quot;WikiMedia WikiMediaCustom&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;custom&amp;amp;quot; key=&amp;amp;quot;23645450&amp;amp;quot;&amp;quot; title=&amp;quot;Custom Media&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;560&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/Lzrp7H4j8TE?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:52 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:71:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc8&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:71 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:1105:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=5958&quot; rel=&quot;nofollow&quot;&gt;Magic Bitboards Explained!&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Michael%20Sherwin&quot;&gt;Michael Sherwin&lt;/a&gt; and reply by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt; to call it Kindergarten Bitboards, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, December 4, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=4523&quot; rel=&quot;nofollow&quot;&gt;Compact Bitboard Attacks&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Tom%20Likens&quot;&gt;Tom Likens&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, March 14, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=489834&quot; rel=&quot;nofollow&quot;&gt;rotated bitboards obsolete?&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, February 26, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=491079&quot; rel=&quot;nofollow&quot;&gt;Re: Some thoughts on Dann Corbit&#039;s rotated alternative&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 03, 2006&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.imj.org.il/imagine/collections/viewDataE5.asp?case=Modern%20Art&quot; rel=&quot;nofollow&quot;&gt;IMAGINE - The Israel Museum&#039;s searchable collections database&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-6&quot;&gt;&lt;a href=&quot;#cite_ref-6&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=29296&quot; rel=&quot;nofollow&quot;&gt;Kindergarten bitboards without multiplying&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Piotr%20Cichy&quot;&gt;Piotr Cichy&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 07, 2009&lt;/li&gt;
&lt;li id=&quot;cite_note-7&quot;&gt;&lt;a href=&quot;#cite_ref-7&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?topic_view=threads&amp;amp;p=26851&amp;amp;t=4523&quot; rel=&quot;nofollow&quot;&gt;Zach&#039;s tricky 32-bit approach&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Zach%20Wegner&quot;&gt;Zach Wegner&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, August 22, 2006&lt;/li&gt;
&lt;li id=&quot;cite_note-8&quot;&gt;&lt;a href=&quot;#cite_ref-8&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=50616&amp;amp;p=192200&quot; rel=&quot;nofollow&quot;&gt;32-bit Magic experiments&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Andrew%20Fan&quot;&gt;Andrew Fan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, December 03, 2009&lt;/li&gt;
&lt;li id=&quot;cite_note-9&quot;&gt;&lt;a href=&quot;#cite_ref-9&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=198660&amp;amp;t=21329&quot; rel=&quot;nofollow&quot;&gt;Re: How to reduce the &amp;quot;bits&amp;quot; used in a magic number&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Grant%20Osborne&quot;&gt;Grant Osborne&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, July 04, 2008&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:1105 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:73:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc9&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:73 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:014:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Kindergarten Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Kindergarten Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Kindergarten_Bitboards includeBody-Kindergarten%20Bitboards includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tfoot class=&quot;includeBacklinksFooter&quot;&gt;
    &lt;tr&gt;
      &lt;td colspan=&quot;5&quot;&gt;&lt;a href=&quot;https://chessprogramming.wikispaces.com/page/links/Kindergarten+Bitboards&quot;&gt;More Links&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tfoot&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Andreas+Guettinger&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Andreas Guettinger&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 14, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Andrew+Fan&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Andrew Fan&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Array&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Array&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 1, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bitboard+Serialization&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bitboard Serialization&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 24, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/BMI2&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;BMI2&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 6, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chinese+Chess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chinese Chess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 16, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chiron&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chiron&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 24, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Congruent+Modulo+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Congruent Modulo Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 26, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Efficient Generation of Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Exploding+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Exploding Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 9, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Firefly&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Firefly&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/First+Rank+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;First Rank Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 28, 2010&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Flipping+Mirroring+and+Rotating&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Flipping Mirroring and Rotating&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 14, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/General+Setwise+Operations&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;General Setwise Operations&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Grant+Osborne&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Grant Osborne&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 2, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gregory+Strong&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gregory Strong&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 24, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hash+Table&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hash Table&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hashing+Dictionaries&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hashing Dictionaries&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 1, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hiding+the+Implementation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hiding the Implementation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 3, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hyperbola+Quintessence&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hyperbola Quintessence&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 25, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Jazz&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Jazz&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 4, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kindergarten+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kindergarten Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kurt&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kurt&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 20, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Magic+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Magic Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 13, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mark+Levene&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mark Levene&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Occupancy+of+any+Line&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Occupancy of any Line&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 16, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/OliThink&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;OliThink&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 19, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Protector&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Protector&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 12, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rodent&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rodent&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 11, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rotated+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rotated Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 7, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SIMD+techniques&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SIMD techniques&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Simplex&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Simplex&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 6, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sjaak+%28Glebbeek%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sjaak (Glebbeek)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 4, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Space-Time+Tradeoff&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Space-Time Tradeoff&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 17, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sungorus&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sungorus&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 11, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tigran&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tigran&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 16, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tom+Likens&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tom Likens&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 7, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Trevor+Fenner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Trevor Fenner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Vajolet&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Vajolet&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:014 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>King Pattern</title>
      <link>https://chessprogramming.wikispaces.com/King+Pattern</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/King+Pattern</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/King+Pattern</comments>
      <pubDate>Fri, 15 Nov 2013 17:23:35 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * King Pattern&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:120:&amp;lt;a href=&amp;quot;http://en.wikipedia.org/wiki/File:Moore_d.gif&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/Moore_d.gif/437736052/Moore_d.gif&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/File:Moore_d.gif&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/Moore_d.gif/437736052/Moore_d.gif&quot; alt=&quot;Moore_d.gif&quot; title=&quot;Moore_d.gif&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:120 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;&lt;strong&gt;King pattern&lt;/strong&gt; are about &lt;strong&gt;king attacks&lt;/strong&gt;, some &lt;a class=&quot;wiki_link&quot; href=&quot;/King%20Safety&quot;&gt;king safety&lt;/a&gt; issues and &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20Endgame&quot;&gt;pawn endgame&lt;/a&gt; related stuff. There is exactly one king per side - the whole game. Not a big issue, but even if white and black kings are member of the &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboard%20Board-Definition&quot;&gt;standard bitboard definition&lt;/a&gt; one may avoid &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan&quot;&gt;bitscanning&lt;/a&gt; whole the time. Even without explicit &lt;a class=&quot;wiki_link&quot; href=&quot;/Piece-Lists&quot;&gt;piece-lists&lt;/a&gt; , one may consider to keep the redundant king-squares &lt;a class=&quot;wiki_link&quot; href=&quot;/Incremental%20Updates&quot;&gt;incrementally updated&lt;/a&gt; during &lt;a class=&quot;wiki_link&quot; href=&quot;/Make%20Move&quot;&gt;make&lt;/a&gt;/&lt;a class=&quot;wiki_link&quot; href=&quot;/Unmake%20Move&quot;&gt;unmake&lt;/a&gt;.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Moore neighborhood  &lt;!-- ws:start:WikiTextRefRule:19:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Moore_neighborhood&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Moore neighborhood from Wikipedia&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:19 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:61:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:61 --&gt;&lt;!-- ws:start:WikiTextTocRule:62: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#King Attacks&quot;&gt;King Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:62 --&gt;&lt;!-- ws:start:WikiTextTocRule:63: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#King Attacks-by Lookup&quot;&gt;by Lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:63 --&gt;&lt;!-- ws:start:WikiTextTocRule:64: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#King Attacks-by Calculation&quot;&gt;by Calculation&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:64 --&gt;&lt;!-- ws:start:WikiTextTocRule:65: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#King Safety&quot;&gt;King Safety&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:65 --&gt;&lt;!-- ws:start:WikiTextTocRule:66: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#King Safety-Pawn-Shield Pattern&quot;&gt;Pawn-Shield Pattern&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:66 --&gt;&lt;!-- ws:start:WikiTextTocRule:67: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#King Safety-Vulnerable on distant Checks&quot;&gt;Vulnerable on distant Checks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:67 --&gt;&lt;!-- ws:start:WikiTextTocRule:68: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#King Safety-Vulnerable on distant Checks-Branchless&quot;&gt;Branchless&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:68 --&gt;&lt;!-- ws:start:WikiTextTocRule:69: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#King Safety-Vulnerable on distant Checks-SSE4&quot;&gt;SSE4&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:69 --&gt;&lt;!-- ws:start:WikiTextTocRule:70: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#King and Pawns&quot;&gt;King and Pawns&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:70 --&gt;&lt;!-- ws:start:WikiTextTocRule:71: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#King and Pawns-Set-wise Rule of the Square&quot;&gt;Set-wise Rule of the Square&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:71 --&gt;&lt;!-- ws:start:WikiTextTocRule:72: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#King and Pawns-Flood Fill Algorithms&quot;&gt;Flood Fill Algorithms&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:72 --&gt;&lt;!-- ws:start:WikiTextTocRule:73: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:73 --&gt;&lt;!-- ws:start:WikiTextTocRule:74: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:74 --&gt;&lt;!-- ws:start:WikiTextTocRule:75: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:75 --&gt;&lt;!-- ws:start:WikiTextTocRule:76: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:76 --&gt;&lt;!-- ws:start:WikiTextTocRule:77: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:77 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:78:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@KingAttacks&amp;quot; title=&amp;quot;Anchor: KingAttacks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;KingAttacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:78 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:31:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;King Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:31 --&gt;King Attacks&lt;/h1&gt;
 The King attacks all squares in &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Moore_neighborhood&quot; rel=&quot;nofollow&quot;&gt;Moore neighborhood&lt;/a&gt;, that is squares with a &lt;a class=&quot;wiki_link&quot; href=&quot;/Distance&quot;&gt;Chebyshev distance&lt;/a&gt; of one.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:33:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;King Attacks-by Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:33 --&gt;by Lookup&lt;/h2&gt;
 Likely we have a the square-index handy, to access a table of precalculated king-attacks.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;U64 arrKingAttacks[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 kingAttacks(enumSquare sq) {return arrKingAttacks[sq];}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;U64 arrKingAttacks[64];
&amp;nbsp;
U64 kingAttacks(enumSquare sq) {return arrKingAttacks[sq];}&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;For instance a king on g2:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . 1 1 1&amp;lt;br/&amp;gt;. . . . . 1 . 1&amp;lt;br/&amp;gt;. . . . . 1 1 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . 1 1 1
. . . . . 1 . 1
. . . . . 1 1 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:79:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@byCalculation&amp;quot; title=&amp;quot;Anchor: byCalculation&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;byCalculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:79 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:35:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;King Attacks-by Calculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:35 --&gt;by Calculation&lt;/h2&gt;
 To calculate all eight &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;directions&lt;/a&gt;, one can actually do some simple &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;parallel prefix stuff&lt;/a&gt;. Rather than to do a union of all eight &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;direction-steps&lt;/a&gt;, one first applies the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;horizontal attacks&lt;/a&gt; considering file-wraps. Those up to two bits are then shifted up and down, together with the king-bitboard itself, to get all the other direction bits:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 kingAttacks(U64 kingSet) {&amp;lt;br/&amp;gt;   U64 attacks = eastOne(kingSet) | westOne(kingSet);&amp;lt;br/&amp;gt;   kingSet    |= attacks;&amp;lt;br/&amp;gt;   attacks    |= nortOne(kingSet) | soutOne(kingSet);&amp;lt;br/&amp;gt;   return attacks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 kingAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 kingSet&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 attacks &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; eastOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;kingSet&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; westOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;kingSet&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   kingSet    &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; attacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attacks    &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; nortOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;kingSet&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; soutOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;kingSet&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;The routine is handy to initialize the kingAttacks &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;arrays&lt;/a&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 sqBB = 1;&amp;lt;br/&amp;gt;for (int sq = 0; sq &amp;amp;lt; 64; sq++, sqBB &amp;amp;lt;&amp;amp;lt;= 1)&amp;lt;br/&amp;gt;   arrKingAttacks[sq] = kingAttacks(sqBB);&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 sqBB &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; sq &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; sq&lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;, sqBB &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
   arrKingAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; kingAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sqBB&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;It must not necessarily called with single-populated bitboards, and is base of &lt;a class=&quot;wiki_link&quot; href=&quot;/King%20Pattern#FloodFillAlgorithms&quot;&gt;king path fill algorithms&lt;/a&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:80:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@KingSafety&amp;quot; title=&amp;quot;Anchor: KingSafety&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;KingSafety&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:80 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:37:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;King Safety&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:37 --&gt;King Safety&lt;/h1&gt;
 &lt;a class=&quot;wiki_link&quot; href=&quot;/King%20Safety&quot;&gt;King Safety&lt;/a&gt; is an important evaluation topic. Some bitboard pattern are about to recognize king safety related features. To evaluate those features is a complete other story.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:39:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc4&quot;&gt;&lt;a name=&quot;King Safety-Pawn-Shield Pattern&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:39 --&gt;Pawn-Shield Pattern&lt;/h2&gt;
 During the &lt;a class=&quot;wiki_link&quot; href=&quot;/Middlegame&quot;&gt;middlegame&lt;/a&gt;, the king is encouraged to hide behind own pawn shields. Beside Considering open and half-open files on king&#039;s and adjacent files, one idea is to mask potential pawn shield pattern per wing of the king file - and to hash it to an appropriate index range to access tables with precalculated stuff. This mask might be used for kings on f1-h1 or f1-h2:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . 1 1 1&amp;lt;br/&amp;gt;. . . . . 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . 1 1 1
. . . . . 1 1 1
. . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:81:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@VulnerableOnDistantChecks&amp;quot; title=&amp;quot;Anchor: VulnerableOnDistantChecks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;VulnerableOnDistantChecks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:81 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:41:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc5&quot;&gt;&lt;a name=&quot;King Safety-Vulnerable on distant Checks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:41 --&gt;Vulnerable on distant Checks&lt;/h2&gt;
 Assuming we are aware of all taboo squares of the king. That is the union of own pieces with all opposite attacks, then we can simply calculate a move target set by relative complement of the king attacks.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;moveTargets = arrKingAttacks[sq] &amp;amp;amp; ~taboo;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;moveTargets = arrKingAttacks[sq] &amp;amp; ~taboo;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;If moveTargets is empty - the king has no move. The king might be vulnerable on distant checks from any &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Pieces&quot;&gt;sliding piece&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;direction&lt;/a&gt;, due to lack of any escape. Otherwise, the king might be vulnerable on distant checks, if escape squares are on one line only - either rank, file, diagonal or anti-diagonal:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;if ( moveTargets == 0 )&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   dirSet = 15; // vulnerable on all lines&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;else&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   dirSet = 0;&amp;lt;br/&amp;gt;   pattern = moveTargets | sqBBofKing;&amp;lt;br/&amp;gt;   if ( pattern &amp;amp;amp; rankBits[sq] == pattern )&amp;lt;br/&amp;gt;      dirSet =  1; // vulnerable on rank, e.g. base rank&amp;lt;br/&amp;gt;   else if ( pattern &amp;amp;amp; fileBits[sq] == pattern )&amp;lt;br/&amp;gt;      dirSet =  2; // vulnerable on file&amp;lt;br/&amp;gt;   else if ( pattern &amp;amp;amp; diagBits[sq] == pattern )&amp;lt;br/&amp;gt;      dirSet =  4; // vulnerable on diagonal&amp;lt;br/&amp;gt;   else if ( pattern &amp;amp;amp; antiBits[sq] == pattern )&amp;lt;br/&amp;gt;      dirSet =  8; // vulnerable on antidiagonal&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; moveTargets &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   dirSet &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// vulnerable on all lines&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   dirSet &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pattern &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; moveTargets &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; sqBBofKing&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; pattern &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rankBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; pattern &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      dirSet &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// vulnerable on rank, e.g. base rank&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; pattern &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; fileBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; pattern &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      dirSet &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// vulnerable on file&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; pattern &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; diagBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; pattern &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      dirSet &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// vulnerable on diagonal&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; pattern &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; antiBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; pattern &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      dirSet &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// vulnerable on antidiagonal&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:43:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc6&quot;&gt;&lt;a name=&quot;King Safety-Vulnerable on distant Checks-Branchless&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:43 --&gt;Branchless&lt;/h3&gt;
Branchless in C - since boolean compare result is treated 0 or 1 arithmetically:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;pattern = moveTargets | sqBBofKing;&amp;lt;br/&amp;gt;dirSet  = ( pattern &amp;amp;amp; rankBits[sq] == pattern ) * 1;&amp;lt;br/&amp;gt;dirSet += ( pattern &amp;amp;amp; fileBits[sq] == pattern ) * 2;&amp;lt;br/&amp;gt;dirSet += ( pattern &amp;amp;amp; diagBits[sq] == pattern ) * 4;&amp;lt;br/&amp;gt;dirSet += ( pattern &amp;amp;amp; antiBits[sq] == pattern ) * 8;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;pattern &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; moveTargets &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; sqBBofKing&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
dirSet  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; pattern &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rankBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; pattern &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
dirSet &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; pattern &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; fileBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; pattern &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
dirSet &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; pattern &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; diagBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; pattern &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
dirSet &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; pattern &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; antiBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; pattern &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;to possibly test later&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;if ( dirSet ) evaluate and look for possible distant mates&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;if ( dirSet ) evaluate and look for possible distant mates&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:82:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@SSE4&amp;quot; title=&amp;quot;Anchor: SSE4&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;SSE4&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:82 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:45:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc7&quot;&gt;&lt;a name=&quot;King Safety-Vulnerable on distant Checks-SSE4&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:45 --&gt;SSE4&lt;/h3&gt;
Using the &lt;a class=&quot;wiki_link&quot; href=&quot;/SSE4#SSE4.1&quot;&gt;SSE4.1&lt;/a&gt; PCMPEQQ &lt;a class=&quot;wiki_link&quot; href=&quot;/Quad%20Word&quot;&gt;Quadword&lt;/a&gt; compare for equality instruction via &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://msdn.microsoft.com/en-us/library/bb513998.aspx&quot; rel=&quot;nofollow&quot;&gt;_mm_cmpeq_epi64&lt;/a&gt; intrinsic, following otherwise &lt;a class=&quot;wiki_link&quot; href=&quot;/SSE2&quot;&gt;SSE2&lt;/a&gt; approach might be applied:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;struct SKingBits {&amp;lt;br/&amp;gt;    U64 rankBits;&amp;lt;br/&amp;gt;    U64 fileBits;&amp;lt;br/&amp;gt;    U64 diagBits;&amp;lt;br/&amp;gt;    U64 antiBits;&amp;lt;br/&amp;gt;} XMM_ALIGN kingBits[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;int dirSet(U64 pattern, int sq)&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   static const U64 XMM_ALIGN weights[4] = {&amp;lt;br/&amp;gt;     C64(0x0000000000000001),&amp;lt;br/&amp;gt;     C64(0x0000000000000002),&amp;lt;br/&amp;gt;     C64(0x0000000000000004),&amp;lt;br/&amp;gt;     C64(0x0000000000000008)&amp;lt;br/&amp;gt;   };&amp;lt;br/&amp;gt;   __m128i x0, x1, x2;&amp;lt;br/&amp;gt;   const __m128i* pKB = (__m128i*)(kingBits + sq);&amp;lt;br/&amp;gt;   const __m128i* pW  = (__m128i*) weights;&amp;lt;br/&amp;gt;   x2 = _mm_cvtsi64x_si128 (pattern);&amp;lt;br/&amp;gt;   x2 = _mm_unpacklo_epi64 (x2, x2);&amp;lt;br/&amp;gt;   x0 = _mm_and_si128   (x2, pKB[0]);&amp;lt;br/&amp;gt;   x1 = _mm_and_si128   (x2, pKB[1]);&amp;lt;br/&amp;gt;   x0 = _mm_cmpeq_epi64 (x0, x2);&amp;lt;br/&amp;gt;   x1 = _mm_cmpeq_epi64 (x1, x2);&amp;lt;br/&amp;gt;   x0 = _mm_and_si128   (x0, pW[0]);&amp;lt;br/&amp;gt;   x1 = _mm_and_si128   (x1, pW[1]);&amp;lt;br/&amp;gt;   x0 = _mm_or_si128    (x0, x1);&amp;lt;br/&amp;gt;   x1 = _mm_unpackhi_epi64 (x0, x0);&amp;lt;br/&amp;gt;   x0 = _mm_or_si128    (x0, x1);&amp;lt;br/&amp;gt;   return _mm_cvtsi128_si32(x0);&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SKingBits &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    U64 rankBits&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    U64 fileBits&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    U64 diagBits&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
    U64 antiBits&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; XMM_ALIGN kingBits&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dirSet&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 pattern, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 XMM_ALIGN weights&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
     C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0000000000000001&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
     C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0000000000000002&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
     C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0000000000000004&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
     C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0000000000000008&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   __m128i x0, x1, x2&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; __m128i&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; pKB &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;__m128i&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;kingBits &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; __m128i&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; pW  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;__m128i&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; weights&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_cvtsi64x_si128 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pattern&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_unpacklo_epi64 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x2, x2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_and_si128   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x2, pKB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_and_si128   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x2, pKB&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_cmpeq_epi64 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x0, x2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_cmpeq_epi64 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x1, x2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_and_si128   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x0, pW&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_and_si128   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x1, pW&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_or_si128    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x0, x1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_unpackhi_epi64 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x0, x0&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   x0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; _mm_or_si128    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x0, x1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; _mm_cvtsi128_si32&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x0&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:9 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:83:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@KingAndPawns&amp;quot; title=&amp;quot;Anchor: KingAndPawns&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;KingAndPawns&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:83 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:47:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc8&quot;&gt;&lt;a name=&quot;King and Pawns&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:47 --&gt;King and Pawns&lt;/h1&gt;
 Some &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20Endgame&quot;&gt;pawn endgame&lt;/a&gt; issues. A set-wise &lt;a class=&quot;wiki_link&quot; href=&quot;/Rule%20of%20the%20Square&quot;&gt;rule of the square&lt;/a&gt; from king&#039;s point of view. Or does a king have a connected path along safe and empty squares to a certain square?&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:84:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@SetwiseRuleoftheSquare&amp;quot; title=&amp;quot;Anchor: SetwiseRuleoftheSquare&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;SetwiseRuleoftheSquare&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:84 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:49:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc9&quot;&gt;&lt;a name=&quot;King and Pawns-Set-wise Rule of the Square&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:49 --&gt;Set-wise Rule of the Square&lt;/h2&gt;
 Assuming a black-king on g5 - white to move. What is the set of squares, where a king can never catch a white &lt;a class=&quot;wiki_link&quot; href=&quot;/Passed%20Pawn&quot;&gt;passer&lt;/a&gt;? Or the inverse, where can passers might be caught, considering the &lt;a class=&quot;wiki_link&quot; href=&quot;/Rule%20of%20the%20Square&quot;&gt;rule of the square&lt;/a&gt;? In this inverse case, where passers may be close enough, there are other aspects to consider like two distant passers, or passer supported by own king - here it is only about &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20race&quot;&gt;races&lt;/a&gt; between passers and opponent king. It is about a set-wise view, where the distance to promotion is greater or equal than the distance of the king. We need to consider &lt;strong&gt;double pushes&lt;/strong&gt; from the initial rank though.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;black king on g5    white passers         double pawn push, need&amp;lt;br/&amp;gt;wtm                 possibly caught       to copy 3rd to 2nd rank&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . K .      . . . 1 1 1 K 1      . . . 1 1 1 K 1&amp;lt;br/&amp;gt;. . . . . . . .      . . 1 1 1 1 1 1      . . 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      . 1 1 1 1 1 1 1      . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1      . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1      1 1 1 1 1 1 1 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;black king on g5    white passers         double pawn push, need
wtm                 possibly caught       to copy 3rd to 2nd rank
. . . . . . . .      . . . . . . . .      . . . . . . . .
. . . . . . . .      . . . . . . . .      . . . . . . . .
. . . . . . . .      . . . . . . . .      . . . . . . . .
. . . . . . K .      . . . 1 1 1 K 1      . . . 1 1 1 K 1
. . . . . . . .      . . 1 1 1 1 1 1      . . 1 1 1 1 1 1
. . . . . . . .      . 1 1 1 1 1 1 1      . 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1      . 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1      1 1 1 1 1 1 1 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;&lt;em&gt;Of course we may even mask off the base ranks since pawns can not exist there - but since we intersect with passers anyway, it don&#039;t cares.&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
We need to consider &lt;a class=&quot;wiki_link&quot; href=&quot;/Tempo&quot;&gt;tempo&lt;/a&gt;, if black to move, the area of caught grows accordantly:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:11:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;black king on g5    white passers&amp;lt;br/&amp;gt;btm                 possibly caught&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . K K K      . . . 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . K K K      . . 1 1 1 1 K 1&amp;lt;br/&amp;gt;. . . . . K K K      . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .      1 1 1 1 1 1 1 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;black king on g5    white passers
btm                 possibly caught
. . . . . . . .      . . . . . . . .
. . . . . . . .      . . . . . . . .
. . . . . K K K      . . . 1 1 1 1 1
. . . . . K K K      . . 1 1 1 1 K 1
. . . . . K K K      . 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1
. . . . . . . .      1 1 1 1 1 1 1 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:11 --&gt;&lt;br /&gt;
We can now pre-initialize an &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt; of &lt;strong&gt;caught pawn area&lt;/strong&gt; for each king square, for both black and white king as well as &lt;a class=&quot;wiki_link&quot; href=&quot;/side%20to%20move&quot;&gt;side to move&lt;/a&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:12:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;U64 arrCaughtableArea[2][2][64];  // [color of king][side to move][square]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;unCaughtable = whitePassers &amp;amp;amp; ~arrCaughtableArea[black][white][squareOfBlackKing];&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;U64 arrCaughtableArea[2][2][64];  // [color of king][side to move][square]
&amp;nbsp;
unCaughtable = whitePassers &amp;amp; ~arrCaughtableArea[black][white][squareOfBlackKing];&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:12 --&gt;How can the array be initialized, how can we calculate it? That is already some special fill approach. For the mentioned black king, wtm case, we use the rank-distance of the black king to the 8th rank.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:13:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;distance = rank(kingSquare) ^ 7; // 7 - rank&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;. . . . 3 . . .&amp;lt;br/&amp;gt;. . . . 2 . . .&amp;lt;br/&amp;gt;. . . . 1 . . .&amp;lt;br/&amp;gt;. . . . K . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;distance = rank(kingSquare) ^ 7; // 7 - rank
&amp;nbsp;
. . . . 3 . . .
. . . . 2 . . .
. . . . 1 . . .
. . . . K . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:13 --&gt;One solution is first expand the king-set distance (3) times, in east and west direction along the rank:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:14:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;caughtable = kingBB;&amp;lt;br/&amp;gt;for (i = 0; i &amp;amp;lt; distance; i++)&amp;lt;br/&amp;gt;   caughtable |= westOne(caughtable) | eastOne(caughtable);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . 1 1 1     . . . . 1 1 1 1      . . . 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;caughtable = kingBB;
for (i = 0; i &amp;lt; distance; i++)
   caughtable |= westOne(caughtable) | eastOne(caughtable);
&amp;nbsp;
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . . . 1 1 1     . . . . 1 1 1 1      . . . 1 1 1 1 1
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:14 --&gt;Now it is about filling south-west and south-east rank(kingSquare) times, which finally results in the desired set of  catchable passers. Special handling is required for the doubles pushes &lt;!-- ws:start:WikiTextRefRule:20:&amp;amp;lt;ref&amp;amp;gt;Thanks to Thomas Herges for pointing out a bug if kings are on the eighth rank&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:20 --&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:15:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;for (i = 0; i &amp;amp;lt; rank(kingSquare)-2; i++)&amp;lt;br/&amp;gt;   caughtable |= soutOne(westOne(caughtable) | caughtable | eastOne(caughtable) );&amp;lt;br/&amp;gt;caughtable |= soutOne(caughtable) | 0xff;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .      . . . . . . . .&amp;lt;br/&amp;gt;. . . 1 1 1 1 1     . . . 1 1 1 1 1      . . . 1 1 1 1 1&amp;lt;br/&amp;gt;. . 1 1 1 1 1 1     . . 1 1 1 1 1 1      . . 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .     . 1 1 1 1 1 1 1   |  . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .   |  . 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .   v  1 1 1 1 1 1 1 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;for (i = 0; i &amp;lt; rank(kingSquare)-2; i++)
   caughtable |= soutOne(westOne(caughtable) | caughtable | eastOne(caughtable) );
caughtable |= soutOne(caughtable) | 0xff;
&amp;nbsp;
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . . . . . .     . . . . . . . .      . . . . . . . .
. . . 1 1 1 1 1     . . . 1 1 1 1 1      . . . 1 1 1 1 1
. . 1 1 1 1 1 1     . . 1 1 1 1 1 1      . . 1 1 1 1 1 1
. . . . . . . .     . 1 1 1 1 1 1 1   |  . 1 1 1 1 1 1 1
. . . . . . . .     . . . . . . . .   |  . 1 1 1 1 1 1 1
. . . . . . . .     . . . . . . . .   v  1 1 1 1 1 1 1 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:15 --&gt;&lt;br /&gt;
To initialize black to move and white king arrays should not that difficult either - and is left to the ambitious reader.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:85:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@FloodFillAlgorithms&amp;quot; title=&amp;quot;Anchor: FloodFillAlgorithms&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;FloodFillAlgorithms&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:85 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:51:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc10&quot;&gt;&lt;a name=&quot;King and Pawns-Flood Fill Algorithms&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:51 --&gt;Flood Fill Algorithms&lt;/h2&gt;
 Answering questions like can a king on a1 reach h8 along this path?&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:16:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;. . . . . . 1 T&amp;lt;br/&amp;gt;. . 1 1 1 1 . .&amp;lt;br/&amp;gt;. 1 . . . . . .&amp;lt;br/&amp;gt;. . 1 1 1 1 . .&amp;lt;br/&amp;gt;. . . . . . 1 .&amp;lt;br/&amp;gt;. . . . . . . 1&amp;lt;br/&amp;gt;. . . . . . 1 .&amp;lt;br/&amp;gt;F 1 1 1 1 1 . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;. . . . . . 1 T
. . 1 1 1 1 . .
. 1 . . . . . .
. . 1 1 1 1 . .
. . . . . . 1 .
. . . . . . . 1
. . . . . . 1 .
F 1 1 1 1 1 . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:16 --&gt;The &lt;strong&gt;squaresAreConnected&lt;/strong&gt; flood-fill &lt;!-- ws:start:WikiTextRefRule:22:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Flood_fill&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Flood Fill from Wikipedia&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:22 --&gt; algorithm was introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:26:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.stmintz.com/ccc/index.php?id=251180.&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: algorithm question&amp;lt;/a&amp;gt; answer by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Steffan%20Westcott&amp;quot;&amp;gt;Steffan Westcott&amp;lt;/a&amp;gt; in &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt; September 09, 2002&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:26 --&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;tt&gt;A flood fill algorithm, like the one below, starting at the &amp;quot;from&amp;quot; square and stopping if the fill hits the to&amp;quot; square or the fill can&#039;t make any more progress. The fill progresses in all directions at once, so should return an answer within a few iterations. Each iteration is pretty fast too, as it just a bunch of shifting and logic operations. And no lookup tables either.&lt;/tt&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:17:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/////////////////////////////////////////////////////////////////////////&amp;lt;br/&amp;gt;//&amp;lt;br/&amp;gt;// Returns true if a path of set bits in &#039;path&#039; exists that 8-way connect&amp;lt;br/&amp;gt;// any set bit in sq1 to any set bit of sq2&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;bool squaresAreConnected(U64 sq1, U64 sq2, U64 path)&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   // With bitboard sq1, do an 8-way flood fill, masking off bits not in&amp;lt;br/&amp;gt;   // path at every step. Stop when fill reaches any set bit in sq2, or&amp;lt;br/&amp;gt;   // fill cannot progress any further&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   if (!(sq1 &amp;amp;amp;= path) || !(sq2 &amp;amp;amp;= path)) return false;&amp;lt;br/&amp;gt;                      // Drop bits not in path&amp;lt;br/&amp;gt;                      // Early exit if sq1 or sq2 not on any path&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   while(!(sq1 &amp;amp;amp; sq2))&amp;lt;br/&amp;gt;   {&amp;lt;br/&amp;gt;      U64 temp = sq1;&amp;lt;br/&amp;gt;      sq1 |= eastOne(sq1) | westOne(sq1);    // Set all 8 neighbours&amp;lt;br/&amp;gt;      sq1 |= soutOne(sq1) | nortOne(sq1);&amp;lt;br/&amp;gt;      sq1 &amp;amp;amp;= path;                           // Drop bits not in path&amp;lt;br/&amp;gt;      if (sq1 == temp) return false;         // Fill has stopped&amp;lt;br/&amp;gt;   }&amp;lt;br/&amp;gt;   return true;                              // Found a good path&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;co1&quot;&gt;/////////////////////////////////////////////////////////////////////////&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;//&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;// Returns true if a path of set bits in &#039;path&#039; exists that 8-way connect&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;// any set bit in sq1 to any set bit of sq2&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;bool&lt;/span&gt; squaresAreConnected&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 sq1, U64 sq2, U64 path&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;co1&quot;&gt;// With bitboard sq1, do an 8-way flood fill, masking off bits not in&lt;/span&gt;
   &lt;span class=&quot;co1&quot;&gt;// path at every step. Stop when fill reaches any set bit in sq2, or&lt;/span&gt;
   &lt;span class=&quot;co1&quot;&gt;// fill cannot progress any further&lt;/span&gt;
&amp;nbsp;
   &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; path&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq2 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; path&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
                      &lt;span class=&quot;co1&quot;&gt;// Drop bits not in path&lt;/span&gt;
                      &lt;span class=&quot;co1&quot;&gt;// Early exit if sq1 or sq2 not on any path&lt;/span&gt;
&amp;nbsp;
   &lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; sq2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
      U64 temp &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sq1&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      sq1 &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; eastOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; westOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;    &lt;span class=&quot;co1&quot;&gt;// Set all 8 neighbours&lt;/span&gt;
      sq1 &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; soutOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; nortOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
      sq1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; path&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;                           &lt;span class=&quot;co1&quot;&gt;// Drop bits not in path&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq1 &lt;span class=&quot;sy1&quot;&gt;==&lt;/span&gt; temp&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;         &lt;span class=&quot;co1&quot;&gt;// Fill has stopped&lt;/span&gt;
   &lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;                              &lt;span class=&quot;co1&quot;&gt;// Found a good path&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:17 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:53:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc11&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:53 --&gt;See also&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/All%20Shortest%20Paths&quot;&gt;All shortest Paths&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fill%20Algorithms&quot;&gt;Fill Algorithms&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Mate%20at%20a%20Glance&quot;&gt;Mate at a Glance&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:55:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc12&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:55 --&gt;External Links&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Checkmate_pattern&quot; rel=&quot;nofollow&quot;&gt;Checkmate pattern from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://store.bowerykitchens.com/noname42.html&quot; rel=&quot;nofollow&quot;&gt;King&#039;s Pattern Flatware - Spoons/Teaspoon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#AmonDuul&quot;&gt;Amon Düül II&lt;/a&gt; - Archangel Thunderbird (1971), &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video &lt;!-- ws:start:WikiTextRefRule:28:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Male_and_Female&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Male and Female -  1919 American silent adventure/drama film - Wikipedia&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:28 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:29:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/custom/24429004?h=0&amp;amp;w=0&amp;quot; class=&amp;quot;WikiMedia WikiMediaCustom&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;custom&amp;amp;quot; key=&amp;amp;quot;24429004&amp;amp;quot;&amp;quot; title=&amp;quot;Custom Media&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;//www.youtube.com/embed/_pcla5zyZfA?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:29 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:57:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc13&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:57 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:234:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Moore_neighborhood&quot; rel=&quot;nofollow&quot;&gt;Moore neighborhood from Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; Thanks to Thomas Herges for pointing out a bug if kings are on the eighth rank&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Flood_fill&quot; rel=&quot;nofollow&quot;&gt;Flood Fill from Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=251180.&quot; rel=&quot;nofollow&quot;&gt;Re: algorithm question&lt;/a&gt; answer by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt; September 09, 2002&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Male_and_Female&quot; rel=&quot;nofollow&quot;&gt;Male and Female -  1919 American silent adventure/drama film - Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:234 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:59:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc14&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:59 --&gt;What links here?&lt;/h1&gt;
&lt;!-- ws:start:WikiTextIncludeRule:018:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;King Pattern&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;King Pattern&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-King_Pattern includeBody-King%20Pattern includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/All+Shortest+Paths&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;All Shortest Paths&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Blockage+Detection&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Blockage Detection&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 19, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Blockers+and+Beyond&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Blockers and Beyond&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chunking&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chunking&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 12, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Daniel+Shawul&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Daniel Shawul&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 28, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Demolito&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Demolito&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/DirGolem&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;DirGolem&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Evaluation+Patterns&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Evaluation Patterns&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 24, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fill+Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fill Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 6, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Helmut+Horacek&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Helmut Horacek&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 31, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hex&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hex&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 29, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Iteration&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Iteration&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/King&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;King&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 26, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/King+Pattern&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;King Pattern&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 15, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/King+Safety&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;King Safety&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 14, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/KPK&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;KPK&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 12, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mate+at+a+Glance&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mate at a Glance&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 24, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Morph&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Morph&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 7, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Nirvanachess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Nirvanachess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Passed+Pawn&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Passed Pawn&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 11, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Passed+Pawns+%28Bitboards%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Passed Pawns (Bitboards)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 23, 2010&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pattern+Recognition&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pattern Recognition&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 8, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pawn+Endgame&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pawn Endgame&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 11, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pawn+Race&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pawn Race&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 16, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/PawnKing&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;PawnKing&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 5, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pieces+versus+Directions&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pieces versus Directions&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 6, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rule+of+the+Square&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rule of the Square&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 6, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Searcher&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Searcher&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 26, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Pieces&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Pieces&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 3, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Square+Attacked+By&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Square Attacked By&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 20, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Squares&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Squares&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 15, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SSE4&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SSE4&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Steffan+Westcott&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Steffan Westcott&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Unstoppable+Passer&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Unstoppable Passer&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 21, 2016&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:018 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Knight Pattern</title>
      <link>https://chessprogramming.wikispaces.com/Knight+Pattern</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Knight+Pattern</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Knight+Pattern</comments>
      <pubDate>Mon, 23 Feb 2015 19:45:51 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * Knight Pattern&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:118:&amp;lt;a href=&amp;quot;http://www.mcescher.com/Shopmain/ShopEU/facsilimeprints/prints.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/Horseman.jpg/157877355/232x238/Horseman.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;height: 238px; width: 232px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://www.mcescher.com/Shopmain/ShopEU/facsilimeprints/prints.html&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/Horseman.jpg/157877355/232x238/Horseman.jpg&quot; alt=&quot;Horseman.jpg&quot; title=&quot;Horseman.jpg&quot; style=&quot;height: 238px; width: 232px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:118 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;&lt;strong&gt;Knight Pattern&lt;/strong&gt;&lt;br /&gt;
with Bitboards covers &lt;a class=&quot;wiki_link&quot; href=&quot;/Knight&quot;&gt;knight&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Attacks&quot;&gt;attacks&lt;/a&gt; of single or multiple knights, either by indexed pre-calculated tables or direct bitboard calculation, and the set wise determination of &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Fork_%28chess%29&quot; rel=&quot;nofollow&quot;&gt;Knight fork&lt;/a&gt; target squares.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#Escher&quot;&gt;M. C. Escher&lt;/a&gt;, Horseman &lt;!-- ws:start:WikiTextRefRule:11:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.mcescher.com/Shopmain/ShopEU/facsilimeprints/prints.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;View facsimile print&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.mcescher.com/Shopmain/ShopEU/facsilimeprints/&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;M.C. Escher - 16 Facsimile Prints&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:11 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:38:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:38 --&gt;&lt;!-- ws:start:WikiTextTocRule:39: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Knight Attacks&quot;&gt;Knight Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:39 --&gt;&lt;!-- ws:start:WikiTextTocRule:40: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Knight Attacks-by Lookup&quot;&gt;by Lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:40 --&gt;&lt;!-- ws:start:WikiTextTocRule:41: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Knight Attacks-by Calculation&quot;&gt;by Calculation&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:41 --&gt;&lt;!-- ws:start:WikiTextTocRule:42: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Multiple Knight Attacks&quot;&gt;Multiple Knight Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:42 --&gt;&lt;!-- ws:start:WikiTextTocRule:43: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Knight Fill&quot;&gt;Knight Fill&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:43 --&gt;&lt;!-- ws:start:WikiTextTocRule:44: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Knight Forks&quot;&gt;Knight Forks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:44 --&gt;&lt;!-- ws:start:WikiTextTocRule:45: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:45 --&gt;&lt;!-- ws:start:WikiTextTocRule:46: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Selected Publications&quot;&gt;Selected Publications&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:46 --&gt;&lt;!-- ws:start:WikiTextTocRule:47: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forum Posts&quot;&gt;Forum Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:47 --&gt;&lt;!-- ws:start:WikiTextTocRule:48: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:48 --&gt;&lt;!-- ws:start:WikiTextTocRule:49: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:49 --&gt;&lt;!-- ws:start:WikiTextTocRule:50: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:50 --&gt;&lt;!-- ws:start:WikiTextTocRule:51: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:51 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:52:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@KnightAttacks&amp;quot; title=&amp;quot;Anchor: KnightAttacks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;KnightAttacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:52 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:14:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Knight Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:14 --&gt;Knight Attacks&lt;/h1&gt;
 The &lt;a class=&quot;wiki_link&quot; href=&quot;/Knight&quot;&gt;Knight&lt;/a&gt; attacks the &lt;a class=&quot;wiki_link&quot; href=&quot;/Target%20square&quot;&gt;target squares&lt;/a&gt; independently from other pieces around. The compass rose of all eight attacking &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;directions&lt;/a&gt; associated with the to - from square differences from an &lt;a class=&quot;wiki_link&quot; href=&quot;/8x8%20Board&quot;&gt;8x8 board&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;        noNoWe    noNoEa&amp;lt;br/&amp;gt;            +15  +17&amp;lt;br/&amp;gt;             |     |&amp;lt;br/&amp;gt;noWeWe  +6 __|     |__+10  noEaEa&amp;lt;br/&amp;gt;              \   /&amp;lt;br/&amp;gt;               &amp;amp;gt;0&amp;amp;lt;&amp;lt;br/&amp;gt;           __ /   \ __&amp;lt;br/&amp;gt;soWeWe -10   |     |   -6  soEaEa&amp;lt;br/&amp;gt;             |     |&amp;lt;br/&amp;gt;            -17  -15&amp;lt;br/&amp;gt;        soSoWe    soSoEa&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;        noNoWe    noNoEa
            +15  +17
             |     |
noWeWe  +6 __|     |__+10  noEaEa
              \   /
               &amp;gt;0&amp;lt;
           __ /   \ __
soWeWe -10   |     |   -6  soEaEa
             |     |
            -17  -15
        soSoWe    soSoEa&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:53:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@ByLookup&amp;quot; title=&amp;quot;Anchor: ByLookup&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;ByLookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:53 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:16:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Knight Attacks-by Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:16 --&gt;by Lookup&lt;/h2&gt;
 The knight is specified by square index, likely from a &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitscan&quot;&gt;bitscan&lt;/a&gt; of a piece-wise &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboard%20Serialization&quot;&gt;bitboard serialization&lt;/a&gt; of a knight bitboard from a &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboard%20Board-Definition&quot;&gt;standard board-definition&lt;/a&gt;, to index a table of pre-calculated knight-attacks:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 arrKnightAttacks[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 knightAttacks(enumSquare sq) {return arrKnightAttacks[sq];}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 arrKnightAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 knightAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; arrKnightAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;For instance a knight on d4&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;arrKnightAttacks[d4]&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . . 1 . 1 . . .&amp;lt;br/&amp;gt; . 1 . . . 1 . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;br/&amp;gt; . 1 . . . 1 . .&amp;lt;br/&amp;gt; . . 1 . 1 . . .&amp;lt;br/&amp;gt; . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;arrKnightAttacks[d4]
 . . . . . . . .
 . . . . . . . .
 . . 1 . 1 . . .
 . 1 . . . 1 . .
 . . . . . . . .
 . 1 . . . 1 . .
 . . 1 . 1 . . .
 . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:54:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Calculation&amp;quot; title=&amp;quot;Anchor: Calculation&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Calculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:54 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:18:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Knight Attacks-by Calculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:18 --&gt;by Calculation&lt;/h2&gt;
 Similar to &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;one step only&lt;/a&gt; of the four orthogonal and four diagonal directions,each of the eight knight directions is calculated by left or right shift with appropriate pre- or post shift mask, to avoid A- H-file wraps or vice versa. See also &lt;a class=&quot;wiki_link&quot; href=&quot;/AVX2#KnightAttacks&quot;&gt;AVX2 Knight Attacks&lt;/a&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 noNoEa(U64 b) {return (b &amp;amp;lt;&amp;amp;lt; 17) &amp;amp;amp; notAFile ;}&amp;lt;br/&amp;gt;U64 noEaEa(U64 b) {return (b &amp;amp;lt;&amp;amp;lt; 10) &amp;amp;amp; notABFile;}&amp;lt;br/&amp;gt;U64 soEaEa(U64 b) {return (b &amp;amp;gt;&amp;amp;gt;  6) &amp;amp;amp; notABFile;}&amp;lt;br/&amp;gt;U64 soSoEa(U64 b) {return (b &amp;amp;gt;&amp;amp;gt; 15) &amp;amp;amp; notAFile ;}&amp;lt;br/&amp;gt;U64 noNoWe(U64 b) {return (b &amp;amp;lt;&amp;amp;lt; 15) &amp;amp;amp; notHFile ;}&amp;lt;br/&amp;gt;U64 noWeWe(U64 b) {return (b &amp;amp;lt;&amp;amp;lt;  6) &amp;amp;amp; notGHFile;}&amp;lt;br/&amp;gt;U64 soWeWe(U64 b) {return (b &amp;amp;gt;&amp;amp;gt; 10) &amp;amp;amp; notGHFile;}&amp;lt;br/&amp;gt;U64 soSoWe(U64 b) {return (b &amp;amp;gt;&amp;amp;gt; 17) &amp;amp;amp; notHFile ;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 noNoEa(U64 b) {return (b &amp;amp;amp; notHFile ) &amp;amp;lt;&amp;amp;lt; 17;}&amp;lt;br/&amp;gt;U64 noEaEa(U64 b) {return (b &amp;amp;amp; notGHFile) &amp;amp;lt;&amp;amp;lt; 10;}&amp;lt;br/&amp;gt;U64 soEaEa(U64 b) {return (b &amp;amp;amp; notGHFile) &amp;amp;gt;&amp;amp;gt;  6;}&amp;lt;br/&amp;gt;U64 soSoEa(U64 b) {return (b &amp;amp;amp; notHFile ) &amp;amp;gt;&amp;amp;gt; 15;}&amp;lt;br/&amp;gt;U64 noNoWe(U64 b) {return (b &amp;amp;amp; notAFile ) &amp;amp;lt;&amp;amp;lt; 15;}&amp;lt;br/&amp;gt;U64 noWeWe(U64 b) {return (b &amp;amp;amp; notABFile) &amp;amp;lt;&amp;amp;lt;  6;}&amp;lt;br/&amp;gt;U64 soWeWe(U64 b) {return (b &amp;amp;amp; notABFile) &amp;amp;gt;&amp;amp;gt; 10;}&amp;lt;br/&amp;gt;U64 soSoWe(U64 b) {return (b &amp;amp;amp; notAFile ) &amp;amp;gt;&amp;amp;gt; 17;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 noNoEa&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noEaEa&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notABFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soEaEa&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notABFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soSoEa&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noNoWe&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notHFile &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noWeWe&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notGHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soWeWe&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notGHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soSoWe&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notHFile &lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 noNoEa&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notHFile &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noEaEa&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notGHFile&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soEaEa&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notGHFile&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soSoEa&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notHFile &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noNoWe&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noWeWe&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notABFile&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soWeWe&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notABFile&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soSoWe&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; notAFile &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;In almost the same manner as the three pawn directions, there is a unique source-target relationship. The difference is - we have up to eight pawns, but likely not more than two knights per side. Keeping eight disjoint knight directions is consistent to direction-wise &lt;a class=&quot;wiki_link&quot; href=&quot;/Fill%20Algorithms&quot;&gt;fill approaches&lt;/a&gt; of other pieces with unique &lt;a class=&quot;wiki_link&quot; href=&quot;/Target%20Square&quot;&gt;target&lt;/a&gt;-&lt;a class=&quot;wiki_link&quot; href=&quot;/Origin%20Square&quot;&gt;source&lt;/a&gt; relationship - but disjoint direction-wise knight targets are sparse populated and usually contain only up to two bits.&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:55:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@MultipleKnightAttacks&amp;quot; title=&amp;quot;Anchor: MultipleKnightAttacks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;MultipleKnightAttacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:55 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:20:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Multiple Knight Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:20 --&gt;Multiple Knight Attacks&lt;/h1&gt;
 To initialize the KnightAttacks &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt; one may use a routine with some kind of &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;parallel prefix&lt;/a&gt; calculations, rather than the union of all eight directions:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 knightAttacks(U64 knights) {&amp;lt;br/&amp;gt;   U64 west, east, attacks;&amp;lt;br/&amp;gt;   east     = eastOne (knights);&amp;lt;br/&amp;gt;   west     = westOne (knights);&amp;lt;br/&amp;gt;   attacks  = (east|west) &amp;amp;lt;&amp;amp;lt; 16;&amp;lt;br/&amp;gt;   attacks |= (east|west) &amp;amp;gt;&amp;amp;gt; 16;&amp;lt;br/&amp;gt;   east     = eastOne (east);&amp;lt;br/&amp;gt;   west     = westOne (west);&amp;lt;br/&amp;gt;   attacks |= (east|west) &amp;amp;lt;&amp;amp;lt;  8;&amp;lt;br/&amp;gt;   attacks |= (east|west) &amp;amp;gt;&amp;amp;gt;  8;&amp;lt;br/&amp;gt;   return attacks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 knightAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 knights&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 west, east, attacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   east     &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; eastOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;knights&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   west     &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; westOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;knights&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attacks  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east&lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;west&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attacks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east&lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;west&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   east     &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; eastOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   west     &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; westOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;west&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attacks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east&lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;west&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attacks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east&lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;west&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; attacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;or to possibly gain some more parallelism:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 knightAttacks(U64 knights) {&amp;lt;br/&amp;gt;   U64 l1 = (knights &amp;amp;gt;&amp;amp;gt; 1) &amp;amp;amp; C64(0x7f7f7f7f7f7f7f7f);&amp;lt;br/&amp;gt;   U64 l2 = (knights &amp;amp;gt;&amp;amp;gt; 2) &amp;amp;amp; C64(0x3f3f3f3f3f3f3f3f);&amp;lt;br/&amp;gt;   U64 r1 = (knights &amp;amp;lt;&amp;amp;lt; 1) &amp;amp;amp; C64(0xfefefefefefefefe);&amp;lt;br/&amp;gt;   U64 r2 = (knights &amp;amp;lt;&amp;amp;lt; 2) &amp;amp;amp; C64(0xfcfcfcfcfcfcfcfc);&amp;lt;br/&amp;gt;   U64 h1 = l1 | r1;&amp;lt;br/&amp;gt;   U64 h2 = l2 | r2;&amp;lt;br/&amp;gt;   return (h1&amp;amp;lt;&amp;amp;lt;16) | (h1&amp;amp;gt;&amp;amp;gt;16) | (h2&amp;amp;lt;&amp;amp;lt;8) | (h2&amp;amp;gt;&amp;amp;gt;8);&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 knightAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 knights&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 l1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;knights &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 l2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;knights &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x3f3f3f3f3f3f3f3f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 r1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;knights &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 r2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;knights &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xfcfcfcfcfcfcfcfc&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 h1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; l1 &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; r1&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 h2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; l2 &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; r2&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;h1&lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;h1&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;h2&lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;h2&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;If we pass multiple knights set-wise, attacks of some squares may be caused by different knights. Feeding back (safe) target sets, the routine may used to get sets of squares, knights may reach in two or more moves. For instance in late pawn-knight endings whether a knight may catch a passer.&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:56:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@KnightFill&amp;quot; title=&amp;quot;Anchor: KnightFill&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;KnightFill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:56 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:22:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Knight Fill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:22 --&gt;Knight Fill&lt;/h1&gt;
 A fill cycle for a &lt;a class=&quot;wiki_link&quot; href=&quot;/Fill%20Algorithms&quot;&gt;fill algorithm&lt;/a&gt; is the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Union&quot;&gt;union&lt;/a&gt; of the attack set with the knights itself:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 knightFill(U64 knights) {return knightAttacks(knights) | knights;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 knightFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 knights&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; knightAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;knights&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; knights&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;for instance applied six times on the otherwise empty board:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;                  1. Fill            2. Fill            3. Fill&amp;lt;br/&amp;gt;. . . . . . . .   . . . . . . . .   . . . . . . . .   . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .   . . . . . . . .   . . . . . . . .   . 1 . 1 . . . .&amp;lt;br/&amp;gt;. . . . . . . .   . . . . . . . .   . . . . . . . .   1 . 1 . 1 . . .&amp;lt;br/&amp;gt;. . . . . . . .   . . . . . . . .   1 . 1 . . . . .   1 1 1 1 . 1 . .&amp;lt;br/&amp;gt;. . . . . . . .   . . . . . . . .   . 1 . 1 . . . .   1 1 1 1 1 . 1 .&amp;lt;br/&amp;gt;. . . . . . . .   . 1 . . . . . .   1 1 . . 1 . . .   1 1 . 1 1 1 . .&amp;lt;br/&amp;gt;. . . . . . . .   . . 1 . . . . .   . . 1 1 . . . .   1 . 1 1 1 . 1 .&amp;lt;br/&amp;gt;1 . . . . . . .   1 . . . . . . .   1 . 1 . 1 . . .   1 1 1 1 1 1 . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;                  4. Fill            5. Fill            6. Fill&amp;lt;br/&amp;gt;                  . 1 . 1 . 1 . .   1 1 1 1 1 1 1 .   1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;                  1 1 1 1 1 . 1 .   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;                  1 1 1 1 1 1 . 1   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;                  1 1 1 1 1 1 1 .   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;                  1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;                  1 1 1 1 1 1 1 .   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;                  1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;                  1 1 1 1 1 1 1 .   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;                  1. Fill            2. Fill            3. Fill
. . . . . . . .   . . . . . . . .   . . . . . . . .   . . . . . . . .
. . . . . . . .   . . . . . . . .   . . . . . . . .   . 1 . 1 . . . .
. . . . . . . .   . . . . . . . .   . . . . . . . .   1 . 1 . 1 . . .
. . . . . . . .   . . . . . . . .   1 . 1 . . . . .   1 1 1 1 . 1 . .
. . . . . . . .   . . . . . . . .   . 1 . 1 . . . .   1 1 1 1 1 . 1 .
. . . . . . . .   . 1 . . . . . .   1 1 . . 1 . . .   1 1 . 1 1 1 . .
. . . . . . . .   . . 1 . . . . .   . . 1 1 . . . .   1 . 1 1 1 . 1 .
1 . . . . . . .   1 . . . . . . .   1 . 1 . 1 . . .   1 1 1 1 1 1 . .
&amp;nbsp;
                  4. Fill            5. Fill            6. Fill
                  . 1 . 1 . 1 . .   1 1 1 1 1 1 1 .   1 1 1 1 1 1 1 1
                  1 1 1 1 1 . 1 .   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1
                  1 1 1 1 1 1 . 1   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1
                  1 1 1 1 1 1 1 .   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1
                  1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1
                  1 1 1 1 1 1 1 .   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1
                  1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1
                  1 1 1 1 1 1 1 .   1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:57:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@KnightForks&amp;quot; title=&amp;quot;Anchor: KnightForks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;KnightForks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:57 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:24:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Knight Forks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:24 --&gt;Knight Forks&lt;/h1&gt;
 A common knight pattern is the knight fork. Targets are heavy pieces - king, queen and rooks, &lt;a class=&quot;wiki_link&quot; href=&quot;/Hanging%20Piece&quot;&gt;hanging pieces&lt;/a&gt;, or even undefended pawns. A royal knight fork or &amp;quot;family&amp;quot; check, winning the queen is most important. Otherwise one may loop over all possible pieces, to get the knight-attacks by lookup and to intersect all combinations of attack-squares. A loop- and branch-less solution to get potential fork-attack squares is to union all intersections of all direction attacks, as explained in &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#GreaterOne&quot;&gt;greater one sets&lt;/a&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 forkTargetSquare(U64 targets) {&amp;lt;br/&amp;gt;   U64 west, east, attak, forks;&amp;lt;br/&amp;gt;   east   = eastOne (targets);&amp;lt;br/&amp;gt;   west   = westOne (targets);&amp;lt;br/&amp;gt;   attak  =  east &amp;amp;lt;&amp;amp;lt; 16;&amp;lt;br/&amp;gt;   forks  = (west &amp;amp;lt;&amp;amp;lt; 16) &amp;amp;amp; attak;&amp;lt;br/&amp;gt;   attak |=  west &amp;amp;lt;&amp;amp;lt; 16;&amp;lt;br/&amp;gt;   forks |= (east &amp;amp;gt;&amp;amp;gt; 16) &amp;amp;amp; attak;&amp;lt;br/&amp;gt;   attak |=  east &amp;amp;gt;&amp;amp;gt; 16;&amp;lt;br/&amp;gt;   forks |= (west &amp;amp;gt;&amp;amp;gt; 16) &amp;amp;amp; attak;&amp;lt;br/&amp;gt;   attak |=  west &amp;amp;gt;&amp;amp;gt; 16;&amp;lt;br/&amp;gt;   east   = eastOne (east);&amp;lt;br/&amp;gt;   west   = westOne (west);&amp;lt;br/&amp;gt;   forks |= (east &amp;amp;lt;&amp;amp;lt;  8) &amp;amp;amp; attak;&amp;lt;br/&amp;gt;   attak |=  east &amp;amp;lt;&amp;amp;lt;  8;&amp;lt;br/&amp;gt;   forks |= (west &amp;amp;lt;&amp;amp;lt;  8) &amp;amp;amp; attak;&amp;lt;br/&amp;gt;   attak |=  west &amp;amp;lt;&amp;amp;lt;  8;&amp;lt;br/&amp;gt;   forks |= (east &amp;amp;gt;&amp;amp;gt;  8) &amp;amp;amp; attak;&amp;lt;br/&amp;gt;   attak |=  east &amp;amp;gt;&amp;amp;gt;  8;&amp;lt;br/&amp;gt;   forks |= (west &amp;amp;gt;&amp;amp;gt;  8) &amp;amp;amp; attak;&amp;lt;br/&amp;gt;   return forks;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 forkTargetSquare&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 targets&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 west, east, attak, forks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   east   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; eastOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;targets&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   west   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; westOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;targets&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attak  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  east &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forks  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;west &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; attak&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attak &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  west &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; attak&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attak &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  east &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;west &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; attak&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attak &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  west &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   east   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; eastOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   west   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; westOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;west&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; attak&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attak &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  east &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;west &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; attak&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attak &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  west &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;east &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; attak&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   attak &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  east &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   forks &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;west &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; attak&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; forks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;The intersection of those targets with squares not occupied by own pieces or attacked by opponent pawns and knights, but attacked by own knight(s) leaves a move target set with some forced properties.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:26:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc6&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:26 --&gt;See also&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/AVX2#KnightAttacks&quot;&gt;AVX2 Knight Attacks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fill%20Algorithms&quot;&gt;Fill Algorithms&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Knight-Distance&quot;&gt;Knight-Distance&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:28:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Selected Publications&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:28 --&gt;Selected Publications&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Martin%20Gardner&quot;&gt;Martin Gardner&lt;/a&gt; (&lt;strong&gt;1967&lt;/strong&gt;). &lt;em&gt;Problems that are Built on the Knight&#039;s Tour in Chess&lt;/em&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/Scientific%20American&quot;&gt;Scientific American&lt;/a&gt;, Vol. 130&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Noam%20Elkies&quot;&gt;Noam D. Elkies&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Mathematician#RPStanley&quot;&gt;Richard P. Stanley&lt;/a&gt; (&lt;strong&gt;2003&lt;/strong&gt;). &lt;em&gt;The Mathematical Knight&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/The_Mathematical_Intelligencer&quot; rel=&quot;nofollow&quot;&gt;The Mathematical Intelligencer&lt;/a&gt;, Vol. 25, No. 1, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.math.harvard.edu/%7Eelkies/knight.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Ben Hill (&lt;strong&gt;2004&lt;/strong&gt;). &lt;em&gt;Knight’s Tours&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://faculty.olin.edu/~sadams/DM/ktpaper.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://scholar.google.com/citations?user=QNcGZdQAAAAJ&amp;amp;hl=de&quot; rel=&quot;nofollow&quot;&gt;Philip Hingston&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Graham%20Kendall&quot;&gt;Graham Kendall&lt;/a&gt; (&lt;strong&gt;2005&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.graham-kendall.com/publications/displaypub.php?key=hk2005a&amp;amp;filename=gxk.bib&quot; rel=&quot;nofollow&quot;&gt;Ant Colonies Discover Knight&#039;s Tours&lt;/a&gt;&lt;/em&gt;. AI 2004, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.springer.com/computer/ai/book/978-3-540-24059-4&quot; rel=&quot;nofollow&quot;&gt;Lecture Notes in Computer Science 3339&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://scholar.google.com/citations?user=QNcGZdQAAAAJ&amp;amp;hl=de&quot; rel=&quot;nofollow&quot;&gt;Philip Hingston&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Graham%20Kendall&quot;&gt;Graham Kendall&lt;/a&gt; (&lt;strong&gt;2005&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.graham-kendall.com/publications/displaypub.php?key=hk2005&amp;amp;filename=gxk.bib&quot; rel=&quot;nofollow&quot;&gt;Enumerating knight&#039;s tours using an ant colony algorithm&lt;/a&gt;&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.informatik.uni-trier.de/~ley/db/conf/cec/cec2005.html&quot; rel=&quot;nofollow&quot;&gt;CEC 2005&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:30:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:30 --&gt;Forum Posts&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=354355&quot; rel=&quot;nofollow&quot;&gt;Symbolic: From bitboards to ideas&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steven%20Edwards&quot;&gt;Steven Edwards&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 13, 2004 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Symbolic&quot;&gt;Symbolic&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=55118&quot; rel=&quot;nofollow&quot;&gt;knight&#039;s multiple atacks&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Daniel%20Anulliero&quot;&gt;Daniel Anulliero&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 27, 2015&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:32:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc9&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:32 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Knight%27s_tour&quot; rel=&quot;nofollow&quot;&gt;Knight&#039;s tour from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.mayhematics.com/t/t.htm&quot; rel=&quot;nofollow&quot;&gt;Knight&#039;s Tour Notes compiled by George Jelliss&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://mathworld.wolfram.com/KnightsTour.html&quot; rel=&quot;nofollow&quot;&gt;Knight&#039;s Tour - from Wolfram MathWorld&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Longest_uncrossed_knight%27s_path&quot; rel=&quot;nofollow&quot;&gt;Longest uncrossed knight&#039;s path from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/L%C3%A1szl%C3%B3%20Lindner&quot;&gt;László Lindner&#039;s&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://archive.is/bHju8&quot; rel=&quot;nofollow&quot;&gt;knight wheel&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Frederic%20Friedel&quot;&gt;Frederic Friedel&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/ChessBase&quot;&gt;ChessBase Puzzle&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://graham-kendall.com/blog/2014/01/knights-tours/&quot; rel=&quot;nofollow&quot;&gt;Knight&#039;s Tour&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://graham-kendall.com/blog/&quot; rel=&quot;nofollow&quot;&gt;Research Reflections&lt;/a&gt;  by &lt;a class=&quot;wiki_link&quot; href=&quot;/Graham%20Kendall&quot;&gt;Graham Kendall&lt;/a&gt;, January 18, 2014&lt;/li&gt;&lt;li&gt;Knight&#039;s Tour - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.numberphile.com/&quot; rel=&quot;nofollow&quot;&gt;Numberphile&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:12:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/custom/25086882?h=0&amp;amp;w=0&amp;quot; class=&amp;quot;WikiMedia WikiMediaCustom&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;custom&amp;amp;quot; key=&amp;amp;quot;25086882&amp;amp;quot;&amp;quot; title=&amp;quot;Custom Media&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/ab_dY3dZFHM?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:12 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:34:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc10&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:34 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:242:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.mcescher.com/Shopmain/ShopEU/facsilimeprints/prints.html&quot; rel=&quot;nofollow&quot;&gt;View facsimile print&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.mcescher.com/Shopmain/ShopEU/facsilimeprints/&quot; rel=&quot;nofollow&quot;&gt;M.C. Escher - 16 Facsimile Prints&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:242 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:36:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc11&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:36 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:09:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Knight Pattern&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;60&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Knight Pattern&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;60&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Knight_Pattern includeBody-Knight%20Pattern includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/AVX2&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;AVX2&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 8, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Blockers+and+Beyond&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Blockers and Beyond&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chunking&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chunking&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 12, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Combination&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Combination&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 25, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Decoying&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Decoying&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 12, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/DirGolem&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;DirGolem&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Double+Attack&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Double Attack&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 22, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fill+Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fill Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 6, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/General+Setwise+Operations&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;General Setwise Operations&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Graham+Kendall&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Graham Kendall&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 26, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hanging+Piece&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hanging Piece&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Jonathan+Warkentin&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Jonathan Warkentin&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 29, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Killer+%28NL%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Killer (NL)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 15, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Knight+Pattern&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Knight Pattern&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 23, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Knight-Distance&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Knight-Distance&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 20, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Knowledge&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Knowledge&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 22, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Loose+Piece&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Loose Piece&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 10, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mathematician&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mathematician&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 9, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pattern+Recognition&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pattern Recognition&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 8, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pieces+versus+Directions&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pieces versus Directions&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 6, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Square+Attacked+By&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Square Attacked By&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 20, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Symbolic&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Symbolic&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 8, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tactics&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tactics&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 12, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Zillions+of+Games&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Zillions of Games&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 29, 2017&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:09 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Kogge-Stone Algorithm</title>
      <link>https://chessprogramming.wikispaces.com/Kogge-Stone+Algorithm</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Kogge-Stone+Algorithm</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Kogge-Stone+Algorithm</comments>
      <pubDate>Sat, 17 Sep 2016 21:52:19 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Kogge-Stone Algorithm&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:131:&amp;lt;a href=&amp;quot;https://en.wikipedia.org/wiki/Kogge-Stone_adder&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/300px-4_bit_Kogge_Stone_Adder_Example_new.png/415347274/300px-4_bit_Kogge_Stone_Adder_Example_new.png&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;width: 240px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Kogge-Stone_adder&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/300px-4_bit_Kogge_Stone_Adder_Example_new.png/415347274/300px-4_bit_Kogge_Stone_Adder_Example_new.png&quot; alt=&quot;300px-4_bit_Kogge_Stone_Adder_Example_new.png&quot; title=&quot;300px-4_bit_Kogge_Stone_Adder_Example_new.png&quot; style=&quot;width: 240px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:131 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;The &lt;strong&gt;Kogge-Stone Algorithm&lt;/strong&gt; for set-wise &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Pieces&quot;&gt;sliding piece&lt;/a&gt; attack generation was first introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:11:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.stmintz.com/ccc/index.php?id=252289&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: flood fill attack bitboards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Steffan%20Westcott&amp;quot;&amp;gt;Steffan Westcott&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, September 15, 2002&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:11 --&gt; . It is a &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;parallel prefix&lt;/a&gt; approach of a occluded &lt;a class=&quot;wiki_link&quot; href=&quot;/Dumb7Fill&quot;&gt;dumb7&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Flood_fill&quot; rel=&quot;nofollow&quot;&gt;flood-fill&lt;/a&gt;, propagating sliding piece attacks like &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Carry_(arithmetic)&quot; rel=&quot;nofollow&quot;&gt;carries&lt;/a&gt; of a &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Kogge-Stone_adder&quot; rel=&quot;nofollow&quot;&gt;Kogge-Stone&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Combinatorial%20Logic#Adder&quot;&gt;hardware adder&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:14:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.aoki.ecei.tohoku.ac.jp/arith/mg/algorithm.html#fsa_pfx&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Hardware algorithms for arithmetic modules&amp;lt;/a&amp;gt; from the ARITH research group, Aoki lab., &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Tohoku_University&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Tohoku University&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:14 --&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms#KoggeStoneAdder&quot;&gt;software&lt;/a&gt;. One needs to pass sliding pieces as generator set &amp;quot;g&amp;quot; and the set of empty squares as propagator set &amp;quot;p&amp;quot;. For appropriate attacks we need to shift the occluded fill &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;one step&lt;/a&gt; further, considering wraps.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;4-bit Kogge-Stone adder &lt;!-- ws:start:WikiTextRefRule:16:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Kogge-Stone_adder&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Kogge-Stone adder from Wikipedia&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:16 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:54:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:54 --&gt;&lt;!-- ws:start:WikiTextTocRule:55: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Parallel Prefix&quot;&gt;Parallel Prefix&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:55 --&gt;&lt;!-- ws:start:WikiTextTocRule:56: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Direction-wise Fill&quot;&gt;Direction-wise Fill&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:56 --&gt;&lt;!-- ws:start:WikiTextTocRule:57: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Direction-wise Fill-Fill on an empty Board&quot;&gt;Fill on an empty Board&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:57 --&gt;&lt;!-- ws:start:WikiTextTocRule:58: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Direction-wise Fill-Occluded Fill&quot;&gt;Occluded Fill&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:58 --&gt;&lt;!-- ws:start:WikiTextTocRule:59: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Direction-wise Fill-Ray-wise Attacks&quot;&gt;Ray-wise Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:59 --&gt;&lt;!-- ws:start:WikiTextTocRule:60: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Generalized Rays&quot;&gt;Generalized Rays&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:60 --&gt;&lt;!-- ws:start:WikiTextTocRule:61: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:61 --&gt;&lt;!-- ws:start:WikiTextTocRule:62: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Publications&quot;&gt;Publications&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:62 --&gt;&lt;!-- ws:start:WikiTextTocRule:63: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forum Posts&quot;&gt;Forum Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:63 --&gt;&lt;!-- ws:start:WikiTextTocRule:64: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:64 --&gt;&lt;!-- ws:start:WikiTextTocRule:65: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:65 --&gt;&lt;!-- ws:start:WikiTextTocRule:66: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:66 --&gt;&lt;!-- ws:start:WikiTextTocRule:67: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:67 --&gt;&lt;!-- ws:start:WikiTextIncludeRule:08:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/page?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; title=&amp;quot;Include page: page=&amp;amp;quot;MappingHint&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;

&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a href=&quot;/Square%20Mapping%20Considerations&quot;&gt;&lt;img src=&quot;/file/view/mapping.JPG/93134172/mapping.JPG&quot; alt=&quot;mapping.JPG&quot; title=&quot;mapping.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;td&gt;&lt;em&gt;Code samples and bitboard diagrams rely on &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations#LittleEndianRankFileMapping&quot;&gt;Little endian file and rank mapping&lt;/a&gt;&lt;/em&gt;.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:end:WikiTextIncludeRule:08 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:30:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Parallel Prefix&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:30 --&gt;Parallel Prefix&lt;/h1&gt;
 &lt;tt&gt;The routine fillUpOccluded() smears the set bits of bitboard g upwards, but only along set bits of p; a reset bit in p is enough to halt a smear. Other routines have a similar effect.&lt;/tt&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 fillUpOccluded(U64 g, U64 p) {&amp;lt;br/&amp;gt;   g |= p &amp;amp;amp; (g &amp;amp;lt;&amp;amp;lt;  8);&amp;lt;br/&amp;gt;   p &amp;amp;amp;=     (p &amp;amp;lt;&amp;amp;lt;  8);&amp;lt;br/&amp;gt;   g |= p &amp;amp;amp; (g &amp;amp;lt;&amp;amp;lt; 16);&amp;lt;br/&amp;gt;   p &amp;amp;amp;=     (p &amp;amp;lt;&amp;amp;lt; 16);&amp;lt;br/&amp;gt;   g |= p &amp;amp;amp; (g &amp;amp;lt;&amp;amp;lt; 32);&amp;lt;br/&amp;gt;   return g;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 fillUpOccluded&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 g, U64 p&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   g &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; p &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;g &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   p &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;     &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;p &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   g &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; p &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;g &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   p &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;     &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;p &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   g &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; p &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;g &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; g&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;tt&gt;The method chosen in FillUpOccluded() is based on a Kogge-Stone parallel prefix network, because it can be implemented very easily in software. The diagram below (trust me, it really _is_ supposed to look like that) is an illustration of how it works. The corresponding lines of program code are shown on the right. The inputs are fed into the network at the top, pass along the connecting lines, are combined by the # operator at various points, and the outputs appear at the bottom.&lt;/tt&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;x1 x2 x3 x4 x5 x6 x7 x8         Input : g, p&amp;lt;br/&amp;gt;|  |  |  |  |  |  |  |&amp;lt;br/&amp;gt;V  V  V  V  V  V  V  V&amp;lt;br/&amp;gt;|  |  |  |  |  |  |  |&amp;lt;br/&amp;gt;|  |  |  |  |  |  |  |&amp;lt;br/&amp;gt;|\ |\ |\ |\ |\ |\ |\ |&amp;lt;br/&amp;gt;| \| \| \| \| \| \| \|&amp;lt;br/&amp;gt;|  #  #  #  #  #  #  #          g |= p &amp;amp;amp; (g &amp;amp;lt;&amp;amp;lt;  8);&amp;lt;br/&amp;gt;|  |  |  |  |  |  |  |          p &amp;amp;amp;=     (p &amp;amp;lt;&amp;amp;lt;  8);&amp;lt;br/&amp;gt;|\ |\ |\ |\ |\ |\ |  |&amp;lt;br/&amp;gt;| \: \: \: \: \: \:  |&amp;lt;br/&amp;gt;|  \  \  \  \  \  \  |&amp;lt;br/&amp;gt;|  :\ :\ :\ :\ :\ :\ |&amp;lt;br/&amp;gt;|  | \| \| \| \| \| \|&amp;lt;br/&amp;gt;|  |  #  #  #  #  #  #          g |= p &amp;amp;amp; (g &amp;amp;lt;&amp;amp;lt; 16);&amp;lt;br/&amp;gt;|  |  |  |  |  |  |  |          p &amp;amp;amp;=     (p &amp;amp;lt;&amp;amp;lt; 16);&amp;lt;br/&amp;gt;|\ |\ |\ |\ |  |  |  |&amp;lt;br/&amp;gt;| \: \: \: \:  |  |  |&amp;lt;br/&amp;gt;|  \  \  \  \  |  |  |&amp;lt;br/&amp;gt;|  :\ :\ :\ :\ |  |  |&amp;lt;br/&amp;gt;|  | \: \: \: \:  |  |&amp;lt;br/&amp;gt;|  |  \  \  \  \  |  |&amp;lt;br/&amp;gt;|  |  :\ :\ :\ :\ |  |&amp;lt;br/&amp;gt;|  |  | \: \: \: \:  |&amp;lt;br/&amp;gt;|  |  |  \  \  \  \  |&amp;lt;br/&amp;gt;|  |  |  ;\ ;\ :\ :\ |&amp;lt;br/&amp;gt;|  |  |  | \| \| \| \|&amp;lt;br/&amp;gt;|  |  |  |  #  #  #  #          g |= p &amp;amp;amp; (g &amp;amp;lt;&amp;amp;lt; 32);&amp;lt;br/&amp;gt;|  |  |  |  |  |  |  |&amp;lt;br/&amp;gt;|  |  |  |  |  |  |  |&amp;lt;br/&amp;gt;V  V  V  V  V  V  V  V&amp;lt;br/&amp;gt;q1 q2 q3 q4 q5 q6 q7 q8         Output : g&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;x1 x2 x3 x4 x5 x6 x7 x8         Input : g, p
|  |  |  |  |  |  |  |
V  V  V  V  V  V  V  V
|  |  |  |  |  |  |  |
|  |  |  |  |  |  |  |
|\ |\ |\ |\ |\ |\ |\ |
| \| \| \| \| \| \| \|
|  #  #  #  #  #  #  #          g |= p &amp;amp; (g &amp;lt;&amp;lt;  8);
|  |  |  |  |  |  |  |          p &amp;amp;=     (p &amp;lt;&amp;lt;  8);
|\ |\ |\ |\ |\ |\ |  |
| \: \: \: \: \: \:  |
|  \  \  \  \  \  \  |
|  :\ :\ :\ :\ :\ :\ |
|  | \| \| \| \| \| \|
|  |  #  #  #  #  #  #          g |= p &amp;amp; (g &amp;lt;&amp;lt; 16);
|  |  |  |  |  |  |  |          p &amp;amp;=     (p &amp;lt;&amp;lt; 16);
|\ |\ |\ |\ |  |  |  |
| \: \: \: \:  |  |  |
|  \  \  \  \  |  |  |
|  :\ :\ :\ :\ |  |  |
|  | \: \: \: \:  |  |
|  |  \  \  \  \  |  |
|  |  :\ :\ :\ :\ |  |
|  |  | \: \: \: \:  |
|  |  |  \  \  \  \  |
|  |  |  ;\ ;\ :\ :\ |
|  |  |  | \| \| \| \|
|  |  |  |  #  #  #  #          g |= p &amp;amp; (g &amp;lt;&amp;lt; 32);
|  |  |  |  |  |  |  |
|  |  |  |  |  |  |  |
V  V  V  V  V  V  V  V
q1 q2 q3 q4 q5 q6 q7 q8         Output : g&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:32:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Direction-wise Fill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:32 --&gt;Direction-wise Fill&lt;/h1&gt;
 &lt;em&gt;We further rely on the &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Compass_rose&quot; rel=&quot;nofollow&quot;&gt;compass rose&lt;/a&gt; to identify &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;ray-directions&lt;/a&gt;.&lt;/em&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;  noWe         nort         noEa&amp;lt;br/&amp;gt;          +7    +8    +9&amp;lt;br/&amp;gt;              \  |  /&amp;lt;br/&amp;gt;  west    -1 &amp;amp;lt;-  0 -&amp;amp;gt; +1    east&amp;lt;br/&amp;gt;              /  |  \&amp;lt;br/&amp;gt;          -9    -8    -7&amp;lt;br/&amp;gt;  soWe         sout         soEa&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;  noWe         nort         noEa
          +7    +8    +9
              \  |  /
  west    -1 &amp;lt;-  0 -&amp;gt; +1    east
              /  |  \
          -9    -8    -7
  soWe         sout         soEa&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;Assuming &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations#LittleEndianRankFileMapping&quot;&gt;little-endian&lt;/a&gt; file mapping. Big-endian file mapping has to swap A and H and east and west. As a reminder - &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#ShiftingBitboards&quot;&gt;shifting bitboards&lt;/a&gt; - the base of further stuff.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:68:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Fillonanemptyboard&amp;quot; title=&amp;quot;Anchor: Fillonanemptyboard&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Fillonanemptyboard&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:68 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:34:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Direction-wise Fill-Fill on an empty Board&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:34 --&gt;Fill on an empty Board&lt;/h2&gt;
 We already used the south- and north- &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;parallel prefix&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20Fills&quot;&gt;fill-routines&lt;/a&gt; while calculating &lt;a class=&quot;wiki_link&quot; href=&quot;/Pawn%20Spans&quot;&gt;pawn spans&lt;/a&gt;. We need one additional direction step for ray-attacks on the otherwise empty board to exclude sliders. Convenient to initialize &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#RayAttacks&quot;&gt;ray-attacks&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;arrays&lt;/a&gt; of single sliders. We may conduct those routines from the general occluded fills by passing the universal propagator set. The vertical fills already look familiar.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutFill(U64 gen) {&amp;lt;br/&amp;gt;   gen |= (gen &amp;amp;gt;&amp;amp;gt;  8);&amp;lt;br/&amp;gt;   gen |= (gen &amp;amp;gt;&amp;amp;gt; 16);&amp;lt;br/&amp;gt;   gen |= (gen &amp;amp;gt;&amp;amp;gt; 32);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 nortFill(U64 gen) {&amp;lt;br/&amp;gt;   gen |= (gen &amp;amp;lt;&amp;amp;lt;  8);&amp;lt;br/&amp;gt;   gen |= (gen &amp;amp;lt;&amp;amp;lt; 16);&amp;lt;br/&amp;gt;   gen |= (gen &amp;amp;lt;&amp;amp;lt; 32);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 nortFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;Using explicit propagators as compile time constants to manage the A-, H-file-wraps.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 eastFill(U64 gen) {&amp;lt;br/&amp;gt;   const U64 pr0 = notAFile;&amp;lt;br/&amp;gt;   const U64 pr1 = pr0 &amp;amp;amp; (pr0 &amp;amp;lt;&amp;amp;lt; 1);&amp;lt;br/&amp;gt;   const U64 pr2 = pr1 &amp;amp;amp; (pr1 &amp;amp;lt;&amp;amp;lt; 2);&amp;lt;br/&amp;gt;   gen |= pr0 &amp;amp;amp; (gen  &amp;amp;lt;&amp;amp;lt; 1);&amp;lt;br/&amp;gt;   gen |= pr1 &amp;amp;amp; (gen  &amp;amp;lt;&amp;amp;lt; 2);&amp;lt;br/&amp;gt;   gen |= pr2 &amp;amp;amp; (gen  &amp;amp;lt;&amp;amp;lt; 4);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 noEaFill(U64 gen) {&amp;lt;br/&amp;gt;   const U64 pr0 = notAFile;&amp;lt;br/&amp;gt;   const U64 pr1 = pr0 &amp;amp;amp; (pr0 &amp;amp;lt;&amp;amp;lt;  9);&amp;lt;br/&amp;gt;   const U64 pr2 = pr1 &amp;amp;amp; (pr1 &amp;amp;lt;&amp;amp;lt; 18);&amp;lt;br/&amp;gt;   gen |= pr0 &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt;  9);&amp;lt;br/&amp;gt;   gen |= pr1 &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 18);&amp;lt;br/&amp;gt;   gen |= pr2 &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 36);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 soEaFill(U64 gen) {&amp;lt;br/&amp;gt;   const U64 pr0 = notAFile;&amp;lt;br/&amp;gt;   const U64 pr1 = pr0 &amp;amp;amp; (pr0 &amp;amp;gt;&amp;amp;gt;  7);&amp;lt;br/&amp;gt;   const U64 pr2 = pr1 &amp;amp;amp; (pr1 &amp;amp;gt;&amp;amp;gt; 14);&amp;lt;br/&amp;gt;   gen |= pr0 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt;  7);&amp;lt;br/&amp;gt;   gen |= pr1 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 14);&amp;lt;br/&amp;gt;   gen |= pr2 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 28);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 westFill(U64 gen) {&amp;lt;br/&amp;gt;   const U64 pr0 = notHFile;&amp;lt;br/&amp;gt;   const U64 pr1 = pr0 &amp;amp;amp; (pr0 &amp;amp;gt;&amp;amp;gt; 1);&amp;lt;br/&amp;gt;   const U64 pr2 = pr1 &amp;amp;amp; (pr1 &amp;amp;gt;&amp;amp;gt; 2);&amp;lt;br/&amp;gt;   gen |= pr0 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 1);&amp;lt;br/&amp;gt;   gen |= pr1 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 2);&amp;lt;br/&amp;gt;   gen |= pr2 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 4);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 soWeFill(U64 gen) {&amp;lt;br/&amp;gt;   const U64 pr0 = notHFile;&amp;lt;br/&amp;gt;   const U64 pr1 = pr0 &amp;amp;amp; (pr0 &amp;amp;gt;&amp;amp;gt;  9);&amp;lt;br/&amp;gt;   const U64 pr2 = pr1 &amp;amp;amp; (pr1 &amp;amp;gt;&amp;amp;gt; 18);&amp;lt;br/&amp;gt;   gen |= pr0 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt;  9);&amp;lt;br/&amp;gt;   gen |= pr1 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 18);&amp;lt;br/&amp;gt;   gen |= pr2 &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 36);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 noWeFill(U64 gen) {&amp;lt;br/&amp;gt;   const U64 pr0 = notHFile;&amp;lt;br/&amp;gt;   const U64 pr1 = pr0 &amp;amp;amp; (pr0 &amp;amp;lt;&amp;amp;lt;  7);&amp;lt;br/&amp;gt;   const U64 pr2 = pr1 &amp;amp;amp; (pr1 &amp;amp;lt;&amp;amp;lt; 14);&amp;lt;br/&amp;gt;   gen |= pr0 &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt;  7);&amp;lt;br/&amp;gt;   gen |= pr1 &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 14);&amp;lt;br/&amp;gt;   gen |= pr2 &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 28);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 eastFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr0 &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr1 &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen  &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen  &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr2 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen  &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 noEaFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr0 &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr1 &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr2 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 soEaFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr0 &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr1 &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr2 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 westFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr0 &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr1 &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr2 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 soWeFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr0 &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr1 &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr2 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 noWeFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr0 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr1 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr0 &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 pr2 &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pr1 &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr0 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr1 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pr2 &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:69:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@OccludedFill&amp;quot; title=&amp;quot;Anchor: OccludedFill&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;OccludedFill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:69 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:36:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Direction-wise Fill-Occluded Fill&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:36 --&gt;Occluded Fill&lt;/h2&gt;
 Occluded fills include sliders, but exclude blockers &lt;!-- ws:start:WikiTextRefRule:20:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=22038&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Kogge Stone Algorithm mistake on chessprogramming Wiki&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Christopher%20Conkie&amp;quot;&amp;gt;Christopher Conkie&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, June 29, 2008&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:20 --&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt;  8);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;gt;&amp;amp;gt;  8);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 16);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;gt;&amp;amp;gt; 16);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 32);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 nortOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt;  8);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;lt;&amp;amp;lt;  8);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 16);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;lt;&amp;amp;lt; 16);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 32);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 eastOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   pro &amp;amp;amp;= notAFile;&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 1);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;lt;&amp;amp;lt; 1);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 2);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;lt;&amp;amp;lt; 2);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 4);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 noEaOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   pro &amp;amp;amp;= notAFile;&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt;  9);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;lt;&amp;amp;lt;  9);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 18);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;lt;&amp;amp;lt; 18);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 36);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 soEaOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   pro &amp;amp;amp;= notAFile;&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt;  7);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;gt;&amp;amp;gt;  7);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 14);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;gt;&amp;amp;gt; 14);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 28);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 westOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   pro &amp;amp;amp;= notHFile;&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 1);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;gt;&amp;amp;gt; 1);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 2);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;gt;&amp;amp;gt; 2);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 4);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 soWeOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   pro &amp;amp;amp;= notHFile;&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt;  9);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;gt;&amp;amp;gt;  9);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 18);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;gt;&amp;amp;gt; 18);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;gt;&amp;amp;gt; 36);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 noWeOccl(U64 gen, U64 pro) {&amp;lt;br/&amp;gt;   pro &amp;amp;amp;= notHFile;&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt;  7);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;lt;&amp;amp;lt;  7);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 14);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       (pro &amp;amp;lt;&amp;amp;lt; 14);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; (gen &amp;amp;lt;&amp;amp;lt; 28);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 nortOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 eastOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 noEaOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 soEaOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notAFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 westOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 soWeOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 noWeOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; notHFile&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:38:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Direction-wise Fill-Ray-wise Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:38 --&gt;Ray-wise Attacks&lt;/h2&gt;
 Ray-wise attacks need the occluded fills &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#OneStepOnly&quot;&gt;shift one&lt;/a&gt; further, considering wraps.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 soutAttacks (U64 rooks,   U64 empty) {return soutOne(soutOccl(rooks,   empty));}&amp;lt;br/&amp;gt;U64 nortAttacks (U64 rooks,   U64 empty) {return nortOne(nortOccl(rooks,   empty));}&amp;lt;br/&amp;gt;U64 eastAttacks (U64 rooks,   U64 empty) {return eastOne(eastOccl(rooks,   empty));}&amp;lt;br/&amp;gt;U64 noEaAttacks (U64 bishops, U64 empty) {return noEaOne(noEaOccl(bishops, empty));}&amp;lt;br/&amp;gt;U64 soEaAttacks (U64 bishops, U64 empty) {return soEaOne(soEaOccl(bishops, empty));}&amp;lt;br/&amp;gt;U64 westAttacks (U64 rooks,   U64 empty) {return westOne(westOccl(rooks,   empty));}&amp;lt;br/&amp;gt;U64 soWeAttacks (U64 bishops, U64 empty) {return soWeOne(soWeOccl(bishops, empty));}&amp;lt;br/&amp;gt;U64 noWeAttacks (U64 bishops, U64 empty) {return noWeOne(noWeOccl(bishops, empty));}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 soutAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks,   U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; soutOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;soutOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks,   empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 nortAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks,   U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; nortOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;nortOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks,   empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 eastAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks,   U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; eastOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;eastOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks,   empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noEaAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bishops, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; noEaOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;noEaOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops, empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soEaAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bishops, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; soEaOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;soEaOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops, empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 westAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 rooks,   U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; westOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;westOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rooks,   empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 soWeAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bishops, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; soWeOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;soWeOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops, empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 noWeAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 bishops, U64 empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; noWeOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;noWeOccl&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bishops, empty&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:70:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@GeneralizedRays&amp;quot; title=&amp;quot;Anchor: GeneralizedRays&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;GeneralizedRays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:70 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:40:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Generalized Rays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:40 --&gt;Generalized Rays&lt;/h1&gt;
 Since &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Rotate&quot;&gt;rotate 64&lt;/a&gt; works like a &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#GeneralizedShift&quot;&gt;generalized shift&lt;/a&gt; with positive or negative shift amount, it might be applied to get pawn-attacks for both sides - or a Kogge-Stone fill with a direction parameter and small lookups for shift amount and wrap ands, instead of multiple code for eight directions. Of course generalized shift will be a bit slower due to lookups and using cl as the shift amount register.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 occludedFill (U64 gen, U64 pro, int dir8)&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   int r = shift[dir8]; // {+-1,7,8,9}&amp;lt;br/&amp;gt;   pro &amp;amp;amp;= avoidWrap[dir8];&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; rotateLeft(gen, r);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       rotateLeft(pro, r);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; rotateLeft(gen, 2*r);&amp;lt;br/&amp;gt;   pro &amp;amp;amp;=       rotateLeft(pro, 2*r);&amp;lt;br/&amp;gt;   gen |= pro &amp;amp;amp; rotateLeft(gen, 4*r);&amp;lt;br/&amp;gt;   return gen;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 shiftOne (U64 b, int dir8)&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   int r = shift[dir8]; // {+-1,7,8,9}&amp;lt;br/&amp;gt;   return rotateLeft(b, r) &amp;amp;amp; avoidWrap[dir8];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 slidingAttacks (U64 sliders, U64 empty, int dir8)&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   U64 fill = occludedFill(slider, empty, dir8)&amp;lt;br/&amp;gt;   return shiftOne(fill, dir8);&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;// positve left, negative right shifts&amp;lt;br/&amp;gt;int shift[8] = {9, 1,-7,-8,-9,-1, 7, 8};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 avoidWrap[8] =&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   0xfefefefefefefe00,&amp;lt;br/&amp;gt;   0xfefefefefefefefe,&amp;lt;br/&amp;gt;   0x00fefefefefefefe,&amp;lt;br/&amp;gt;   0x00ffffffffffffff,&amp;lt;br/&amp;gt;   0x007f7f7f7f7f7f7f,&amp;lt;br/&amp;gt;   0x7f7f7f7f7f7f7f7f,&amp;lt;br/&amp;gt;   0x7f7f7f7f7f7f7f00,&amp;lt;br/&amp;gt;   0xffffffffffffff00,&amp;lt;br/&amp;gt;};&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 occludedFill &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 gen, U64 pro, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; r &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// {+-1,7,8,9}&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; avoidWrap&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen, r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro, r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen, &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;       rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pro, &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   gen &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pro &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;gen, &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; gen&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 shiftOne &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; r &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// {+-1,7,8,9}&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; rotateLeft&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b, r&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; avoidWrap&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;dir8&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 slidingAttacks &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 sliders, U64 empty, &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 fill &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; occludedFill&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;slider, empty, dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; shiftOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;fill, dir8&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;// positve left, negative right shifts&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;,&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;,&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;,&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 avoidWrap&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefe00&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0xfefefefefefefefe&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x00fefefefefefefe&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x00ffffffffffffff&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x007f7f7f7f7f7f7f&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f7f&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0x7f7f7f7f7f7f7f00&lt;/span&gt;,
   &lt;span class=&quot;nu12&quot;&gt;0xffffffffffffff00&lt;/span&gt;,
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:42:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc6&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:42 --&gt;See also&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&#039;s&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms#FurtherElaborationsOnKoggeStone&quot;&gt;Elaboration on Kogge-Stone algorithm&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms#KoggeStoneAdder&quot;&gt;Add/Sub versus Attacks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Design%20Principles&quot;&gt;Design Principles&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Dumb7Fill&quot;&gt;Dumb7Fill&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fill%20by%20Subtraction&quot;&gt;Fill by Subtraction&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fill%20Algorithms&quot;&gt;Fill Algorithms&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces%20versus%20Directions&quot;&gt;Pieces versus Directions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/SSE2#SSE2WrapperinCpp&quot;&gt;SSE2-Wrapper&lt;/a&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/Cpp&quot;&gt;C++&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:44:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Publications&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:44 --&gt;Publications&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.cse.nd.edu/%7Ekogge/&quot; rel=&quot;nofollow&quot;&gt;Peter M. Kogge&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Mathematician#HSStone&quot;&gt;Harold S. Stone&lt;/a&gt; (&lt;strong&gt;1973&lt;/strong&gt;). &lt;em&gt;A Parallel Algorithm for the Efficient Solution of a General Class of Recurrence Equations&lt;/em&gt;. IEEE Transactions on Computers, 1973, C-22, 783-791, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://bwrc.eecs.berkeley.edu/Classes/ee225c/2000%20225c/Papers/KoggeStone.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:46:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:46 --&gt;Forum Posts&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=252289&quot; rel=&quot;nofollow&quot;&gt;Re: flood fill attack bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, September 15, 2002&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=22038&quot; rel=&quot;nofollow&quot;&gt;Kogge Stone Algorithm mistake on chessprogramming Wiki&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Christopher%20Conkie&quot;&gt;Christopher Conkie&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, June 29, 2008&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?start=0&amp;amp;t=25979&amp;amp;start=10&quot; rel=&quot;nofollow&quot;&gt;Re: Hyperbola Quiesscene: hardly any improvement&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Karlo%20Bala%20Jr.&quot;&gt;Karlo Bala Jr.&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 14, 2009 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Hyperbola%20Quintessence&quot;&gt;Hyperbola Quintessence&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=46974&quot; rel=&quot;nofollow&quot;&gt;Kogge Stone, Vector Based&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Srdja%20Matovic&quot;&gt;Srdja Matovic&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 22, 2013 » &lt;a class=&quot;wiki_link&quot; href=&quot;/GPU&quot;&gt;GPU&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:22:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Parallel_Thread_Execution&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Parallel Thread Execution from Wikipedia&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:22 --&gt; &lt;!-- ws:start:WikiTextRefRule:24:&amp;amp;lt;ref&amp;amp;gt;NVIDIA Compute PTX: Parallel Thread Execution, ISA Version 1.4, March 31, 2009, &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.nvidia.com/content/CUDA-ptx_isa_1.4.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;pdf&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-6&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-6&quot;&gt;[6]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:24 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=48387&quot; rel=&quot;nofollow&quot;&gt;Fast perft on GPU (upto 20 Billion nps w/o hashing)&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Ankan%20Banerjee&quot;&gt;Ankan Banerjee&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, June 22, 2013 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Perft&quot;&gt;Perft&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/GPU&quot;&gt;GPU&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:48:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc9&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:48 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Kogge-Stone_adder&quot; rel=&quot;nofollow&quot;&gt;Kogge-Stone adder from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://terra.fendrich.se/Terra%20Help-1763.htm&quot; rel=&quot;nofollow&quot;&gt;Kogge-Stone algorithm&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://terra.fendrich.se/Terra%20Help-1647.htm&quot; rel=&quot;nofollow&quot;&gt;Terra Help and Information - Theories&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Peter%20Fendrich&quot;&gt;Peter Fendrich&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#Gong&quot;&gt;Gong&lt;/a&gt; - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Shapeshifter_%28Gong_album%29&quot; rel=&quot;nofollow&quot;&gt;Shapeshifter&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:26:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Shapeshifting&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Shapeshifting from Wikipedia&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-7&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-7&quot;&gt;[7]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:26 --&gt;, 1992, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:27:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/youtube/0AZVy2coi6c?h=315&amp;amp;w=480&amp;quot; class=&amp;quot;WikiMedia WikiMediaYoutube&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;youtube&amp;amp;quot; key=&amp;amp;quot;0AZVy2coi6c&amp;amp;quot; width=&amp;amp;quot;480&amp;amp;quot;&amp;quot; title=&amp;quot;YouTube Video&amp;quot;height=&amp;quot;315&amp;quot; width=&amp;quot;480&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;480&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/0AZVy2coi6c&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:27 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:50:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc10&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:50 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:247:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=252289&quot; rel=&quot;nofollow&quot;&gt;Re: flood fill attack bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, September 15, 2002&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.aoki.ecei.tohoku.ac.jp/arith/mg/algorithm.html#fsa_pfx&quot; rel=&quot;nofollow&quot;&gt;Hardware algorithms for arithmetic modules&lt;/a&gt; from the ARITH research group, Aoki lab., &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Tohoku_University&quot; rel=&quot;nofollow&quot;&gt;Tohoku University&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Kogge-Stone_adder&quot; rel=&quot;nofollow&quot;&gt;Kogge-Stone adder from Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=22038&quot; rel=&quot;nofollow&quot;&gt;Kogge Stone Algorithm mistake on chessprogramming Wiki&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Christopher%20Conkie&quot;&gt;Christopher Conkie&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, June 29, 2008&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Parallel_Thread_Execution&quot; rel=&quot;nofollow&quot;&gt;Parallel Thread Execution from Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-6&quot;&gt;&lt;a href=&quot;#cite_ref-6&quot;&gt;^&lt;/a&gt; NVIDIA Compute PTX: Parallel Thread Execution, ISA Version 1.4, March 31, 2009, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.nvidia.com/content/CUDA-ptx_isa_1.4.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-7&quot;&gt;&lt;a href=&quot;#cite_ref-7&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Shapeshifting&quot; rel=&quot;nofollow&quot;&gt;Shapeshifting from Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:247 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:52:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc11&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:52 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:09:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Kogge-Stone Algorithm&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Kogge-Stone Algorithm&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;40&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Kogge-Stone_Algorithm includeBody-Kogge-Stone%20Algorithm includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Ankan+Banerjee&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Ankan Banerjee&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Anubis&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Anubis&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 29, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Attack+and+Defend+Maps&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Attack and Defend Maps&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bit-Twiddling&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bit-Twiddling&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 6, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Christopher+Conkie&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Christopher Conkie&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 17, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Design+Principles&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Design Principles&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 17, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/DirGolem&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;DirGolem&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Dumb7Fill&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dumb7Fill&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Efficient Generation of Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fill+Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fill Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 6, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fill+by+Subtraction&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fill by Subtraction&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 5, 2010&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/GPU&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;GPU&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 16, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gunnar+Andersson&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gunnar Andersson&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 23, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/John+L.+Jerz&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;John L. Jerz&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 15, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Karlo+Bala+Jr.&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Karlo Bala Jr.&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 19, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kogge-Stone+Algorithm&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kogge-Stone Algorithm&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 17, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mathematician&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mathematician&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 9, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mobility&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mobility&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 17, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/On+an+empty+Board&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;On an empty Board&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 18, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Othello&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Othello&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 4, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Paladin&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Paladin&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 29, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Parallel+Prefix+Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Parallel Prefix Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 22, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pawn+Fills&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pawn Fills&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 18, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Perft&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Perft&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pieces+versus+Directions&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pieces versus Directions&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 6, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Quad-Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Quad-Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rodent&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rodent&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 11, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Russell+Reagan&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Russell Reagan&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 31, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Shifted+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Shifted Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 9, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SIMD+and+SWAR+Techniques&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SIMD and SWAR Techniques&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 27, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Srdja+Matovic&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Srdja Matovic&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 14, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SSE2&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SSE2&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 27, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Steffan+Westcott&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Steffan Westcott&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tarrasch+Rule&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tarrasch Rule&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/X-ray+Attacks+%28Bitboards%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;X-ray Attacks (Bitboards)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 31, 2015&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:09 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Magic Bitboards</title>
      <link>https://chessprogramming.wikispaces.com/Magic+Bitboards</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Magic+Bitboards</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Magic+Bitboards</comments>
      <pubDate>Fri, 13 Apr 2018 13:09:31 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Magic Bitboards&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:678:&amp;lt;a href=&amp;quot;http://www.puckergallery.com/artists/bak_major/bak_major_all.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/AuspiciousMoon.jpg/157861339/305x245/AuspiciousMoon.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;height: 245px; width: 305px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://www.puckergallery.com/artists/bak_major/bak_major_all.html&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/AuspiciousMoon.jpg/157861339/305x245/AuspiciousMoon.jpg&quot; alt=&quot;AuspiciousMoon.jpg&quot; title=&quot;AuspiciousMoon.jpg&quot; style=&quot;height: 245px; width: 305px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:678 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;&lt;strong&gt;Magic bitboards&lt;/strong&gt;,&lt;br /&gt;
a multiply-right-shift &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table#PerfectHashing&quot;&gt;perfect hashing&lt;/a&gt; algorithm to index an attack bitboard database - which leaves both line-attacks of bishop or rook in one run. Thanks to the fast 64-bit &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Multiplication&quot;&gt;multiplication&lt;/a&gt; and fast and huge &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Cache&quot; rel=&quot;nofollow&quot;&gt;caches&lt;/a&gt; of recent processors, Magic Bitboards has become a &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/De_facto_standard&quot; rel=&quot;nofollow&quot;&gt;de facto standard&lt;/a&gt; of modern bitboard engines, as used for instance in &lt;a class=&quot;wiki_link&quot; href=&quot;/Crafty&quot;&gt;Crafty&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Arasan&quot;&gt;Arasan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Stockfish&quot;&gt;Stockfish&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Houdini&quot;&gt;Houdini&lt;/a&gt;. While &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; reported no immediate speed gain over &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt; in Crafty &lt;!-- ws:start:WikiTextRefRule:16:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;amp;p=140141&amp;amp;amp;t=16002&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Robert%20Hyatt&amp;quot;&amp;gt;Robert Hyatt&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 25, 2007&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:16 --&gt; , &lt;a class=&quot;wiki_link&quot; href=&quot;/Jon%20Dart&quot;&gt;Jon Dart&lt;/a&gt; mentioned a 20-25% speedup &lt;!-- ws:start:WikiTextRefRule:19:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.arasanchess.org/blogs/aug08.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Arasan Blog - Aug 26, 2008&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Jon%20Dart&amp;quot;&amp;gt;Jon Dart&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:19 --&gt; in Arasan over rotated.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#Bak&quot;&gt;Samuel Bak&lt;/a&gt; - Auspicious Moon, 2001 &lt;!-- ws:start:WikiTextRefRule:22:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.puckergallery.com/artists/bak_major/bak_major_all.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Major Works&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.puckergallery.com/artists/bak_index/bak_publications.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Samuel Bak - represented by Pucker Gallery since 1969&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:22 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:179:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:179 --&gt;&lt;!-- ws:start:WikiTextTocRule:180: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#History&quot;&gt;History&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:180 --&gt;&lt;!-- ws:start:WikiTextTocRule:181: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#How it works&quot;&gt;How it works&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:181 --&gt;&lt;!-- ws:start:WikiTextTocRule:182: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Perfect Hashing&quot;&gt;Perfect Hashing&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:182 --&gt;&lt;!-- ws:start:WikiTextTocRule:183: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Perfect Hashing-Wishing Dreams&quot;&gt;Wishing Dreams&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:183 --&gt;&lt;!-- ws:start:WikiTextTocRule:184: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Implementations&quot;&gt;Implementations&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:184 --&gt;&lt;!-- ws:start:WikiTextTocRule:185: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Fancy&quot;&gt;Fancy&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:185 --&gt;&lt;!-- ws:start:WikiTextTocRule:186: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Plain&quot;&gt;Plain&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:186 --&gt;&lt;!-- ws:start:WikiTextTocRule:187: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Fixed shift Fancy&quot;&gt;Fixed shift Fancy&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:187 --&gt;&lt;!-- ws:start:WikiTextTocRule:188: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Black Magic Bitboards&quot;&gt;Black Magic Bitboards&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:188 --&gt;&lt;!-- ws:start:WikiTextTocRule:189: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Byte Lookup&quot;&gt;Byte Lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:189 --&gt;&lt;!-- ws:start:WikiTextTocRule:190: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-32-bit Magics&quot;&gt;32-bit Magics&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:190 --&gt;&lt;!-- ws:start:WikiTextTocRule:191: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Sharing Attacks&quot;&gt;Sharing Attacks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:191 --&gt;&lt;!-- ws:start:WikiTextTocRule:192: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Incorporating the Shift&quot;&gt;Incorporating the Shift&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:192 --&gt;&lt;!-- ws:start:WikiTextTocRule:193: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Incorporating Offset&quot;&gt;Incorporating Offset&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:193 --&gt;&lt;!-- ws:start:WikiTextTocRule:194: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Implementations-Initalization&quot;&gt;Initalization&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:194 --&gt;&lt;!-- ws:start:WikiTextTocRule:195: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Implementations-Initalization-Looking for Magics&quot;&gt;Looking for Magics&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:195 --&gt;&lt;!-- ws:start:WikiTextTocRule:196: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Implementations-Initalization-Magic Records&quot;&gt;Magic Records&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:196 --&gt;&lt;!-- ws:start:WikiTextTocRule:197: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:197 --&gt;&lt;!-- ws:start:WikiTextTocRule:198: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Publications&quot;&gt;Publications&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:198 --&gt;&lt;!-- ws:start:WikiTextTocRule:199: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forum Posts&quot;&gt;Forum Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:199 --&gt;&lt;!-- ws:start:WikiTextTocRule:200: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-2006&quot;&gt;2006&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:200 --&gt;&lt;!-- ws:start:WikiTextTocRule:201: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-2007&quot;&gt;2007&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:201 --&gt;&lt;!-- ws:start:WikiTextTocRule:202: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-2008&quot;&gt;2008&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:202 --&gt;&lt;!-- ws:start:WikiTextTocRule:203: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-2009&quot;&gt;2009&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:203 --&gt;&lt;!-- ws:start:WikiTextTocRule:204: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-2010 ...&quot;&gt;2010 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:204 --&gt;&lt;!-- ws:start:WikiTextTocRule:205: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-2015 ...&quot;&gt;2015 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:205 --&gt;&lt;!-- ws:start:WikiTextTocRule:206: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:206 --&gt;&lt;!-- ws:start:WikiTextTocRule:207: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Other Magic Stuff&quot;&gt;Other Magic Stuff&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:207 --&gt;&lt;!-- ws:start:WikiTextTocRule:208: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:208 --&gt;&lt;!-- ws:start:WikiTextTocRule:209: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:209 --&gt;&lt;!-- ws:start:WikiTextTocRule:210: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:210 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:119:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;History&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:119 --&gt;History&lt;/h1&gt;
 The magic bitboard approach was motivated by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&#039;s&lt;/a&gt; multi-direction hashing technique &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;kindergarten bitboards&lt;/a&gt; and probably by Gerd&#039;s and &lt;a class=&quot;wiki_link&quot; href=&quot;/Tony%20van%20Roon-Werten&quot;&gt;Tony van Roon-Werten&#039;s&lt;/a&gt; early trials to map line-wise &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancies&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/De%20Bruijn%20sequence&quot;&gt;De Bruijn&lt;/a&gt;- or random number multiplication &lt;!-- ws:start:WikiTextRefRule:26:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.stmintz.com/ccc/index.php?id=489834&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;rotated bitboards obsolete?&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Gerd%20Isenberg&amp;quot;&amp;gt;Gerd Isenberg&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, February 26, 2006&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:26 --&gt; . &lt;a class=&quot;wiki_link&quot; href=&quot;/Lasse%20Hansen&quot;&gt;Lasse Hansen&lt;/a&gt; had the idea to hash the up to twelve relevant occupied bits of &lt;strong&gt;both directions&lt;/strong&gt; of a rook- or bishop movement simultaneously &lt;!-- ws:start:WikiTextRefRule:31:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5015&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Fast(er) bitboard move generator&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Lasse%20Hansen&amp;quot;&amp;gt;Lasse Hansen&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, June 14, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Timeline#2006&amp;quot;&amp;gt;2006&amp;lt;/a&amp;gt;, Initial idea&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-5&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-5&quot;&gt;[5]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:31 --&gt; .&lt;br /&gt;
&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&#039;s&lt;/a&gt; improvements to Lasse Hansen&#039;s initial approach was to introduce a &lt;a class=&quot;wiki_link&quot; href=&quot;/Java&quot;&gt;Java&lt;/a&gt;-like, two-dimensional &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt; with individual size for each square and all it&#039;s relevant occupancies &lt;!-- ws:start:WikiTextRefRule:38:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Pradu%20Kannan&amp;quot;&amp;gt;Pradu Kannan&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;2007&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;Magic Move-Bitboard Generation in Computer Chess&amp;lt;/em&amp;gt;, as &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.pradu.us/old/Nov27_2008/Buzz/research/magic/Bitboards.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;pdf&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-6&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-6&quot;&gt;[6]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:38 --&gt; . Big savings in table-size - since many squares on either orthogonal or diagonal lines require less bits than others, especially considering the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;inner six bits&lt;/a&gt;. While center squares are more dense for rooks, it is the opposite for bishops &lt;!-- ws:start:WikiTextRefRule:43:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5441&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;List of magics for bitboard move generation&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Pradu%20Kannan&amp;quot;&amp;gt;Pradu Kannan&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, August 23, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Timeline#2006&amp;quot;&amp;gt;2006&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-7&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-7&quot;&gt;[7]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:43 --&gt; .&lt;br /&gt;
&lt;br /&gt;
Recently, &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Purves&quot;&gt;Robert Purves&lt;/a&gt; coined the names Plain and Fancy Magics &lt;!-- ws:start:WikiTextRefRule:47:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=35858&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Plain and fancy magic on modern hardware&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Robert%20Purves&amp;quot;&amp;gt;Robert Purves&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 22, 2010&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-8&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-8&quot;&gt;[8]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:47 --&gt; , and found Hansen&#039;s initial Plain Magics with 2 MiB table for rooks and 256 KiB for bishops nearly indistinguishable from Fancy (about 800 KiB and 38 KiB) on his &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Intel_Core_i5&quot; rel=&quot;nofollow&quot;&gt;Intel i5&lt;/a&gt; with huge L3 smart cache, see &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#Plain&quot;&gt;plain&lt;/a&gt; versus &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#Fancy&quot;&gt;fancy&lt;/a&gt; source code. In the same &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt; forum thread, &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Houdart&quot;&gt;Robert Houdart&lt;/a&gt; proposed a &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#ByteLookup&quot;&gt;byte lookup&lt;/a&gt; per square for further table reductions.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:121:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;How it works&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:121 --&gt;How it works&lt;/h1&gt;
 A magic move-bitboard generation technique consists of four key steps:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Mask the relevant occupancy bits to form a key. For example if you had a rook on a1, the relevant occupancy bits will be from a2-a7 and b1-g1.&lt;/li&gt;&lt;li&gt;Multiply the key by a &amp;quot;magic number&amp;quot; to obtain an index mapping. This magic number can be generated by brute-force &lt;a class=&quot;wiki_link&quot; href=&quot;/Trial%20and%20Error&quot;&gt;trial and error&lt;/a&gt; quite easily although it isn&#039;t 100% certain that the magic number is the best possible (see step 3).&lt;/li&gt;&lt;li&gt;Right shift the index mapping by 64-n bits to create an index, where n is the number of bits in the index. A better magic number will have less bits required in the index.&lt;/li&gt;&lt;li&gt;Use the index to reference a preinitialized move database.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;
The following illustration should give an impression, how magic bitboards work. All masked relevant occupied bits are perfectly hashed to the consecutive occupied state to index the pre-calculated attack-sets. Constructive collisions, where different occupancies map same attack-sets - since different bits are outer redundant bits &amp;quot;behind&amp;quot; the first blocker, are desired and even necessary to apply a perfect hashing with N bits.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;                                        any consecutive&amp;lt;br/&amp;gt;relevant occupancy                      combination of&amp;lt;br/&amp;gt;bishop b1, 5 bits                       the masked bits&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . .[C D E F G]&amp;lt;br/&amp;gt;. . . . . . . .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . G .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . F . .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . E . . .  *  . 1 . . . . . .  =  . . garbage . .    &amp;amp;gt;&amp;amp;gt; (64- 5)&amp;lt;br/&amp;gt;. . . D . . . .     . 1 . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . C . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;                                        any consecutive&amp;lt;br/&amp;gt;relevant occupancy                      combination of&amp;lt;br/&amp;gt;bishop d4, 9 bits                       the masked bits&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     2 4 5 B C E F G]&amp;lt;br/&amp;gt;. . . . . . G .     . . .some . . .     . . . . . . .[1&amp;lt;br/&amp;gt;. 5 . . . F . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . 4 . E . . .     . . .magic. . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .  *  . . . . . . . .  =  . . garbage . .    &amp;amp;gt;&amp;amp;gt; (64- 9)&amp;lt;br/&amp;gt;. . C . 2 . . .     . . .bits . . .     . . . . . . . .&amp;lt;br/&amp;gt;. B . . . 1 . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;                                        any consecutive&amp;lt;br/&amp;gt;relevant occupancy                      combination of&amp;lt;br/&amp;gt;rook d4, 10 bits                        the masked bits&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     4 5 6 B C E F G]&amp;lt;br/&amp;gt;. . . 6 . . . .     . . .some . . .     . . . . . .[1 2&amp;lt;br/&amp;gt;. . . 5 . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . 4 . . . .     . . .magic. . .     . . . . . . . .&amp;lt;br/&amp;gt;. B C . E F G .  *  . . . . . . . .  =  . . garbage . .    &amp;amp;gt;&amp;amp;gt; (64-10)&amp;lt;br/&amp;gt;. . . 2 . . . .     . . .bits . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . 1 . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;                                        any consecutive&amp;lt;br/&amp;gt;relevant occupancy                      combination of&amp;lt;br/&amp;gt;rook a1, 12 bits                        the masked bits&amp;lt;br/&amp;gt;. . . . . . . .     . . . . . . . .     5 6 B C D E F G]&amp;lt;br/&amp;gt;6 . . . . . . .     . . .some . . .     . . . .[1 2 3 4&amp;lt;br/&amp;gt;5 . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;4 . . . . . . .     . . .magic. . .     . . . . . . . .&amp;lt;br/&amp;gt;3 . . . . . . .  *  . . . . . . . .  =  . . garbage . .    &amp;amp;gt;&amp;amp;gt; (64-12)&amp;lt;br/&amp;gt;2 . . . . . . .     . . .bits . . .     . . . . . . . .&amp;lt;br/&amp;gt;1 . . . . . . .     . . . . . . . .     . . . . . . . .&amp;lt;br/&amp;gt;. B C D E F G .     . . . . . . . .     . . . . . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;                                        any consecutive
relevant occupancy                      combination of
bishop b1, 5 bits                       the masked bits
. . . . . . . .     . . . . . . . .     . . .[C D E F G]
. . . . . . . .     . 1 . . . . . .     . . . . . . . .
. . . . . . G .     . 1 . . . . . .     . . . . . . . .
. . . . . F . .     . 1 . . . . . .     . . . . . . . .
. . . . E . . .  *  . 1 . . . . . .  =  . . garbage . .    &amp;gt;&amp;gt; (64- 5)
. . . D . . . .     . 1 . . . . . .     . . . . . . . .
. . C . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
&amp;nbsp;
                                        any consecutive
relevant occupancy                      combination of
bishop d4, 9 bits                       the masked bits
. . . . . . . .     . . . . . . . .     2 4 5 B C E F G]
. . . . . . G .     . . .some . . .     . . . . . . .[1
. 5 . . . F . .     . . . . . . . .     . . . . . . . .
. . 4 . E . . .     . . .magic. . .     . . . . . . . .
. . . . . . . .  *  . . . . . . . .  =  . . garbage . .    &amp;gt;&amp;gt; (64- 9)
. . C . 2 . . .     . . .bits . . .     . . . . . . . .
. B . . . 1 . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
&amp;nbsp;
                                        any consecutive
relevant occupancy                      combination of
rook d4, 10 bits                        the masked bits
. . . . . . . .     . . . . . . . .     4 5 6 B C E F G]
. . . 6 . . . .     . . .some . . .     . . . . . .[1 2
. . . 5 . . . .     . . . . . . . .     . . . . . . . .
. . . 4 . . . .     . . .magic. . .     . . . . . . . .
. B C . E F G .  *  . . . . . . . .  =  . . garbage . .    &amp;gt;&amp;gt; (64-10)
. . . 2 . . . .     . . .bits . . .     . . . . . . . .
. . . 1 . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
&amp;nbsp;
                                        any consecutive
relevant occupancy                      combination of
rook a1, 12 bits                        the masked bits
. . . . . . . .     . . . . . . . .     5 6 B C D E F G]
6 . . . . . . .     . . .some . . .     . . . .[1 2 3 4
5 . . . . . . .     . . . . . . . .     . . . . . . . .
4 . . . . . . .     . . .magic. . .     . . . . . . . .
3 . . . . . . .  *  . . . . . . . .  =  . . garbage . .    &amp;gt;&amp;gt; (64-12)
2 . . . . . . .     . . .bits . . .     . . . . . . . .
1 . . . . . . .     . . . . . . . .     . . . . . . . .
. B C D E F G .     . . . . . . . .     . . . . . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;The above illustration is correct for the b1 bishop, since it has only one ray and one bit per file and works &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;kindergarten&lt;/a&gt; like. In general a one to one mapping of N scattered occupied bits to N consecutive bits is not always possible due to overflows. A perfect mapping of N scattered bits to N consecutive bits is likely not minimal for most squares. It requires one or two gaps inside the consecutive N bits, to avoid collisions, blowing up the table size.&lt;br /&gt;
&lt;br /&gt;
But the purpose is to perfectly hash attack-sets rather than consecutive occupied bits. The number of distinct attack-sets is much smaller than the relevant occupancies. Thus, with the help of constructive collisions, some initial guess how to map the bits, and/or &lt;a class=&quot;wiki_link&quot; href=&quot;/Trial%20and%20Error&quot;&gt;trial and error&lt;/a&gt;, using exactly N bits is always possible. If one tries hard enough to maximize constructive collisions - even less. There are some N-1 ones reported at &lt;a class=&quot;wiki_link&quot; href=&quot;/Best%20Magics%20so%20far&quot;&gt;Best Magics so far&lt;/a&gt;, which will half the individual table size for some squares in the widespread &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#Fancy&quot;&gt;Fancy Magic Bitboards&lt;/a&gt; approach.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:123:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Perfect Hashing&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:123 --&gt;Perfect Hashing&lt;/h1&gt;
 Magic bitboards applies &lt;a class=&quot;wiki_link&quot; href=&quot;/Hash%20Table#PerfectHashing&quot;&gt;perfect hashing&lt;/a&gt;. A &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Surjection&quot; rel=&quot;nofollow&quot;&gt;surjective function&lt;/a&gt;, to map the vector of all relevant occupancies to a range of attack-sets per square. The less bits the attack-set - the closer the blockers, the more those attack-sets are shared by occupancies with different, but redundant outer squares.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The &lt;strong&gt;cardinality&lt;/strong&gt; of all &lt;strong&gt;relevant occupancies&lt;/strong&gt; is determined by the number of bits to map, varying from five to twelve - thus, the cardinality is the power of two the number of bits, varying from 32 to 4096.&lt;/li&gt;&lt;li&gt;The &lt;strong&gt;cardinality&lt;/strong&gt; of &lt;strong&gt;distinct attack-sets&lt;/strong&gt; is determined by the product of the length of each of the max four direction rays greater than zero (or one). The rook on d4 has 3*4*3*4 = 144 distinct attack-sets, a bishop on a8 has only 7.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
The &lt;strong&gt;ratio&lt;/strong&gt; of both cardinalities, that is all &lt;strong&gt;relevant occupancies&lt;/strong&gt; versus the all &lt;strong&gt;distinct attack-sets&lt;/strong&gt; is illustrated below: As a quarter of a board - due to the symmetry, the other squares may deduced by flipping and mirroring. Noticeable is the huge 4096/49 ratio of 2^12 occupied states versus 7 times 7 attack-sets of the edge rooks - 12 bits instead of 6. Those &amp;quot;expensive&amp;quot; squares make constructive collisions very desirable. To become more &amp;quot;minimal&amp;quot; by saving an index bit - to halve down the table for one square or the other.&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th colspan=&quot;4&quot;&gt;bishop on square&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;#occs/&lt;br /&gt;
#attset&lt;br /&gt;
&lt;/th&gt;
        &lt;th colspan=&quot;4&quot;&gt;rook on square&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;A&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;B&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;C&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;D&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;A&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;B&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;C&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;D&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;8&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;64/7&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/6&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/10&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/ 12&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;8&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;4096/49&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/42&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/ 70&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/ 84&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;7&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/6&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/6&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/10&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/ 12&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;7&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/42&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/36&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/ 60&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/ 72&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;6&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/10&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/10&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;128/40&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;128/ 48&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;6&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/70&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/60&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/100&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/120&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;5&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/12&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;32/12&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;128/48&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;512/108&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;5&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2048/84&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/72&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/120&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;1024/144&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th colspan=&quot;4&quot;&gt;bishop on square&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th colspan=&quot;4&quot;&gt;rook on square&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;A&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;B&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;C&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;D&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;A&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;B&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;C&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;D&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;8&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;9.14&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;5.33&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;8&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;83.59&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;48.76&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;29.26&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;24.38&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;7&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;5.33&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;5.33&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;7&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;48.76&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;28.44&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;17.07&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;14.22&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;6&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;3.20&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;6&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;29.26&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;17.07&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;10.24&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;8.53&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;th&gt;5&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;2.67&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;4.74&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;th&gt;5&lt;br /&gt;
&lt;/th&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;24.38&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;14.22&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;8.53&lt;br /&gt;
&lt;/td&gt;
        &lt;td style=&quot;text-align: right;&quot;&gt;7.11&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;br /&gt;
The idea to implement minimal perfect hashing by an additional 16-bit indirection turned out to be slower (see conditional compiles in Pradu Kannan&#039;s source &lt;!-- ws:start:WikiTextRefRule:51:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.pradu.us/old/Nov27_2008/Buzz/&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Buzz - A Winboard Chess Playing Program by Pradu Kannan&amp;lt;/a&amp;gt; - Source of &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Pradu%20Kannan&amp;quot;&amp;gt;Pradu Kannan&#039;s&amp;lt;/a&amp;gt; &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Magic%20Bitboards&amp;quot;&amp;gt;magic&amp;lt;/a&amp;gt; Move Generator, PERFECT_MAGIC_HASH&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-9&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-9&quot;&gt;[9]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:51 --&gt; ).&lt;br /&gt;
&lt;br /&gt;
Recent table sizes were about 38 KiB for the bishop attacks, but still about 800 KiB for rook attacks (Fancy). That sounds huge, considering L1 and L2 (L3) cache-sizes and number of cachelines and pages needed - we likely fetch distinct cachelines for each different square or occupancy. On the other hand caches and pages become larger in future processors. And occupancy and squares of the lookups don&#039;t change that randomly inside a search that we can still expect a lot of L1-hits. Unfortunately changes in occupancy outside the blockers and therefor not affecting the attack-set will introduce some more cache misses.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:125:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Perfect Hashing-Wishing Dreams&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:125 --&gt;Wishing Dreams&lt;/h2&gt;
Since there are 1428/4900 &lt;strong&gt;distinct&lt;/strong&gt; attack sets for the bishop/rook attacks, we can use 11(2048 &amp;gt; 1428)/13(8196 &amp;gt; 4900) index bits for all bishop/rook attack bitboards. The table size will be 16KB for the bishop attacks and 64KB for rook attacks. To make it possible, we must find a group of magics (one per square and dependent each other). All the magics in the group must hash its all &lt;strong&gt;relevant occupancies&lt;/strong&gt; into the same 11/13 bit index without any collision with others (anyhow for each square, different occupancies can hash to the same attack sets).&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 bishopAttacks[2048]; // 16KB&amp;lt;br/&amp;gt;U64 rookAttacks[8196]; // 64KB&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct GMagic {&amp;lt;br/&amp;gt;   U64 mask;  // to mask relevant squares of both lines (no outer squares) and include sliding piece itself&amp;lt;br/&amp;gt;   U64 magic; // magic 64-bit factor&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;GMagic mBishopTbl[64]; //1KB&amp;lt;br/&amp;gt;GMagic mRookTbl[64]; //1KB&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ &amp;amp;amp;= mBishopTbl[sq].mask;&amp;lt;br/&amp;gt;   occ *= mBishopTbl[sq].magic;&amp;lt;br/&amp;gt;   occ &amp;amp;gt;&amp;amp;gt;= 64-11;  //fixed shift&amp;lt;br/&amp;gt;   return bishopAttacks[occ]; //no offset&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ &amp;amp;amp;= mRookTbl[sq].mask;&amp;lt;br/&amp;gt;   occ *= mRookTbl[sq].magic;&amp;lt;br/&amp;gt;   occ &amp;amp;gt;&amp;amp;gt;= 64-13;&amp;lt;br/&amp;gt;   return rookAttacks[occ];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;2048&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 16KB&lt;/span&gt;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8196&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 64KB&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; GMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 mask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// to mask relevant squares of both lines (no outer squares) and include sliding piece itself&lt;/span&gt;
   U64 magic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// magic 64-bit factor&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
GMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;//1KB&lt;/span&gt;
GMagic mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;//1KB&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;//fixed shift&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;//no offset&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;But the idea seems like a wishing dream. Can we find ONE of the &lt;strong&gt;magic group&lt;/strong&gt; of magics? Does it exist in theory? If not, can we use more bits to reach the condition? If yes, can we find a good magic group? A good magic group means that all the hash value &amp;lt;=n, so we can reduce the table size to n, until it reach to 1428/4900. Enough? If all hash values are grouped by square, can we think about using the &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#PostMask&quot;&gt;Sharing Attacks&lt;/a&gt; method?&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:127:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Implementations&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:127 --&gt;Implementations&lt;/h1&gt;
 Despite its huge table size, register usage and code size are important issues as well - and here Magic Bitboards are unbeatable. There are enough variations of &lt;a class=&quot;wiki_link&quot; href=&quot;/Space-Time%20Tradeoff&quot;&gt;space-time tradeoff&lt;/a&gt; and implementation details of that theme for all who like to play the optimization game. &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt;-source code with various precompiler options is available from &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&#039;s&lt;/a&gt; site. MINIMIZE_MAGIC is about Plain versus Fancy &lt;!-- ws:start:WikiTextRefRule:55:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.pradu.us/old/Nov27_2008/Buzz/&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Buzz - A Winboard Chess Playing Program by Pradu Kannan&amp;lt;/a&amp;gt; - Source of &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Pradu%20Kannan&amp;quot;&amp;gt;Pradu Kannan&#039;s&amp;lt;/a&amp;gt; &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Magic%20Bitboards&amp;quot;&amp;gt;magic&amp;lt;/a&amp;gt; Move Generator, MINIMIZE_MAGIC&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-10&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-10&quot;&gt;[10]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:55 --&gt; , while PERFECT_MAGIC_HASH enables an additional indirection via 16-bit indices. As always, with space-time tradeoffs - it depends on the individual cache- and &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Memory_footprint&quot; rel=&quot;nofollow&quot;&gt;memory footprint&lt;/a&gt; inside a particular chess program and the hardware architecture, which solution is preferable.&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:211:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Fancy&amp;quot; title=&amp;quot;Anchor: Fancy&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Fancy&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:211 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:129:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Implementations-Fancy&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:129 --&gt;Fancy&lt;/h2&gt;
 Fancy Magic Bitboards is the main stream implementation as proposed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt; with individual table sizes for each square. It requires an individual shift, to leave that many index bits remaining as determined by the population of relevant occupancies. As mentioned, if one tries hard enough to maximize constructive collisions while &lt;a class=&quot;wiki_link&quot; href=&quot;/Looking%20for%20Magics&quot;&gt;looking for magics&lt;/a&gt;, one may half the size for several individual squares, see &lt;a class=&quot;wiki_link&quot; href=&quot;/Best%20Magics%20so%20far&quot;&gt;Best Magics so far&lt;/a&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 attack_table[...]; // ~840 KiB all rook and bishop attacks, less with constructive collisions optimization&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct SMagic {&amp;lt;br/&amp;gt;   U64* ptr;  // pointer to attack_table for each particular square&amp;lt;br/&amp;gt;   U64 mask;  // to mask relevant squares of both lines (no outer squares)&amp;lt;br/&amp;gt;   U64 magic; // magic 64-bit factor&amp;lt;br/&amp;gt;   int shift; // shift right&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;SMagic mBishopTbl[64];&amp;lt;br/&amp;gt;SMagic mRookTbl[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mBishopTbl[sq].ptr;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mBishopTbl[sq].mask;&amp;lt;br/&amp;gt;   occ      *= mBishopTbl[sq].magic;&amp;lt;br/&amp;gt;   occ     &amp;amp;gt;&amp;amp;gt;= mBishopTbl[sq].shift;&amp;lt;br/&amp;gt;   return aptr[occ];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mRookTbl[sq].ptr;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mRookTbl[sq].mask;&amp;lt;br/&amp;gt;   occ      *= mRookTbl[sq].magic;&amp;lt;br/&amp;gt;   occ     &amp;amp;gt;&amp;amp;gt;= mRookTbl[sq].shift;&amp;lt;br/&amp;gt;   return aptr[occ];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 attack_table&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;...&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ~840 KiB all rook and bishop attacks, less with constructive collisions optimization&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; ptr&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// pointer to attack_table for each particular square&lt;/span&gt;
   U64 mask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// to mask relevant squares of both lines (no outer squares)&lt;/span&gt;
   U64 magic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// magic 64-bit factor&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; shift&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// shift right&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
SMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
SMagic mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ     &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ     &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:212:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Plain&amp;quot; title=&amp;quot;Anchor: Plain&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Plain&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:212 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:131:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Implementations-Plain&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:131 --&gt;Plain&lt;/h2&gt;
 Plain Magic Bitboards, &lt;a class=&quot;wiki_link&quot; href=&quot;/Lasse%20Hansen&quot;&gt;Lasse Hansen&#039;s&lt;/a&gt; initial approach, takes much more memory for homogeneous two-dimensional attack &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;arrays&lt;/a&gt;. 32 KiB  per rook square, 4 KiB  for each bishop square. It does not need a variable shift and therefor needs one processor register less to further reduce register pressure, despite shorter code. Unfortunately, so far, there are two &lt;a class=&quot;wiki_link&quot; href=&quot;/Best%20Magics%20so%20far&quot;&gt;rook corner squares&lt;/a&gt; (0 and 7), which prohibit dividing the rook table size by two.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 mBishopAttacks[64] [512]; // 256 K&amp;lt;br/&amp;gt;U64 mRookAttacks  [64][4096]; // 2048K&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct SMagic {&amp;lt;br/&amp;gt;   U64 mask;  // to mask relevant squares of both lines (no outer squares)&amp;lt;br/&amp;gt;   U64 magic; // magic 64-bit factor&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;SMagic mBishopTbl[64];&amp;lt;br/&amp;gt;SMagic mRookTbl  [64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ &amp;amp;amp;= mBishopTbl[sq].mask;&amp;lt;br/&amp;gt;   occ *= mBishopTbl[sq].magic;&amp;lt;br/&amp;gt;   occ &amp;amp;gt;&amp;amp;gt;= 64-9;&amp;lt;br/&amp;gt;   return mBishopAttacks[sq][occ];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 mBishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;512&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 256 K&lt;/span&gt;
U64 mRookAttacks  &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4096&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 2048K&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 mask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// to mask relevant squares of both lines (no outer squares)&lt;/span&gt;
   U64 magic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// magic 64-bit factor&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
SMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
SMagic mRookTbl  &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; mBishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:213:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@FixedShiftFancy&amp;quot; title=&amp;quot;Anchor: FixedShiftFancy&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;FixedShiftFancy&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:213 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:133:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Implementations-Fixed shift Fancy&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:133 --&gt;Fixed shift Fancy&lt;/h2&gt;
 A fancy fixed shift variation was introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Onno%20Garms&quot;&gt;Onno Garms&lt;/a&gt;, looking for magics producing factors with appropriate reduced value ranges. That is, leave 12 bit rook indices for all squares, but with upper bit(s) clear for all possible occupancies for all the squares with less than 12 relevant bits, so that it efficiently becomes a less 12 bit index. Onno believes that it is possible to find magic factors with that property for most of those squares, to come close to the fancy table size with the advantage of a fixed shift &lt;!-- ws:start:WikiTextRefRule:59:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;amp;t=50043&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Magic with fixed shift&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Onno%20Garms&amp;quot;&amp;gt;Onno Garms&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, March 18, 2009&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-11&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-11&quot;&gt;[11]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:59 --&gt; . Even an &amp;quot;overlapping&amp;quot; of square arrays is feasible, if they contain accordant unused slot gaps on both ends. &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt; came up with a fixed shift solution of only 800 KiB  and below &lt;!-- ws:start:WikiTextRefRule:63:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;amp;t=51162&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Fixed shift magics with 800KB lookup table&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Volker%20Annuss&amp;quot;&amp;gt;Volker Annuss&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, September, 05, 2010&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-12&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-12&quot;&gt;[12]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:63 --&gt; &lt;!-- ws:start:WikiTextRefRule:67:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=60065&amp;amp;amp;start=14&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: understanding fixed shift fancy magic bitboard generation&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Volker%20Annuss&amp;quot;&amp;gt;Volker Annuss&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, May 06, 2016&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-13&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-13&quot;&gt;[13]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:67 --&gt;, and more recently even innovated with &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#BlackMagics&quot;&gt;Black Magic Bitboards&lt;/a&gt;. &lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 attack_table[...]; // &amp;amp;gt; 800 KiB  - 1.x MiB  - depending on the effort on looking for magics&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct SMagic {&amp;lt;br/&amp;gt;   U64* ptr;  // pointer to attack_table for each particular square&amp;lt;br/&amp;gt;   U64 mask;  // to mask relevant squares of both lines (no outer squares)&amp;lt;br/&amp;gt;   U64 magic; // magic 64-bit factor&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;SMagic mBishopTbl[64];&amp;lt;br/&amp;gt;SMagic mRookTbl[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mRookTbl[sq].ptr;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mRookTbl[sq].mask;&amp;lt;br/&amp;gt;   occ      *= mRookTbl[sq].magic;&amp;lt;br/&amp;gt;   occ     &amp;amp;gt;&amp;amp;gt;= 64-12;&amp;lt;br/&amp;gt;   return aptr[occ];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 attack_table&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;...&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// &amp;gt; 800 KiB  - 1.x MiB  - depending on the effort on looking for magics&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; ptr&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// pointer to attack_table for each particular square&lt;/span&gt;
   U64 mask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// to mask relevant squares of both lines (no outer squares)&lt;/span&gt;
   U64 magic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// magic 64-bit factor&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
SMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
SMagic mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ     &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:214:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@BlackMagics&amp;quot; title=&amp;quot;Anchor: BlackMagics&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;BlackMagics&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:214 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:135:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Implementations-Black Magic Bitboards&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:135 --&gt;Black Magic Bitboards&lt;/h2&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&#039;&lt;/a&gt; most recent innovation and further improvement of his already dense 700 KiB &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#FixedShiftFancy&quot;&gt;fixed shift fancy&lt;/a&gt; reference implementation is called &lt;strong&gt;Black Magic Bitboards&lt;/strong&gt;, introduced in &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt; in August 2017 &lt;!-- ws:start:WikiTextRefRule:71:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Black magic bitboards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Volker%20Annuss&amp;quot;&amp;gt;Volker Annuss&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 03, 2017&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-14&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-14&quot;&gt;[14]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:71 --&gt;. Instead of &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Intersection&quot;&gt;intersection&lt;/a&gt; with a mask to clear the not relevant occupancy bits, he used the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Union&quot;&gt;union&lt;/a&gt; with the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#ComplementSet&quot;&gt;complement&lt;/a&gt; of mask to set all not relevant occupancy bits. &lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;  and mask[d4]  vs.   or ~mask[d4]&amp;lt;br/&amp;gt;. . . . . . . .     1 1 1 1 1 1 1 1&amp;lt;br/&amp;gt;. . . 1 . . . .     1 1 1 . 1 1 1 1&amp;lt;br/&amp;gt;. . . 1 . . . .     1 1 1 . 1 1 1 1&amp;lt;br/&amp;gt;. . . 1 . . . .     1 1 1 . 1 1 1 1&amp;lt;br/&amp;gt;. 1 1 . 1 1 1 .     1 . . 1 . . . 1&amp;lt;br/&amp;gt;. . . 1 . . . .     1 1 1 . 1 1 1 1&amp;lt;br/&amp;gt;. . . 1 . . . .     1 1 1 . 1 1 1 1&amp;lt;br/&amp;gt;. . . . . . . .     1 1 1 1 1 1 1 1&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;  and mask[d4]  vs.   or ~mask[d4]
. . . . . . . .     1 1 1 1 1 1 1 1
. . . 1 . . . .     1 1 1 . 1 1 1 1
. . . 1 . . . .     1 1 1 . 1 1 1 1
. . . 1 . . . .     1 1 1 . 1 1 1 1
. 1 1 . 1 1 1 .     1 . . 1 . . . 1
. . . 1 . . . .     1 1 1 . 1 1 1 1
. . . 1 . . . .     1 1 1 . 1 1 1 1
. . . . . . . .     1 1 1 1 1 1 1 1&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;&lt;br /&gt;
This trick, which basically adds a huge constant to the occupancy factor, enables to find &lt;strong&gt;Black Magics&lt;/strong&gt; yielding in even smaller array sizes per square, determined by maximum and minimum index - the latter no longer zero for the empty occupancy! Unfortunately so far, the individual savings with denser square arrays don&#039;t completely advance to the size of the combined overlapping table, since overlapping became harder due to smaller gaps &lt;!-- ws:start:WikiTextRefRule:75:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&amp;amp;amp;start=11&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Black magic bitboards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Volker%20Annuss&amp;quot;&amp;gt;Volker Annuss&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 04, 2017&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-15&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-15&quot;&gt;[15]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:75 --&gt; . However, 692 KiB  for the complete rook and bishop attack table is the new fixed shift reference. Black Magic Bitboards are now used in Volker&#039;s engine &lt;a class=&quot;wiki_link&quot; href=&quot;/Arminius&quot;&gt;Arminius&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:79:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&amp;amp;amp;start=14&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Black magic bitboards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Volker%20Annuss&amp;quot;&amp;gt;Volker Annuss&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 04, 2017&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-16&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-16&quot;&gt;[16]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:79 --&gt; &lt;!-- ws:start:WikiTextRefRule:84:&amp;amp;lt;ref&amp;amp;gt;source code according to the &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Magic%20Bitboards#FixedShiftFancy&amp;quot;&amp;gt;fixed shift fancy&amp;lt;/a&amp;gt; sample - array size from Volker&#039;s posting, also containing black magics and arrayoffsets, see &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Black magic bitboards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Volker%20Annuss&amp;quot;&amp;gt;Volker Annuss&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 03, 2017&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-17&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-17&quot;&gt;[17]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:84 --&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 attack_table[88507]; // 692 KiB for published black magics by Volker Annuss (new size 88316 aka 690 KiB) &amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct SBlackMagic {&amp;lt;br/&amp;gt;   U64* ptr;  // pointer to attack_table for each particular square&amp;lt;br/&amp;gt;   U64 notmask;  // to mask relevant squares of both lines (no outer squares)&amp;lt;br/&amp;gt;   U64 blackmagic; // black magic 64-bit factor&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;SBlackMagic mBishopTbl[64];&amp;lt;br/&amp;gt;SBlackMagic mRookTbl[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mRookTbl[sq].ptr;&amp;lt;br/&amp;gt;   occ      |= mRookTbl[sq].notmask;&amp;lt;br/&amp;gt;   occ      *= mRookTbl[sq].blackmagic;&amp;lt;br/&amp;gt;   occ     &amp;amp;gt;&amp;amp;gt;= 64-12;&amp;lt;br/&amp;gt;   return aptr[occ];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 attack_table&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;88507&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 692 KiB for published black magics by Volker Annuss (new size 88316 aka 690 KiB) &lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SBlackMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; ptr&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// pointer to attack_table for each particular square&lt;/span&gt;
   U64 notmask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// to mask relevant squares of both lines (no outer squares)&lt;/span&gt;
   U64 blackmagic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// black magic 64-bit factor&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
SBlackMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
SBlackMagic mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;notmask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;blackmagic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ     &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:215:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@ByteLookup&amp;quot; title=&amp;quot;Anchor: ByteLookup&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;ByteLookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:215 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:137:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc9&quot;&gt;&lt;a name=&quot;Implementations-Byte Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:137 --&gt;Byte Lookup&lt;/h2&gt;
 Since there are only up to 144 different attack sets per square, &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Houdart&quot;&gt;Robert Houdart&lt;/a&gt; proposed to lookup &lt;a class=&quot;wiki_link&quot; href=&quot;/Byte&quot;&gt;bytes&lt;/a&gt; by square and hashed occupancy for a minimal perfect hashing with an additional indirection via an offset per square, which is successfully used in his engine &lt;a class=&quot;wiki_link&quot; href=&quot;/Houdini&quot;&gt;Houdini&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:88:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;amp;p=368026&amp;amp;amp;t=35858&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Plain and fancy magic on modern hardware&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Robert%20Houdart&amp;quot;&amp;gt;Robert Houdart&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, August 26, 2010&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-18&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-18&quot;&gt;[18]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:88 --&gt; . Following sample code uses the Plain fixed shift method, while it may also applied for the dense Fancy one.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;byte mBishopAttacks[64] [512]; // 32 K&amp;lt;br/&amp;gt;byte mRookAttacks  [64][4096]; // 256 K&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 mRookLookup[4900];  // 39 K&amp;lt;br/&amp;gt;U64 mBishopLookup[1428];  // 11 K&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct SMagic {&amp;lt;br/&amp;gt;   U64 mask;  // to mask relevant squares of both lines (no outer squares)&amp;lt;br/&amp;gt;   U64 magic; // magic 64-bit factor&amp;lt;br/&amp;gt;   int offset;   // offset into lookup table&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;SMagic mBishopTbl[64];&amp;lt;br/&amp;gt;SMagic mRookTbl  [64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   occ &amp;amp;amp;= mBishopTbl[sq].mask;&amp;lt;br/&amp;gt;   occ *= mBishopTbl[sq].magic;&amp;lt;br/&amp;gt;   occ &amp;amp;gt;&amp;amp;gt;= 64-9;&amp;lt;br/&amp;gt;   return mBishopLookup[mBishopTbl[sq].offset + mBishopAttack[sq][occ]];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;byte mBishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;512&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 32 K&lt;/span&gt;
byte mRookAttacks  &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4096&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 256 K&lt;/span&gt;
&amp;nbsp;
U64 mRookLookup&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4900&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 39 K&lt;/span&gt;
U64 mBishopLookup&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1428&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 11 K&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 mask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// to mask relevant squares of both lines (no outer squares)&lt;/span&gt;
   U64 magic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// magic 64-bit factor&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; offset&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;// offset into lookup table&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
SMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
SMagic mRookTbl  &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;mask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; mBishopLookup&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; mBishopAttack&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:216:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@32Bit&amp;quot; title=&amp;quot;Anchor: 32Bit&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;32Bit&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:216 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:139:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc10&quot;&gt;&lt;a name=&quot;Implementations-32-bit Magics&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:139 --&gt;32-bit Magics&lt;/h2&gt;
 Optimizations are possible for 32-bit systems, as proposed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Grant%20Osborne&quot;&gt;Grant Osborne&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:92:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5997&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;A Faster Magic Move Bitboard Generator?&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Grant%20Osborne&amp;quot;&amp;gt;Grant Osborne&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, December 15, 2006&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-19&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-19&quot;&gt;[19]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:92 --&gt; . Instead of letting the compiler split up a 64-bit multiply, two 32-bit multiplications can be manually implemented. Multiply the low bits of the magic with the low bits of the key and add it with the product of the high bits of the magic and the high bits of the key and use the upper bits of the sum to index the move database. For the bishops one may try only one 32-bit multiplication after xoring the masked high and low half.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;struct {&amp;lt;br/&amp;gt;  unsigned int rookMaskLo;&amp;lt;br/&amp;gt;  unsigned int rookMaskHi;&amp;lt;br/&amp;gt;  unsigned int rookMagicLo;&amp;lt;br/&amp;gt;  unsigned int rookMagicHi;&amp;lt;br/&amp;gt;  unsigned int rookShift;&amp;lt;br/&amp;gt;  U64 *pRookAttacks;&amp;lt;br/&amp;gt;} sm[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   unsigned int lo = (int) occ;&amp;lt;br/&amp;gt;   unsigned int hi = (int)(occ &amp;amp;gt;&amp;amp;gt; 32);&amp;lt;br/&amp;gt;   lo &amp;amp;amp;= sm[sq].rookMaskLo;&amp;lt;br/&amp;gt;   hi &amp;amp;amp;= sm[sq].rookMaskHi;&amp;lt;br/&amp;gt;   lo *= sm[sq].rookMagicLo;&amp;lt;br/&amp;gt;   hi *= sm[sq].rookMagicHi;&amp;lt;br/&amp;gt;   lo  = (lo ^ hi) &amp;amp;gt;&amp;amp;gt; sm[sq].rookShift;&amp;lt;br/&amp;gt;   return sm[sq].pRookAttacks[lo];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rookMaskLo&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rookMaskHi&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rookMagicLo&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rookMagicHi&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; rookShift&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  U64 &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;pRookAttacks&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; sm&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; lo &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; occ&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; hi &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   lo &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sm&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;rookMaskLo&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   hi &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sm&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;rookMaskHi&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   lo &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sm&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;rookMagicLo&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   hi &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sm&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;rookMagicHi&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   lo  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;lo &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; hi&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; sm&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;rookShift&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; sm&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;pRookAttacks&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;lo&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:217:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@PostMask&amp;quot; title=&amp;quot;Anchor: PostMask&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;PostMask&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:217 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:141:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc11&quot;&gt;&lt;a name=&quot;Implementations-Sharing Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:141 --&gt;Sharing Attacks&lt;/h2&gt;
 The development has not finished. &lt;a class=&quot;wiki_link&quot; href=&quot;/Lasse%20Hansen&quot;&gt;Lasse Hansen&lt;/a&gt; came up with another stunning idea &lt;!-- ws:start:WikiTextRefRule:96:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Lasse%20Hansen&amp;quot;&amp;gt;Lasse Hansen&#039;s&amp;lt;/a&amp;gt; &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.open-aurec.com/wbforum/viewtopic.php?topic_view=threads&amp;amp;amp;p=185506&amp;amp;amp;t=5441&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;postmask trick&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;Winboard Forum&amp;lt;/a&amp;gt;, May 09, 2008&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-20&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-20&quot;&gt;[20]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:96 --&gt; , to use a final &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Intersection&quot;&gt;intersection&lt;/a&gt; by attacks &lt;a class=&quot;wiki_link&quot; href=&quot;/on%20an%20empty%20board&quot;&gt;on an empty board&lt;/a&gt;, to share tables by two (rooks) or even four (bishops) squares. Bishop sharing is simple to understand, since there are light and dark colored bishops with disjoint attacks-sets, able to share the pre-calculated union of two square-attacks.&lt;br /&gt;
&lt;br /&gt;
The trick is to share even equal colored bishops and rooks where both attack-sets are not disjoint - but all members of the intersection are always set, since they are direct neighbors of both sliders. This is how rooks and bishops may share union-attack-sets by two resp. four squares:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;int rookSharing[64] = {&amp;lt;br/&amp;gt;   0,  1,  2,  3,  4,  5,  6,  7,&amp;lt;br/&amp;gt;   1,  0,  3,  2,  5,  4,  7,  6,&amp;lt;br/&amp;gt;   8,  9, 10, 11, 12, 13, 14, 15,&amp;lt;br/&amp;gt;   9,  8, 11, 10, 13, 12, 15, 14,&amp;lt;br/&amp;gt;  16, 17, 18, 19, 20, 21, 22, 23,&amp;lt;br/&amp;gt;  17, 16, 19, 18, 21, 20, 23, 22,&amp;lt;br/&amp;gt;  24, 25, 26, 27, 28, 29, 30, 31,&amp;lt;br/&amp;gt;  25, 24, 27, 26, 29, 28, 31, 30,&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;int bishopSharing[64] = {&amp;lt;br/&amp;gt;   0,  2,  4,  4,  4,  4, 12, 14,&amp;lt;br/&amp;gt;   0,  2,  5,  5,  5,  5, 12, 14,&amp;lt;br/&amp;gt;   0,  2,  6,  6,  6,  6, 12, 14,&amp;lt;br/&amp;gt;   0,  2,  7,  7,  7,  7, 12, 14,&amp;lt;br/&amp;gt;   1,  3,  8,  8,  8,  8, 13, 15,&amp;lt;br/&amp;gt;   1,  3,  9,  9,  9,  9, 13, 15,&amp;lt;br/&amp;gt;   1,  3, 10, 10, 10, 10, 13, 15,&amp;lt;br/&amp;gt;   1,  3, 11, 11, 11, 11, 13, 15,&amp;lt;br/&amp;gt;};&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;int rookSharing[64] = {
   0,  1,  2,  3,  4,  5,  6,  7,
   1,  0,  3,  2,  5,  4,  7,  6,
   8,  9, 10, 11, 12, 13, 14, 15,
   9,  8, 11, 10, 13, 12, 15, 14,
  16, 17, 18, 19, 20, 21, 22, 23,
  17, 16, 19, 18, 21, 20, 23, 22,
  24, 25, 26, 27, 28, 29, 30, 31,
  25, 24, 27, 26, 29, 28, 31, 30,
};
&amp;nbsp;
int bishopSharing[64] = {
   0,  2,  4,  4,  4,  4, 12, 14,
   0,  2,  5,  5,  5,  5, 12, 14,
   0,  2,  6,  6,  6,  6, 12, 14,
   0,  2,  7,  7,  7,  7, 12, 14,
   1,  3,  8,  8,  8,  8, 13, 15,
   1,  3,  9,  9,  9,  9, 13, 15,
   1,  3, 10, 10, 10, 10, 13, 15,
   1,  3, 11, 11, 11, 11, 13, 15,
};&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:9 --&gt;On the cost of one additional and-instruction, post-masking has the potential to almost halve the rook tables - and even better for the already small bishop tables. Additionally, four union attack bitboards can be shared by eight rook- and six bishop-squares.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;R 1 1 1 1 1 1 1    1 R 1 1 1 1 1 1    1 1 R 1 1 1 1 1    1 1 1 R 1 1 1 1&amp;lt;br/&amp;gt;B R 1 1 1 1 1 1    R B 1 1 1 1 1 1    1 1 B R 1 1 1 1    1 1 R B 1 1 1 1&amp;lt;br/&amp;gt;1 1 1 . . . . .    1 1 1 . . . . .    . 1 1 1 1 . . .    . . 1 1 1 . . .&amp;lt;br/&amp;gt;1 1 1 1 . . . 1    1 1 . 1 . . . .    1 . 1 1 1 1 . .    . 1 1 1 . 1 . .&amp;lt;br/&amp;gt;1 1 . 1 1 . 1 .    1 1 . . 1 . . .    . . 1 1 . 1 1 .    1 . 1 1 . . 1 .&amp;lt;br/&amp;gt;1 1 . . 1 B . .    1 1 . . . 1 . .    . . 1 1 . . 1 B    . . 1 1 . . . 1&amp;lt;br/&amp;gt;1 1 . . 1 1 1 .    1 1 . . . . 1 .    . . 1 1 . . 1 1    . . 1 1 . . . .&amp;lt;br/&amp;gt;1 1 . 1 . . 1 1    1 1 . . . . . 1    . . 1 1 . 1 . .    . . 1 1 . . . .&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;R 1 1 1 1 1 1 1    1 R 1 1 1 1 1 1    1 1 R 1 1 1 1 1    1 1 1 R 1 1 1 1
B R 1 1 1 1 1 1    R B 1 1 1 1 1 1    1 1 B R 1 1 1 1    1 1 R B 1 1 1 1
1 1 1 . . . . .    1 1 1 . . . . .    . 1 1 1 1 . . .    . . 1 1 1 . . .
1 1 1 1 . . . 1    1 1 . 1 . . . .    1 . 1 1 1 1 . .    . 1 1 1 . 1 . .
1 1 . 1 1 . 1 .    1 1 . . 1 . . .    . . 1 1 . 1 1 .    1 . 1 1 . . 1 .
1 1 . . 1 B . .    1 1 . . . 1 . .    . . 1 1 . . 1 B    . . 1 1 . . . 1
1 1 . . 1 1 1 .    1 1 . . . . 1 .    . . 1 1 . . 1 1    . . 1 1 . . . .
1 1 . 1 . . 1 1    1 1 . . . . . 1    . . 1 1 . 1 . .    . . 1 1 . . . .&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;If the additional post-mask becomes member of a structure, it exceeds 32 byte in 64-bit mode. A structure of arrays may be preferable than an array of structures.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:11:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 attack_table[...]; // ~400K Byte for all rook and (shared) bishop attacks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct SMagic {&amp;lt;br/&amp;gt;   U64* ptr;      // pointer to attack_table for each particular square&amp;lt;br/&amp;gt;   U64 magic;     // magic 64-bit factor&amp;lt;br/&amp;gt;   U64 premask;   // to mask relevant squares of both lines (no outer squares)&amp;lt;br/&amp;gt;   U64 postmask;  // attacks on the otherwise empty board&amp;lt;br/&amp;gt;   int shift;     // shift right&amp;lt;br/&amp;gt;};&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;SMagic mBishopTbl[64];&amp;lt;br/&amp;gt;SMagic mRookTbl[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mBishopTbl[sq].ptr;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mBishopTbl[sq].premask;&amp;lt;br/&amp;gt;   occ      *= mBishopTbl[sq].magic;&amp;lt;br/&amp;gt;   occ     &amp;amp;gt;&amp;amp;gt;= mBishopTbl[sq].shift;&amp;lt;br/&amp;gt;   return      mBishopTbl[sq].postmask &amp;amp;amp; aptr[occ];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mRookTbl[sq].ptr;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mRookTbl[sq].premask;&amp;lt;br/&amp;gt;   occ      *= mRookTbl[sq].magic;&amp;lt;br/&amp;gt;   occ     &amp;amp;gt;&amp;amp;gt;= mRookTbl[sq].shift;&amp;lt;br/&amp;gt;   return      mRookTbl[sq].postmask &amp;amp;amp; aptr[occ];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 attack_table&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;...&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ~400K Byte for all rook and (shared) bishop attacks&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; ptr&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;      &lt;span class=&quot;co1&quot;&gt;// pointer to attack_table for each particular square&lt;/span&gt;
   U64 magic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;     &lt;span class=&quot;co1&quot;&gt;// magic 64-bit factor&lt;/span&gt;
   U64 premask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;// to mask relevant squares of both lines (no outer squares)&lt;/span&gt;
   U64 postmask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// attacks on the otherwise empty board&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; shift&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;     &lt;span class=&quot;co1&quot;&gt;// shift right&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
SMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
SMagic mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;premask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ     &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;      mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;postmask&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;premask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ     &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;      mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;postmask&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:11 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:218:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@IncorporatingtheShift&amp;quot; title=&amp;quot;Anchor: IncorporatingtheShift&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;IncorporatingtheShift&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:218 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:143:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc12&quot;&gt;&lt;a name=&quot;Implementations-Incorporating the Shift&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:143 --&gt;Incorporating the Shift&lt;/h2&gt;
 Another possible improvement was introduced by &lt;a class=&quot;wiki_link&quot; href=&quot;/Grant%20Osborne&quot;&gt;Grant Osborne&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:100:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;amp;p=196157&amp;amp;amp;t=21329&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Incorporating the shift into the magic number&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Grant%20Osborne&amp;quot;&amp;gt;Grant Osborne&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, June 18, 2008&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-21&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-21&quot;&gt;[21]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:100 --&gt; - to don&#039;t store the variable right shift inside an own array or structure element, but to use the almost redundant upper six bit of the magic factor instead - incorporating the shift into the magic number. While using a structure for pre-, postmask, magic and pointer, it&#039;s size is 4*8 = 32-byte or - if properly aligned - the half of one cache line. The additional effort for the right shift 58 to extract the variable shift is likely hidden by the latency of the independent multiplication, improving ipc.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:12:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 attack_table[...]; // ~400K Byte for all rook and (shared) bishop attacks&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;struct SMagic {&amp;lt;br/&amp;gt;   U64* ptr;      // pointer to attack_table for each particular square&amp;lt;br/&amp;gt;   U64 magic;     // magic 64-bit factor, including upper six bits as shift amount&amp;lt;br/&amp;gt;   U64 premask;   // to mask relevant squares of both lines (no outer squares)&amp;lt;br/&amp;gt;   U64 postmask;  // attacks on the otherwise empty board&amp;lt;br/&amp;gt;}; // 32 Byte with 64-bit pointer!&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;SMagic mBishopTbl[64];&amp;lt;br/&amp;gt;SMagic mRookTbl[64];&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mBishopTbl[sq].ptr;&amp;lt;br/&amp;gt;   int shift = mBishopTbl[sq].magic &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mBishopTbl[sq].premask;&amp;lt;br/&amp;gt;   occ      *= mBishopTbl[sq].magic;&amp;lt;br/&amp;gt;   return      mBishopTbl[sq].postmask &amp;amp;amp; aptr[occ &amp;amp;gt;&amp;amp;gt; shift];&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   U64* aptr = mRookTbl[sq].ptr;&amp;lt;br/&amp;gt;   int shift = mRookTbl[sq].magic &amp;amp;gt;&amp;amp;gt; 58;&amp;lt;br/&amp;gt;   occ      &amp;amp;amp;= mRookTbl[sq].premask;&amp;lt;br/&amp;gt;   occ      *= mRookTbl[sq].magic;&amp;lt;br/&amp;gt;   return      mRookTbl[sq].postmask &amp;amp;amp; aptr[occ &amp;amp;gt;&amp;amp;gt; shift];&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;U64 attack_table&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;...&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// ~400K Byte for all rook and (shared) bishop attacks&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;struct&lt;/span&gt; SMagic &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; ptr&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;      &lt;span class=&quot;co1&quot;&gt;// pointer to attack_table for each particular square&lt;/span&gt;
   U64 magic&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;     &lt;span class=&quot;co1&quot;&gt;// magic 64-bit factor, including upper six bits as shift amount&lt;/span&gt;
   U64 premask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;// to mask relevant squares of both lines (no outer squares)&lt;/span&gt;
   U64 postmask&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// attacks on the otherwise empty board&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// 32 Byte with 64-bit pointer!&lt;/span&gt;
&amp;nbsp;
SMagic mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
SMagic mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
U64 bishopAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; shift &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;premask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;      mBishopTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;postmask&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 rookAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, enumSquare sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aptr &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;ptr&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; shift &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;58&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;premask&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   occ      &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;magic&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt;      mRookTbl&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;postmask&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; aptr&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;occ &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; shift&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:12 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:219:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@IncorporatingOffset&amp;quot; title=&amp;quot;Anchor: IncorporatingOffset&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;IncorporatingOffset&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:219 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:145:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc13&quot;&gt;&lt;a name=&quot;Implementations-Incorporating Offset&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:145 --&gt;Incorporating Offset&lt;/h2&gt;
 A similar idea as in &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#IncorporatingtheShift&quot;&gt;Incorporating the Shift&lt;/a&gt; in the domain &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#FixedShiftFancy&quot;&gt;fixed shift magics&lt;/a&gt; was proposed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Eugene%20Kotlov&quot;&gt;Eugene Kotlov&lt;/a&gt; concerning the indirection to the stored attack array, using the 16 lower bits of the magic factor as offset &lt;!-- ws:start:WikiTextRefRule:104:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=66538&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;magic number comprising offset&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Eugene%20Kotlov&amp;quot;&amp;gt;Eugene Kotlov&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, February 07, 2018&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-22&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-22&quot;&gt;[22]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:104 --&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:147:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc14&quot;&gt;&lt;a name=&quot;Implementations-Initalization&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:147 --&gt;Initalization&lt;/h2&gt;
 &lt;!-- ws:start:WikiTextHeadingRule:149:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc15&quot;&gt;&lt;a name=&quot;Implementations-Initalization-Looking for Magics&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:149 --&gt;Looking for Magics&lt;/h3&gt;
 The main issue is to find 64 magic factors for each rook and bishop square, to ensure they are free of collisions.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Looking%20for%20Magics&quot;&gt;Looking for Magics&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:151:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc16&quot;&gt;&lt;a name=&quot;Implementations-Initalization-Magic Records&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:151 --&gt;Magic Records&lt;/h3&gt;
 You may try to find your own magics - to possibly contribute to the record table for most dense fancy or plain tables. So far, there were no magics found for the expensive rook squares a1 and h1 (0, 7) with less than 12 bits, which would allow to half the plain table size. Is there any prove they don&#039;t exist - even with &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#BlackMagics&quot;&gt;Black Magic&lt;/a&gt;?&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Best%20Magics%20so%20far&quot;&gt;Best Magics so far&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:153:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc17&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:153 --&gt;See also&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/BMI2#PEXTBitboards&quot;&gt;BMI2 - PEXT Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;Kindergarten Bitboards&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:155:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc18&quot;&gt;&lt;a name=&quot;Publications&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:155 --&gt;Publications&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt; (&lt;strong&gt;2007&lt;/strong&gt;). &lt;em&gt;Magic Move-Bitboard Generation in Computer Chess&lt;/em&gt;, as &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.pradu.us/old/Nov27_2008/Buzz/research/magic/Bitboards.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fritz%20Reul&quot;&gt;Fritz Reul&lt;/a&gt; (&lt;strong&gt;2009&lt;/strong&gt;). &lt;em&gt;New Architectures in Computer Chess&lt;/em&gt;, Ph.D. Thesis, Chapter 3, Magic Hash Functions for Bitboards, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://pure.uvt.nl/ws/files/1098572/Proefschrift_Fritz_Reul_170609.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Maurizio%20Monge&quot;&gt;Maurizio Monge&lt;/a&gt; (&lt;strong&gt;2011&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://scholar.google.com/citations?view_op=view_citation&amp;amp;hl=en&amp;amp;user=gpgb4LgAAAAJ&amp;amp;citation_for_view=gpgb4LgAAAAJ:UeHWp8X0CEIC&quot; rel=&quot;nofollow&quot;&gt;On perfect hashing of numbers with sparse digit representation via multiplication by a constant&lt;/a&gt;&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.sciencedirect.com/science/article/pii/S0166218X11000837&quot; rel=&quot;nofollow&quot;&gt;Discrete Applied Mathematics, Vol. 159, No. 11&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:157:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc19&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:157 --&gt;Forum Posts&lt;/h1&gt;
&lt;!-- ws:start:WikiTextHeadingRule:159:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc20&quot;&gt;&lt;a name=&quot;Forum Posts-2006&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:159 --&gt;2006&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5015&quot; rel=&quot;nofollow&quot;&gt;Fast(er) bitboard move generator&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Lasse%20Hansen&quot;&gt;Lasse Hansen&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, June 14, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5441&quot; rel=&quot;nofollow&quot;&gt;List of magics for bitboard move generation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, August 23, 2006&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=5452&quot; rel=&quot;nofollow&quot;&gt;Fastest Magic Move Bitboard Generator ready to use&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, August 25, 2006&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5997&quot; rel=&quot;nofollow&quot;&gt;A Faster Magic Move Bitboard Generator?&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Grant%20Osborne&quot;&gt;Grant Osborne&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, December 15, 2006&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:161:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc21&quot;&gt;&lt;a name=&quot;Forum Posts-2007&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:161 --&gt;2007&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=6104&quot; rel=&quot;nofollow&quot;&gt;SEE with magic bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, January 24, 2007 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Static%20Exchange%20Evaluation&quot;&gt;Static Exchange Evaluation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=15896&quot; rel=&quot;nofollow&quot;&gt;Magic bitboards, Java&lt;/a&gt; by Sargon, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 19, 2007 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Java&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=16002&quot; rel=&quot;nofollow&quot;&gt;BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Brian%20Richardson&quot;&gt;Brian Richardson&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 24, 2007 &lt;!-- ws:start:WikiTextRefRule:108:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.stmintz.com/ccc/index.php?id=107485&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Movegen Re: Bitmap Type Re: Tinker 81 secs Re: Testing speed&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Brian%20Richardson&amp;quot;&amp;gt;Brian Richardson&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, April 24, 2000&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-23&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-23&quot;&gt;[23]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:108 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=6823&quot; rel=&quot;nofollow&quot;&gt;Magic and precomputation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Onno%20Garms&quot;&gt;Onno Garms&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, September 23, 2007&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:163:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc22&quot;&gt;&lt;a name=&quot;Forum Posts-2008&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:163 --&gt;2008&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=175544&amp;amp;t=19699&quot; rel=&quot;nofollow&quot;&gt;Magic Move Generation&lt;/a&gt; by Colin, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, February 18, 2008&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=21329&quot; rel=&quot;nofollow&quot;&gt;How to reduce the &amp;quot;bits&amp;quot; used in a magic number&lt;/a&gt; by Charlie Brune, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, May 24, 2008&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=21543&quot; rel=&quot;nofollow&quot;&gt;magic move - bitboard orientation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Frank%20Phillips&quot;&gt;Frank Phillips&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, June 01, 2008&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=196157&amp;amp;t=21329&quot; rel=&quot;nofollow&quot;&gt;Incorporating the shift into the magic number&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Grant%20Osborne&quot;&gt;Grant Osborne&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, June 18, 2008&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:165:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc23&quot;&gt;&lt;a name=&quot;Forum Posts-2009&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:165 --&gt;2009&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=25810&quot; rel=&quot;nofollow&quot;&gt;Magics revisited&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Richard%20Pijl&quot;&gt;Richard Pijl&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 04, 2009&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=50043&quot; rel=&quot;nofollow&quot;&gt;Magic with fixed shift&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Onno%20Garms&quot;&gt;Onno Garms&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, March 18, 2009&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=30612&quot; rel=&quot;nofollow&quot;&gt;Paradigm shifts&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gian-Carlo%20Pascutto&quot;&gt;Gian-Carlo Pascutto&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, November 14, 2009&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=50616&amp;amp;p=192200&quot; rel=&quot;nofollow&quot;&gt;32-bit Magic experiments&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Andrew%20Fan&quot;&gt;Andrew Fan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, December 03, 2009 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;Kindergarten Bitboards&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:167:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc24&quot;&gt;&lt;a name=&quot;Forum Posts-2010 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:167 --&gt;2010 ...&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=35858&quot; rel=&quot;nofollow&quot;&gt;Plain and fancy magic on modern hardware&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Purves&quot;&gt;Robert Purves&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 22, 2010&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=51162&quot; rel=&quot;nofollow&quot;&gt;Fixed shift magics with 800KB lookup table&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, September, 05, 2010&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=39298&quot; rel=&quot;nofollow&quot;&gt;Build magics on the fly&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Marco%20Costalba&quot;&gt;Marco Costalba&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, June 07, 2011&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=46745&quot; rel=&quot;nofollow&quot;&gt;Magic Multiplier Fundamentals&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Cheney%20Nattress&quot;&gt;Cheney Nattress&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 03, 2013&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-chess.org/viewtopic.php?f=5&amp;amp;t=2240&quot; rel=&quot;nofollow&quot;&gt;Occupancy Variations&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Christian%20Daley&quot;&gt;CDaley11&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;OpenChess Forum&lt;/a&gt;, January 25, 2013&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=47576&quot; rel=&quot;nofollow&quot;&gt;Magic bitboards: Cache issues and state of the art?&lt;/a&gt; by Samuel Siltanen, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 22, 2013&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=52783&quot; rel=&quot;nofollow&quot;&gt;Understanding Magic Bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Jaco%20van%20Niekerk&quot;&gt;Jaco van Niekerk&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, April 03, 2013&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:169:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc25&quot;&gt;&lt;a name=&quot;Forum Posts-2015 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:169 --&gt;2015 ...&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=55712&quot; rel=&quot;nofollow&quot;&gt;question about magic keys generation time&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Fermin%20Serrano&quot;&gt;Fermin Serrano&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 19, 2015 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Looking%20for%20Magics&quot;&gt;Looking for Magics&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=57722&quot; rel=&quot;nofollow&quot;&gt;Fancy magic bitboards question&lt;/a&gt; by Eric VanderHelm, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, September 22, 2015&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=60007&quot; rel=&quot;nofollow&quot;&gt;M42 - A C++ library for Bitboard attack mask generation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Syed%20Fahad&quot;&gt;Syed Fahad&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, April 30, 2016 &lt;!-- ws:start:WikiTextRefRule:111:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://sites.google.com/site/sydfhd/projects/m42&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;M42&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Syed%20Fahad&amp;quot;&amp;gt;Syed Fahad&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-24&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-24&quot;&gt;[24]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:111 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=60065&quot; rel=&quot;nofollow&quot;&gt;understanding fixed shift fancy magic bitboard generation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Kalyankumar%20Ramaseshan&quot;&gt;Kalyankumar Ramaseshan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, May 05, 2016&lt;br /&gt;
&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=60065&amp;amp;start=14&quot; rel=&quot;nofollow&quot;&gt;Re: understanding fixed shift fancy magic bitboard generation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, May 06, 2016&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=62561&quot; rel=&quot;nofollow&quot;&gt;Why should magic bitboards be sparse?&lt;/a&gt; by Alessandro Power, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, December 21, 2016&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=64578&quot; rel=&quot;nofollow&quot;&gt;Looking for dense magics&lt;/a&gt; by Lucas Braesch, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, July 11, 2017&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&quot; rel=&quot;nofollow&quot;&gt;Black magic bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 03, 2017 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#BlackMagics&quot;&gt;Black Magic Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=65187&quot; rel=&quot;nofollow&quot;&gt;Disproving the existence of some magics&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Niklas%20Fiekas&quot;&gt;Niklas Fiekas&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, September 16, 2017 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Looking%20for%20Magics&quot;&gt;Looking for Magics&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=66538&quot; rel=&quot;nofollow&quot;&gt;magic number comprising offset&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Eugene%20Kotlov&quot;&gt;Eugene Kotlov&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, February 07, 2018&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=67051&quot; rel=&quot;nofollow&quot;&gt;No bishop magics with fixed shift 8&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Niklas%20Fiekas&quot;&gt;Niklas Fiekas&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, April 09, 2018 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Looking%20for%20Magics&quot;&gt;Looking for Magics&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:171:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc26&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:171 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.pradu.us/old/Nov27_2008/Buzz/&quot; rel=&quot;nofollow&quot;&gt;Buzz - A Winboard Chess Playing Program by Pradu Kannan&lt;/a&gt; - Source of &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&#039;s&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;magic&lt;/a&gt; Move Generator&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.rivalchess.com/magic-bitboards/&quot; rel=&quot;nofollow&quot;&gt;Rival Chess Engine - Magic Bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Russell%20Newman&quot;&gt;Russell Newman&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Chris%20Moreton&quot;&gt;Chris Moreton&lt;/a&gt; » &lt;a class=&quot;wiki_link&quot; href=&quot;/Rival&quot;&gt;Rival&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chessprogramming.net/generating-magic-multipliers/&quot; rel=&quot;nofollow&quot;&gt;Chess Programming | Generating Magic Multipliers&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steve%20Maughan&quot;&gt;Steve Maughan&lt;/a&gt; » &lt;a class=&quot;wiki_link&quot; href=&quot;/Looking%20for%20Magics&quot;&gt;Looking for Magics&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://stackoverflow.com/questions/16925204/sliding-move-generation-using-magic-bitboard&quot; rel=&quot;nofollow&quot;&gt;chess - Sliding move generation using magic bitboard&lt;/a&gt; - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Stack_Overflow&quot; rel=&quot;nofollow&quot;&gt;Stack Overflow&lt;/a&gt;, June 4, 2013&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://sites.google.com/site/sydfhd/projects/m42&quot; rel=&quot;nofollow&quot;&gt;M42&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Syed%20Fahad&quot;&gt;Syed Fahad&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:115:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.talkchess.com/forum/viewtopic.php?t=60007&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;M42 - A C++ library for Bitboard attack mask generation&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Syed%20Fahad&amp;quot;&amp;gt;Syed Fahad&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, April 30, 2016&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-25&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-25&quot;&gt;[25]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:115 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://github.com/goutham/magic-bits&quot; rel=&quot;nofollow&quot;&gt;GitHub - goutham/magic-bits: Magic-bitboards for Chess&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Goutham%20Bhat&quot;&gt;Goutham Bhat&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:173:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc27&quot;&gt;&lt;a name=&quot;Other Magic Stuff&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:173 --&gt;Other Magic Stuff&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Magic&quot; rel=&quot;nofollow&quot;&gt;Magic from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Magic_%28illusion%29&quot; rel=&quot;nofollow&quot;&gt;Magic (illusion) from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Magic_%28paranormal%29&quot; rel=&quot;nofollow&quot;&gt;Magic (paranormal) from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Magic_%28cryptography%29&quot; rel=&quot;nofollow&quot;&gt;Magic (cryptography) from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Magic_number_%28programming%29&quot; rel=&quot;nofollow&quot;&gt;Magic number from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Magic_constant&quot; rel=&quot;nofollow&quot;&gt;Magic constant from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Magic_square&quot; rel=&quot;nofollow&quot;&gt;Magic square from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Magic_hypercube&quot; rel=&quot;nofollow&quot;&gt;Magic hypercube from Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Five Senses - Magic Constant, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.kalevatravel.ee/index.aw/tallinn2011_culture_capital_europe&quot; rel=&quot;nofollow&quot;&gt;Christmas Jazz Festival&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Tallinn&quot; rel=&quot;nofollow&quot;&gt;Tallinn&lt;/a&gt;, December 10, 2011, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
line-up: &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#NguyenLe&quot;&gt;Nguyên Lê&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://de.wikipedia.org/wiki/Claudio_Puntin&quot; rel=&quot;nofollow&quot;&gt;Claudio Puntin&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://de.wikipedia.org/wiki/Steffen_Schorn&quot; rel=&quot;nofollow&quot;&gt;Steffen Schorn&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://de.wikipedia.org/wiki/Kristjan_Randalu&quot; rel=&quot;nofollow&quot;&gt;Kristjan Randalu&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.bodekjanke.de/english/home.php&quot; rel=&quot;nofollow&quot;&gt;Bodek Janke&lt;/a&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:116:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/youtube/oUDnf2fSIRQ?h=315&amp;amp;w=560&amp;quot; class=&amp;quot;WikiMedia WikiMediaYoutube&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;youtube&amp;amp;quot; key=&amp;amp;quot;oUDnf2fSIRQ&amp;amp;quot; width=&amp;amp;quot;560&amp;amp;quot;&amp;quot; title=&amp;quot;YouTube Video&amp;quot;height=&amp;quot;315&amp;quot; width=&amp;quot;560&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/oUDnf2fSIRQ&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:116 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#YounSunNah&quot;&gt;Youn Sun Nah&lt;/a&gt; - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.allaboutjazz.com/lento-youn-sun-nah-act-music-review-by-ian-patterson.php&quot; rel=&quot;nofollow&quot;&gt;Momento Magico&lt;/a&gt; (2013), &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/YouTube&quot; rel=&quot;nofollow&quot;&gt;YouTube&lt;/a&gt; Video&lt;br /&gt;
&lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#YounSunNah&quot;&gt;Youn Sun Nah&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#UlfWakenius&quot;&gt;Ulf Wakenius&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#LarsDanielsson&quot;&gt;Lars Danielsson&lt;/a&gt;,  &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#VincentPeirani&quot;&gt;Vincent Peirani&lt;/a&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextMediaRule:117:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/youtube/bOvB6gUpsuk?h=315&amp;amp;w=560&amp;quot; class=&amp;quot;WikiMedia WikiMediaYoutube&amp;quot; id=&amp;quot;wikitext@@media@@type=&amp;amp;quot;youtube&amp;amp;quot; key=&amp;amp;quot;bOvB6gUpsuk&amp;amp;quot;&amp;quot; title=&amp;quot;YouTube Video&amp;quot;height=&amp;quot;315&amp;quot; width=&amp;quot;560&amp;quot;/&amp;gt; --&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;//www.youtube.com/embed/bOvB6gUpsuk&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:117 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:175:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc28&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:175 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:1148:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=140141&amp;amp;t=16002&quot; rel=&quot;nofollow&quot;&gt;Re: BitBoard Tests Magic v Non-Rotated 32 Bits v 64 Bits&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 25, 2007&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.arasanchess.org/blogs/aug08.html&quot; rel=&quot;nofollow&quot;&gt;Arasan Blog - Aug 26, 2008&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Jon%20Dart&quot;&gt;Jon Dart&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.puckergallery.com/artists/bak_major/bak_major_all.html&quot; rel=&quot;nofollow&quot;&gt;Major Works&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.puckergallery.com/artists/bak_index/bak_publications.html&quot; rel=&quot;nofollow&quot;&gt;Samuel Bak - represented by Pucker Gallery since 1969&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=489834&quot; rel=&quot;nofollow&quot;&gt;rotated bitboards obsolete?&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, February 26, 2006&lt;/li&gt;
&lt;li id=&quot;cite_note-5&quot;&gt;&lt;a href=&quot;#cite_ref-5&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5015&quot; rel=&quot;nofollow&quot;&gt;Fast(er) bitboard move generator&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Lasse%20Hansen&quot;&gt;Lasse Hansen&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, June 14, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;, Initial idea&lt;/li&gt;
&lt;li id=&quot;cite_note-6&quot;&gt;&lt;a href=&quot;#cite_ref-6&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt; (&lt;strong&gt;2007&lt;/strong&gt;). &lt;em&gt;Magic Move-Bitboard Generation in Computer Chess&lt;/em&gt;, as &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.pradu.us/old/Nov27_2008/Buzz/research/magic/Bitboards.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-7&quot;&gt;&lt;a href=&quot;#cite_ref-7&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5441&quot; rel=&quot;nofollow&quot;&gt;List of magics for bitboard move generation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, August 23, &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2006&quot;&gt;2006&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-8&quot;&gt;&lt;a href=&quot;#cite_ref-8&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=35858&quot; rel=&quot;nofollow&quot;&gt;Plain and fancy magic on modern hardware&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Purves&quot;&gt;Robert Purves&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 22, 2010&lt;/li&gt;
&lt;li id=&quot;cite_note-9&quot;&gt;&lt;a href=&quot;#cite_ref-9&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.pradu.us/old/Nov27_2008/Buzz/&quot; rel=&quot;nofollow&quot;&gt;Buzz - A Winboard Chess Playing Program by Pradu Kannan&lt;/a&gt; - Source of &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&#039;s&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;magic&lt;/a&gt; Move Generator, PERFECT_MAGIC_HASH&lt;/li&gt;
&lt;li id=&quot;cite_note-10&quot;&gt;&lt;a href=&quot;#cite_ref-10&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.pradu.us/old/Nov27_2008/Buzz/&quot; rel=&quot;nofollow&quot;&gt;Buzz - A Winboard Chess Playing Program by Pradu Kannan&lt;/a&gt; - Source of &lt;a class=&quot;wiki_link&quot; href=&quot;/Pradu%20Kannan&quot;&gt;Pradu Kannan&#039;s&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards&quot;&gt;magic&lt;/a&gt; Move Generator, MINIMIZE_MAGIC&lt;/li&gt;
&lt;li id=&quot;cite_note-11&quot;&gt;&lt;a href=&quot;#cite_ref-11&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=50043&quot; rel=&quot;nofollow&quot;&gt;Magic with fixed shift&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Onno%20Garms&quot;&gt;Onno Garms&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, March 18, 2009&lt;/li&gt;
&lt;li id=&quot;cite_note-12&quot;&gt;&lt;a href=&quot;#cite_ref-12&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?f=4&amp;amp;t=51162&quot; rel=&quot;nofollow&quot;&gt;Fixed shift magics with 800KB lookup table&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, September, 05, 2010&lt;/li&gt;
&lt;li id=&quot;cite_note-13&quot;&gt;&lt;a href=&quot;#cite_ref-13&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=60065&amp;amp;start=14&quot; rel=&quot;nofollow&quot;&gt;Re: understanding fixed shift fancy magic bitboard generation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, May 06, 2016&lt;/li&gt;
&lt;li id=&quot;cite_note-14&quot;&gt;&lt;a href=&quot;#cite_ref-14&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&quot; rel=&quot;nofollow&quot;&gt;Black magic bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 03, 2017&lt;/li&gt;
&lt;li id=&quot;cite_note-15&quot;&gt;&lt;a href=&quot;#cite_ref-15&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&amp;amp;start=11&quot; rel=&quot;nofollow&quot;&gt;Re: Black magic bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 04, 2017&lt;/li&gt;
&lt;li id=&quot;cite_note-16&quot;&gt;&lt;a href=&quot;#cite_ref-16&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&amp;amp;start=14&quot; rel=&quot;nofollow&quot;&gt;Re: Black magic bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 04, 2017&lt;/li&gt;
&lt;li id=&quot;cite_note-17&quot;&gt;&lt;a href=&quot;#cite_ref-17&quot;&gt;^&lt;/a&gt; source code according to the &lt;a class=&quot;wiki_link&quot; href=&quot;/Magic%20Bitboards#FixedShiftFancy&quot;&gt;fixed shift fancy&lt;/a&gt; sample - array size from Volker&#039;s posting, also containing black magics and arrayoffsets, see &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=64790&quot; rel=&quot;nofollow&quot;&gt;Black magic bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Volker%20Annuss&quot;&gt;Volker Annuss&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 03, 2017&lt;/li&gt;
&lt;li id=&quot;cite_note-18&quot;&gt;&lt;a href=&quot;#cite_ref-18&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=368026&amp;amp;t=35858&quot; rel=&quot;nofollow&quot;&gt;Re: Plain and fancy magic on modern hardware&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Houdart&quot;&gt;Robert Houdart&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 26, 2010&lt;/li&gt;
&lt;li id=&quot;cite_note-19&quot;&gt;&lt;a href=&quot;#cite_ref-19&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?t=5997&quot; rel=&quot;nofollow&quot;&gt;A Faster Magic Move Bitboard Generator?&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Grant%20Osborne&quot;&gt;Grant Osborne&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, December 15, 2006&lt;/li&gt;
&lt;li id=&quot;cite_note-20&quot;&gt;&lt;a href=&quot;#cite_ref-20&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Lasse%20Hansen&quot;&gt;Lasse Hansen&#039;s&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.open-aurec.com/wbforum/viewtopic.php?topic_view=threads&amp;amp;p=185506&amp;amp;t=5441&quot; rel=&quot;nofollow&quot;&gt;postmask trick&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;Winboard Forum&lt;/a&gt;, May 09, 2008&lt;/li&gt;
&lt;li id=&quot;cite_note-21&quot;&gt;&lt;a href=&quot;#cite_ref-21&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&amp;amp;p=196157&amp;amp;t=21329&quot; rel=&quot;nofollow&quot;&gt;Incorporating the shift into the magic number&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Grant%20Osborne&quot;&gt;Grant Osborne&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, June 18, 2008&lt;/li&gt;
&lt;li id=&quot;cite_note-22&quot;&gt;&lt;a href=&quot;#cite_ref-22&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=66538&quot; rel=&quot;nofollow&quot;&gt;magic number comprising offset&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Eugene%20Kotlov&quot;&gt;Eugene Kotlov&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, February 07, 2018&lt;/li&gt;
&lt;li id=&quot;cite_note-23&quot;&gt;&lt;a href=&quot;#cite_ref-23&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=107485&quot; rel=&quot;nofollow&quot;&gt;Movegen Re: Bitmap Type Re: Tinker 81 secs Re: Testing speed&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Brian%20Richardson&quot;&gt;Brian Richardson&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, April 24, 2000&lt;/li&gt;
&lt;li id=&quot;cite_note-24&quot;&gt;&lt;a href=&quot;#cite_ref-24&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://sites.google.com/site/sydfhd/projects/m42&quot; rel=&quot;nofollow&quot;&gt;M42&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Syed%20Fahad&quot;&gt;Syed Fahad&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;cite_note-25&quot;&gt;&lt;a href=&quot;#cite_ref-25&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=60007&quot; rel=&quot;nofollow&quot;&gt;M42 - A C++ library for Bitboard attack mask generation&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Syed%20Fahad&quot;&gt;Syed Fahad&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, April 30, 2016&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:1148 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:177:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc29&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:177 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:013:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Magic Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;200&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Magic Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;200&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Magic_Bitboards includeBody-Magic%20Bitboards includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Abbess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Abbess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 10, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Abulafia&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Abulafia&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 4, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Alberto+Sanjuan&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Alberto Sanjuan&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 3, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/AMD&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;AMD&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 9, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Andreas+Guettinger&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Andreas Guettinger&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 14, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Andrew+Fan&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Andrew Fan&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Andscacs&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Andscacs&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 16, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Arasan&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Arasan&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 8, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Arminius&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Arminius&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Array&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Array&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 1, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Atlas+%28ESP%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Atlas (ESP)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 28, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Backtracking&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Backtracking&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 16, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Barbarossa&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Barbarossa&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 20, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/BBChess+%28SI%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;BBChess (SI)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 12, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Best+Magics+so+far&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Best Magics so far&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 13, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bitboard+Serialization&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bitboard Serialization&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 24, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/BMI2&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;BMI2&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 6, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Bobcat&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bobcat&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 27, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Brutus+NL&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Brutus NL&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 22, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Buzz&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Buzz&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 22, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Carballo&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Carballo&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 2, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Cheese&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Cheese&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 17, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Cheng&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Cheng&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/chess22k&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;chess22k&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 23, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/chess4j&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;chess4j&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chiron&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chiron&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 24, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Clarabit&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Clarabit&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 3, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Congruent+Modulo+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Congruent Modulo Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 26, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Counter&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Counter&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 13, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Crafty&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Crafty&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 28, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/CuckooChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;CuckooChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 17, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Defenchess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Defenchess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 18, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Demolito&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Demolito&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/DiscoCheck&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;DiscoCheck&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Djinn&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Djinn&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 8, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Don+Dailey&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Don Dailey&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Donna&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Donna&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 17, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Edsel+Apostol&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Edsel Apostol&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 2, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Efficient+Generation+of+Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Efficient Generation of Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 5, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Eric+Marath%C3%A9e&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Eric Marathée&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 27, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Ethereal&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Ethereal&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 20, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Exacto&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Exacto&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 3, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fire&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fire&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 12, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Firefly&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Firefly&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Fridolin&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fridolin&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 27, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Galjoen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Galjoen&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 19, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Garbochess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Garbochess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 23, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/General+Setwise+Operations&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;General Setwise Operations&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gerd+Isenberg&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gerd Isenberg&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 4, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gibbon&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gibbon&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 23, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Ginkgo&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Ginkgo&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 13, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Giraffe&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Giraffe&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 8, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Glaurung&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Glaurung&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Godot&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Godot&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 28, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gogobello&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gogobello&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/GopherCheck&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;GopherCheck&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 3, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Grant+Osborne&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Grant Osborne&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 2, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Greko&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Greko&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 27, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/GullChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;GullChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 27, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hakkapeliitta&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hakkapeliitta&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 26, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hash+Table&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hash Table&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hashing+Dictionaries&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hashing Dictionaries&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 1, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hedgehog&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hedgehog&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 18, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hermann&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hermann&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 7, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Hiding+the+Implementation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Hiding the Implementation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 3, 2011&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Home&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Home&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 2, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Houdini&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Houdini&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 14, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/iCE&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;iCE&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 4, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Ifrit&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Ifrit&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Java&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Java&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/JFresh&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;JFresh&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 2, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kholin&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kholin&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 3, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kindergarten+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kindergarten Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Laser&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Laser&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 27, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Lasse+Hansen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Lasse Hansen&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 1, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Looking+for+Magics&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Looking for Magics&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 13, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Loop+%28Program%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Loop (Program)&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Magic+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Magic Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 13, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Marco+Costalba&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Marco Costalba&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 28, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Mark+Levene&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Mark Levene&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Marvin&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Marvin&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 10, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Maurizio+Monge&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Maurizio Monge&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 27, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Maverick&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Maverick&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/MinkoChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;MinkoChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 5, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Move+Generation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Move Generation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 29, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Murka&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Murka&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 11, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Napoleon&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Napoleon&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 25, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Nemorino&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Nemorino&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 21, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/NoraGrace&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;NoraGrace&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 23, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Occupancy&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Occupancy&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 19, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Octochess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Octochess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 15, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Onno&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Onno&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 19, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Onno+Garms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Onno Garms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 19, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Orion&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Orion&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 15, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Paladin&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Paladin&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 29, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pawn+Hash+Table&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pawn Hash Table&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 1, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pawny&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pawny&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 17, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pedone&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pedone&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 16, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pradu+Kannan&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pradu Kannan&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 3, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Prophet&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Prophet&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Protector&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Protector&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 12, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/RedQueen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;RedQueen&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 13, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rhetoric&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rhetoric&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 15, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rival&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rival&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Robert+Houdart&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Robert Houdart&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 8, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Robert+Hyatt&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Robert Hyatt&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 25, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Robert+Pope&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Robert Pope&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 10, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Robocide&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Robocide&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 11, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rodent&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rodent&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 11, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rodin&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rodin&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 7, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/RuyDos&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;RuyDos&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 17, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rybka&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rybka&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 27, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Schooner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Schooner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 2, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Scorpio&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Scorpio&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 28, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Searcher&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Searcher&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 26, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SEE+-+The+Swap+Algorithm&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SEE - The Swap Algorithm&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 5, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Senpai&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Senpai&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 10, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Shield&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Shield&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 17, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sloppy&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sloppy&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 17, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SmarThink&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SmarThink&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 2, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/SnailChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;SnailChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 26, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Space-Time+Tradeoff&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Space-Time Tradeoff&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 17, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Static+Exchange+Evaluation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Static Exchange Evaluation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Stockfish&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Stockfish&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 7, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Syed+Fahad&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Syed Fahad&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Takuya+Obata&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Takuya Obata&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 7, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Texel&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Texel&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 9, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tim+Kosse&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tim Kosse&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 23, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tinker&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tinker&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 29, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Titboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Titboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 20, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tornado&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tornado&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 14, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Traversing+Subsets+of+a+Set&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Traversing Subsets of a Set&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 14, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Trevor+Fenner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Trevor Fenner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 2, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Trial+and+Error&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Trial and Error&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 11, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tucano&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tucano&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 16, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Tunguska&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Tunguska&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 16, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Vadim+Demichev&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Vadim Demichev&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 26, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Vajolet&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Vajolet&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Volker+Annuss&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Volker Annuss&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 3, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Wing&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Wing&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 26, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Winglet&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Winglet&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 26, 2015&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Winter&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Winter&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 23, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/WyldChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;WyldChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 10, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Xiphos&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Xiphos&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 22, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Zevra&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Zevra&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 12, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Ziggurat&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Ziggurat&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 9, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Zurichess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Zurichess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 12, 2018&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:013 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>
    <item>
      <title>Occupancy of any Line</title>
      <link>https://chessprogramming.wikispaces.com/Occupancy+of+any+Line</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Occupancy+of+any+Line</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Occupancy+of+any+Line</comments>
      <pubDate>Fri, 16 Sep 2016 20:25:28 GMT</pubDate>
      <description>&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Home&quot;&gt;Home&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Board%20Representation&quot;&gt;Board Representation&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboards&quot;&gt;Bitboards&lt;/a&gt; * &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; * Occupancy of any Line&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:107:&amp;lt;img src=&amp;quot;/file/view/Besetzt20160916.JPG/592429434/Besetzt20160916.JPG&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;img src=&quot;/file/view/Besetzt20160916.JPG/592429434/Besetzt20160916.JPG&quot; alt=&quot;Besetzt20160916.JPG&quot; title=&quot;Besetzt20160916.JPG&quot; /&gt;&lt;!-- ws:end:WikiTextLocalImageRule:107 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
        &lt;td rowspan=&quot;2&quot;&gt;&lt;strong&gt;Occupancy of any Line&lt;/strong&gt;,&lt;br /&gt;
unlike &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks&quot;&gt;rank attacks&lt;/a&gt;, the problem arises for &lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;files&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Diagonals&quot;&gt;diagonals&lt;/a&gt; how to get scattered &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancies&lt;/a&gt; to consecutive &lt;a class=&quot;wiki_link&quot; href=&quot;/Bit&quot;&gt;bits&lt;/a&gt; of a dense lookup index. In the past, prior to early 2000, 64-bit &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Multiplication&quot;&gt;multiplication&lt;/a&gt; was unfeasible   - much too slow.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Line Occupancy &lt;!-- ws:start:WikiTextRefRule:18:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://de-de.facebook.com/umspannwerk.recklinghausen/posts/10153757793891429&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Besetzt!&amp;lt;/a&amp;gt; (Occupied) - &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Toilet&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Toilet&amp;lt;/a&amp;gt; exhibition at &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://de.wikipedia.org/wiki/Umspannwerk_Recklinghausen&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Umspannwerk Recklinghausen&amp;lt;/a&amp;gt;, today &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/RWE&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;RWE&amp;lt;/a&amp;gt; &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Technology_museum&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Technology museum&amp;lt;/a&amp;gt; in &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Recklinghausen&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Recklinghausen&amp;lt;/a&amp;gt;, Germany, and part of &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Arts#IndustrialHeritageTrail&amp;quot;&amp;gt;The Industrial Heritage Trail&amp;lt;/a&amp;gt; of the &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Ruhr&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Ruhr area&amp;lt;/a&amp;gt; - Row of occupied &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Toilet#Others&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;portable toilets&amp;lt;/a&amp;gt;, Photo by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Gerd%20Isenberg&amp;quot;&amp;gt;Gerd Isenberg&amp;lt;/a&amp;gt;, September 16, 2016&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-1&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:18 --&gt;&lt;br /&gt;
&lt;/td&gt;
        &lt;th&gt;&lt;br /&gt;
&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;!-- ws:start:WikiTextTocRule:54:&amp;lt;img id=&amp;quot;wikitext@@toc@@normal&amp;quot; class=&amp;quot;WikiMedia WikiMediaToc&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/normal?w=225&amp;amp;h=100&amp;quot;/&amp;gt; --&gt;&lt;div id=&quot;toc&quot;&gt;&lt;h1 class=&quot;nopad&quot;&gt;Table of Contents&lt;/h1&gt;&lt;!-- ws:end:WikiTextTocRule:54 --&gt;&lt;!-- ws:start:WikiTextTocRule:55: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Avoiding Multiplication&quot;&gt;Avoiding Multiplication&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:55 --&gt;&lt;!-- ws:start:WikiTextTocRule:56: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Avoiding Multiplication-Rotated Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:56 --&gt;&lt;!-- ws:start:WikiTextTocRule:57: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Avoiding Multiplication-Collapsed Files&quot;&gt;Collapsed Files&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:57 --&gt;&lt;!-- ws:start:WikiTextTocRule:58: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Avoiding Multiplication-Collapsed Ranks&quot;&gt;Collapsed Ranks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:58 --&gt;&lt;!-- ws:start:WikiTextTocRule:59: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Using Multiplication&quot;&gt;Using Multiplication&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:59 --&gt;&lt;!-- ws:start:WikiTextTocRule:60: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Using Multiplication-Collapsed Files&quot;&gt;Collapsed Files&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:60 --&gt;&lt;!-- ws:start:WikiTextTocRule:61: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Using Multiplication-Collapsed Ranks&quot;&gt;Collapsed Ranks&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:61 --&gt;&lt;!-- ws:start:WikiTextTocRule:62: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:62 --&gt;&lt;!-- ws:start:WikiTextTocRule:63: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Forum Posts&quot;&gt;Forum Posts&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:63 --&gt;&lt;!-- ws:start:WikiTextTocRule:64: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#External Links&quot;&gt;External Links&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:64 --&gt;&lt;!-- ws:start:WikiTextTocRule:65: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:65 --&gt;&lt;!-- ws:start:WikiTextTocRule:66: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:66 --&gt;&lt;!-- ws:start:WikiTextTocRule:67: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:67 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:30:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Avoiding Multiplication&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:30 --&gt;Avoiding Multiplication&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextHeadingRule:32:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Avoiding Multiplication-Rotated Bitboards&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:32 --&gt;Rotated Bitboards&lt;/h2&gt;
 One solution was the invention of &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;rotated bitboards&lt;/a&gt; - to keep and maintain three additional rotated occupied bitboards, with consecutive bits for the appropriate rays. Similar to the bit-layout mentioned in &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#Rotationby90degreesClockwise&quot;&gt;rotate by 90 degrees&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#PseudoRotationby45degrees&quot;&gt;pseudo rotate by 90 degrees&lt;/a&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:68:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@CollapsedFiles&amp;quot; title=&amp;quot;Anchor: CollapsedFiles&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;CollapsedFiles&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:68 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:34:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Avoiding Multiplication-Collapsed Files&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:34 --&gt;Collapsed Files&lt;/h2&gt;
 Other techniques were about to hash the masked line with &lt;a class=&quot;wiki_link&quot; href=&quot;/Parallel%20Prefix%20Algorithms&quot;&gt;parallel prefix shifts&lt;/a&gt; to collapse &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;ranks&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Diagonals&quot;&gt;diagonals&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Anti-Diagonals&quot;&gt;anti-diagonals&lt;/a&gt; along the &lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;files&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:22:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://groups.google.com/d/msg/rec.games.chess.computer/YvFagyuVogw/2vNJw_qT8IYJ&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Rotated bitboards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Urban%20Koistinen&amp;quot;&amp;gt;Urban Koistinen&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Computer%20Chess%20Forums&amp;quot;&amp;gt;rgcc&amp;lt;/a&amp;gt;, October 31, 1997&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-2&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:22 --&gt; &lt;!-- ws:start:WikiTextRefRule:26:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.stmintz.com/ccc/index.php?id=491079&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Some thoughts on Dann Corbit&#039;s rotated alternative&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Steffan%20Westcott&amp;quot;&amp;gt;Steffan Westcott&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, March 03, 2006&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-3&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-3&quot;&gt;[3]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:26 --&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int collapsedFilesIndex(U64 b) {&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 32;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 16;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt;  8;&amp;lt;br/&amp;gt;   return b &amp;amp;amp; 0xFF;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; collapsedFilesIndex&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0xFF&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;In 32-bit mode, assembly programmers may collapse files to register AL in five instructions, saving &amp;gt;&amp;gt; 32 and &amp;gt;&amp;gt; 8:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;or  eax, edx&amp;lt;br/&amp;gt;mov edx, eax&amp;lt;br/&amp;gt;shr eax, 16&amp;lt;br/&amp;gt;or  eax, edx&amp;lt;br/&amp;gt;or  al, ah&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.text  {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;text&quot;&gt;or  eax, edx
mov edx, eax
shr eax, 16
or  eax, edx
or  al, ah&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:69:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@CollapsedRanks&amp;quot; title=&amp;quot;Anchor: CollapsedRanks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;CollapsedRanks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:69 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:36:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Avoiding Multiplication-Collapsed Ranks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:36 --&gt;Collapsed Ranks&lt;/h2&gt;
 For a line along &lt;a class=&quot;wiki_link&quot; href=&quot;/Files&quot;&gt;files&lt;/a&gt; (as well as &lt;a class=&quot;wiki_link&quot; href=&quot;/Diagonals&quot;&gt;diagonals&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Anti-Diagonals&quot;&gt;anti-diagonals&lt;/a&gt;), a little more trickery is needed:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int collapsedRanksIndex(U64 b) {&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt;  4;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt;  2;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt;  1;&amp;lt;br/&amp;gt;   b &amp;amp;amp;= C64(0x0101010101010101):&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt;  7;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 14;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 28;&amp;lt;br/&amp;gt;   return b &amp;amp;amp; 0xFF;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; collapsedRanksIndex&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0xFF&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;If it is exclusively about to collapse files to ranks, one can save the first three parallel prefix shifts, but shift right by file-index:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int collapsedRanksIndex(U64 b, enumFile file) {&amp;lt;br/&amp;gt;   b  = b &amp;amp;gt;&amp;amp;gt; file;&amp;lt;br/&amp;gt;   b &amp;amp;amp;= C64(0x0101010101010101):&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt;  7;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 14;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 28;&amp;lt;br/&amp;gt;   return b &amp;amp;amp; 0xFF;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; collapsedRanksIndex&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b, enumFile file&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   b  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; file&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;:&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0xFF&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:70:&amp;lt;img src=&amp;quot;/i/anchor.gif&amp;quot; class=&amp;quot;WikiAnchor&amp;quot; alt=&amp;quot;Anchor&amp;quot; id=&amp;quot;wikitext@@anchor@@Multiplication&amp;quot; title=&amp;quot;Anchor: Multiplication&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;Multiplication&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:70 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:38:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Using Multiplication&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:38 --&gt;Using Multiplication&lt;/h1&gt;
 Recent 64-bit processors, such as &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Intel_Core_2&quot; rel=&quot;nofollow&quot;&gt;core 2&lt;/a&gt; or &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://en.wikipedia.org/wiki/Athlon_64&quot; rel=&quot;nofollow&quot;&gt;K8&lt;/a&gt; have a amazingly fast 64-bit &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#Multiplication&quot;&gt;multiplication&lt;/a&gt;, so that flip- or rotation-tricks as mentioned in &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#DiagonalstoRanks&quot;&gt;diagonals to rank&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#FlipAbouttheDiagonal&quot;&gt;flip about the diagonal&lt;/a&gt; are competitive nowadays.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:40:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Using Multiplication-Collapsed Files&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:40 --&gt;Collapsed Files&lt;/h2&gt;
 &lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int collapsedFilesIndex(U64 b) {&amp;lt;br/&amp;gt;   const U64 aFile   = C64(0x0101010101010101);&amp;lt;br/&amp;gt;   return (b * aFile) &amp;amp;gt;&amp;amp;gt; 56;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; collapsedFilesIndex&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 aFile   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; aFile&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;56&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;or in 32-bit mode:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int collapsedFilesIndex(U64 b) {&amp;lt;br/&amp;gt;   unsigned int folded = (unsigned int)b | (unsigned int)(b &amp;amp;gt;&amp;amp;gt; 32);&amp;lt;br/&amp;gt;   return (folded * 0x01010101) &amp;amp;gt;&amp;amp;gt; 24;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; collapsedFilesIndex&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; folded &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;unsigned&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;folded &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x01010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:5 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:42:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Using Multiplication-Collapsed Ranks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:42 --&gt;Collapsed Ranks&lt;/h2&gt;
 &lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int collapsedRanksIndex(U64 b) {&amp;lt;br/&amp;gt;   const U64 aFile   = C64(0x0101010101010101);&amp;lt;br/&amp;gt;   const U64 antiDia = C64(0x0102040810204080);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 4;   // No masking needed&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 2;   //    &amp;amp;quot;         &amp;amp;quot;&amp;lt;br/&amp;gt;   b |= b &amp;amp;gt;&amp;amp;gt; 1;   //    &amp;amp;quot;         &amp;amp;quot;&amp;lt;br/&amp;gt;   return ((b &amp;amp;amp; aFile) * antiDia) &amp;amp;gt;&amp;amp;gt; 56;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; collapsedRanksIndex&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 aFile   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 antiDia &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0102040810204080&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;// No masking needed&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;//    &amp;quot;         &amp;quot;&lt;/span&gt;
   b &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;//    &amp;quot;         &amp;quot;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; aFile&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; antiDia&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;56&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:6 --&gt;or dedicated for files&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:7:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;int collapsedRanksIndex(U64 b, enumFile file) {&amp;lt;br/&amp;gt;   const U64 aFile   = C64(0x0101010101010101);&amp;lt;br/&amp;gt;   const U64 antiDia = C64(0x0102040810204080);&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   b  = b &amp;amp;gt;&amp;amp;gt; file;&amp;lt;br/&amp;gt;   return ((b &amp;amp;amp; aFile) * antiDia) &amp;amp;gt;&amp;amp;gt; 56;&amp;lt;br/&amp;gt;}&amp;lt;/pre&amp;gt;
 --&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;!--
/**
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 */
.cpp  {font-family:monospace;}
.cpp .imp {font-weight: bold; color: red;}
.cpp .kw1 {color: #0000ff;}
.cpp .kw2 {color: #0000ff;}
.cpp .kw3 {color: #0000dd;}
.cpp .kw4 {color: #0000ff;}
.cpp .co1 {color: #666666;}
.cpp .co2 {color: #339900;}
.cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp .es0 {color: #000099; font-weight: bold;}
.cpp .es1 {color: #000099; font-weight: bold;}
.cpp .es2 {color: #660099; font-weight: bold;}
.cpp .es3 {color: #660099; font-weight: bold;}
.cpp .es4 {color: #660099; font-weight: bold;}
.cpp .es5 {color: #006699; font-weight: bold;}
.cpp .br0 {color: #008000;}
.cpp .sy0 {color: #008000;}
.cpp .sy1 {color: #000080;}
.cpp .sy2 {color: #000040;}
.cpp .sy3 {color: #000040;}
.cpp .sy4 {color: #008080;}
.cpp .st0 {color: #FF0000;}
.cpp .nu0 {color: #0000dd;}
.cpp .nu6 {color: #208080;}
.cpp .nu8 {color: #208080;}
.cpp .nu12 {color: #208080;}
.cpp .nu16 {color:#800080;}
.cpp .nu17 {color:#800080;}
.cpp .nu18 {color:#800080;}
.cpp .nu19 {color:#800080;}
.cpp .me1 {color: #007788;}
.cpp .me2 {color: #007788;}
.cpp span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;cpp&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; collapsedRanksIndex&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 b, enumFile file&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 aFile   &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010101&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; U64 antiDia &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0102040810204080&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   b  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; b &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; file&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;b &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; aFile&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; antiDia&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;56&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:7 --&gt;&lt;br /&gt;
Those techniques are actually used in &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;kindergarten bitboards&lt;/a&gt;, considering the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;inner six bits&lt;/a&gt; for a denser lookup.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:44:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:44 --&gt;See also&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#RankFileAndDiagonal&quot;&gt;Flipping, Mirroring and Rotating of Rank, File and Diagonal&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;Rotated Bitboards&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/OliThink#SlidingPieceAttacks&quot;&gt;Sliding Piece Attacks&lt;/a&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/OliThink&quot;&gt;OliThink&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:46:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:46 --&gt;Forum Posts&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://groups.google.com/d/msg/rec.games.chess.computer/YvFagyuVogw/2vNJw_qT8IYJ&quot; rel=&quot;nofollow&quot;&gt;Re: Rotated bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Urban%20Koistinen&quot;&gt;Urban Koistinen&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, October 31, 1997&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=491079&quot; rel=&quot;nofollow&quot;&gt;Re: Some thoughts on Dann Corbit&#039;s rotated alternative&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 03, 2006&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.talkchess.com/forum/viewtopic.php?t=29296&quot; rel=&quot;nofollow&quot;&gt;Kindergarten bitboards without multiplying&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Piotr%20Cichy&quot;&gt;Piotr Cichy&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 07, 2009 » &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;Kindergarten Bitboards&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:48:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc9&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:48 --&gt;External Links&lt;/h1&gt;
 &lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://drpetric.blogspot.com/2013/09/bit-gathering-via-multiplication.html&quot; rel=&quot;nofollow&quot;&gt;Bit Gather Via Multiplication&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Vlad%20Petric&quot;&gt;Vlad Petric&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://drpetric.blogspot.com/&quot; rel=&quot;nofollow&quot;&gt;Dr. Petric&#039;s Technical Blog&lt;/a&gt;, September 17, 2013 &lt;!-- ws:start:WikiTextRefRule:28:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://chessprogramming.wikispaces.com/share/view/64439740&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Demystifying the Magic Multiplier?&amp;lt;/a&amp;gt;&amp;amp;lt;/ref&amp;amp;gt; --&gt;&lt;sup id=&quot;cite_ref-4&quot; class=&quot;reference&quot;&gt;&lt;a href=&quot;#cite_note-4&quot;&gt;[4]&lt;/a&gt;&lt;/sup&gt;&lt;!-- ws:end:WikiTextRefRule:28 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:50:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc10&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:50 --&gt;References&lt;/h1&gt;
&lt;!-- ws:start:WikiTextReferencesRule:188:&amp;amp;lt;references /&amp;amp;gt; --&gt;&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;cite_note-1&quot;&gt;&lt;a href=&quot;#cite_ref-1&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://de-de.facebook.com/umspannwerk.recklinghausen/posts/10153757793891429&quot; rel=&quot;nofollow&quot;&gt;Besetzt!&lt;/a&gt; (Occupied) - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Toilet&quot; rel=&quot;nofollow&quot;&gt;Toilet&lt;/a&gt; exhibition at &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://de.wikipedia.org/wiki/Umspannwerk_Recklinghausen&quot; rel=&quot;nofollow&quot;&gt;Umspannwerk Recklinghausen&lt;/a&gt;, today &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/RWE&quot; rel=&quot;nofollow&quot;&gt;RWE&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Technology_museum&quot; rel=&quot;nofollow&quot;&gt;Technology museum&lt;/a&gt; in &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Recklinghausen&quot; rel=&quot;nofollow&quot;&gt;Recklinghausen&lt;/a&gt;, Germany, and part of &lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#IndustrialHeritageTrail&quot;&gt;The Industrial Heritage Trail&lt;/a&gt; of the &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Ruhr&quot; rel=&quot;nofollow&quot;&gt;Ruhr area&lt;/a&gt; - Row of occupied &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Toilet#Others&quot; rel=&quot;nofollow&quot;&gt;portable toilets&lt;/a&gt;, Photo by &lt;a class=&quot;wiki_link&quot; href=&quot;/Gerd%20Isenberg&quot;&gt;Gerd Isenberg&lt;/a&gt;, September 16, 2016&lt;/li&gt;
&lt;li id=&quot;cite_note-2&quot;&gt;&lt;a href=&quot;#cite_ref-2&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://groups.google.com/d/msg/rec.games.chess.computer/YvFagyuVogw/2vNJw_qT8IYJ&quot; rel=&quot;nofollow&quot;&gt;Re: Rotated bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Urban%20Koistinen&quot;&gt;Urban Koistinen&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, October 31, 1997&lt;/li&gt;
&lt;li id=&quot;cite_note-3&quot;&gt;&lt;a href=&quot;#cite_ref-3&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=491079&quot; rel=&quot;nofollow&quot;&gt;Re: Some thoughts on Dann Corbit&#039;s rotated alternative&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Steffan%20Westcott&quot;&gt;Steffan Westcott&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, March 03, 2006&lt;/li&gt;
&lt;li id=&quot;cite_note-4&quot;&gt;&lt;a href=&quot;#cite_ref-4&quot;&gt;^&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://chessprogramming.wikispaces.com/share/view/64439740&quot; rel=&quot;nofollow&quot;&gt;Demystifying the Magic Multiplier?&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:188 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:52:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc11&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:52 --&gt;What links here?&lt;/h1&gt;
&lt;!-- ws:start:WikiTextIncludeRule:08:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/include/backlinks?w=200&amp;amp;h=100&amp;quot; class=&amp;quot;WikiMedia WikiMediaInclude&amp;quot; id=&amp;quot;wikitext@@include@@page=&amp;amp;quot;Occupancy of any Line&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;80&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Occupancy of any Line&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;80&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Occupancy_of_any_Line includeBody-Occupancy%20of%20any%20Line includeBody&quot;&gt;&lt;table class=&quot;includeBacklinks&quot;&gt;
  &lt;thead&gt;
    &lt;tr class=&quot;includeBacklinksHeading&quot;&gt;
      &lt;th class=&quot;includeBacklinksPageHeading&quot;&gt;Page&lt;/th&gt;
      &lt;th class=&quot;includeBacklinksDateHeading&quot;&gt;Date Edited&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Amundsen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Amundsen&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 3, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Cassandre&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Cassandre&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 5, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Chezzz&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Chezzz&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 20, 2013&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Flipping+Mirroring+and+Rotating&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Flipping Mirroring and Rotating&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 14, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/General+Setwise+Operations&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;General Setwise Operations&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 25, 2018&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Gk&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Gk&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 9, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kindergarten+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kindergarten Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Kurt&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kurt&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 20, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Occupancy&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Occupancy&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 19, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Occupancy+of+any+Line&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Occupancy of any Line&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 16, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/OliThink&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;OliThink&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 19, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Parallel+Prefix+Algorithms&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Parallel Prefix Algorithms&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 22, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Pepito&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pepito&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 27, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Population+Count&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Population Count&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 3, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Prophet&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Prophet&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 30, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Rotated+Bitboards&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rotated Bitboards&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 7, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sayuri&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sayuri&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 1, 2017&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Sliding+Piece+Attacks&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sliding Piece Attacks&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 27, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Smash&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Smash&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 11, 2016&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Steffan+Westcott&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Steffan Westcott&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 21, 2014&lt;/td&gt;
    &lt;/tr&gt;
        &lt;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Urban+Koistinen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Urban Koistinen&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 20, 2014&lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:08 --&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Piece%20Attacks&quot;&gt;Up one Level&lt;/a&gt;&lt;/strong&gt;</description>
          </item>

  </channel>
</rss>