<?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>Atlas</title>
      <link>https://chessprogramming.wikispaces.com/Atlas</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Atlas</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Atlas</comments>
      <pubDate>Sun, 05 Nov 2017 10:23:37 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;/Engines&quot;&gt;Engines&lt;/a&gt; * Atlas&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:158:&amp;lt;a href=&amp;quot;https://commons.wikimedia.org/wiki/File:Singer_Sargent,_John_-_Atlas_and_the_Hesperides_-_1925.jpg&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/236px-Singer_Sargent%2C_John_-_Atlas_and_the_Hesperides_-_1925.jpg/620984391/236px-Singer_Sargent%2C_John_-_Atlas_and_the_Hesperides_-_1925.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;https://commons.wikimedia.org/wiki/File:Singer_Sargent,_John_-_Atlas_and_the_Hesperides_-_1925.jpg&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/236px-Singer_Sargent%2C_John_-_Atlas_and_the_Hesperides_-_1925.jpg/620984391/236px-Singer_Sargent%2C_John_-_Atlas_and_the_Hesperides_-_1925.jpg&quot; alt=&quot;236px-Singer_Sargent,_John_-_Atlas_and_the_Hesperides_-_1925.jpg&quot; title=&quot;236px-Singer_Sargent,_John_-_Atlas_and_the_Hesperides_-_1925.jpg&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:158 --&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;Atlas&lt;/strong&gt;,&lt;br /&gt;
an early chess program written in 1967 by &lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; at &lt;a class=&quot;wiki_link&quot; href=&quot;/Atlas%20Computer%20Laboratory&quot;&gt;Atlas Computer Laboratory&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Chilton,_Oxfordshire&quot; rel=&quot;nofollow&quot;&gt;Chilton&lt;/a&gt;. It was basically a resurrected, cleaned up &lt;a class=&quot;wiki_link&quot; href=&quot;/Algol&quot;&gt;Algol&lt;/a&gt; version of Bell&#039;s and &lt;a class=&quot;wiki_link&quot; href=&quot;/Nils%20Barricelli&quot;&gt;Barricelli&#039;s&lt;/a&gt; old program from the early 60s to test evolutionary theories, which had an &lt;a class=&quot;wiki_link&quot; href=&quot;/Evaluation%20function&quot;&gt;evaluation function&lt;/a&gt; based purely on &lt;a class=&quot;wiki_link&quot; href=&quot;/Mobility&quot;&gt;mobility&lt;/a&gt; - at that time the first fully legal chess program to run in England &lt;!-- ws:start:WikiTextRefRule:10:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.chilton-computing.org.uk/acl/applications/cocoa/p008.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;MASTER at IFIPS&amp;lt;/a&amp;gt;. Excerpt from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Alex%20Bell&amp;quot;&amp;gt;Alex Bell&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1978&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;The Machine Plays Chess?&amp;lt;/em&amp;gt;. &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Pergamon_Press&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Pergamon Press&amp;lt;/a&amp;gt;, hosted by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Atlas%20Computer%20Laboratory&amp;quot;&amp;gt;Atlas Computer Laboratory&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Rutherford_Appleton_Laboratory&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Rutherford Appleton Laboratory (RAL)&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:10 --&gt;, and likely also the base of Barricelli&#039;s &lt;a class=&quot;wiki_link&quot; href=&quot;/WCCC%201974&quot;&gt;WCCC 1974&lt;/a&gt; entry &lt;a class=&quot;wiki_link&quot; href=&quot;/Freedom&quot;&gt;Freedom&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
Atlas, running on an &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/International_Computers_Limited&quot; rel=&quot;nofollow&quot;&gt;ICL&lt;/a&gt; &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Atlas_%28computer%29&quot; rel=&quot;nofollow&quot;&gt;Atlas&lt;/a&gt; computer &lt;!-- ws:start:WikiTextRefRule:13:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.chilton-computing.org.uk/acl/literature/acl/p004.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Atlas Computer Laboratory&amp;lt;/a&amp;gt;, hosted by &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Rutherford_Appleton_Laboratory&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Rutherford Appleton Laboratory (RAL)&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:13 --&gt;, looked three &lt;a class=&quot;wiki_link&quot; href=&quot;/Ply&quot;&gt;plies&lt;/a&gt; ahead with &lt;a class=&quot;wiki_link&quot; href=&quot;/Alpha-Beta&quot;&gt;alpha-beta&lt;/a&gt;, and would accept almost any &lt;a class=&quot;wiki_link&quot; href=&quot;/Captures&quot;&gt;captures&lt;/a&gt; in that &lt;a class=&quot;wiki_link&quot; href=&quot;/Depth&quot;&gt;depth&lt;/a&gt; with weighting on swaps of the more powerful pieces, i.e. it would always swap a queen for a queen. If no captures were present it prepared to &lt;a class=&quot;wiki_link&quot; href=&quot;/Castling&quot;&gt;castle&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Minimax&quot;&gt;mini-maximised&lt;/a&gt; its mobility. A slight modification prevented it from moving its queen in the first 5 moves &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.chilton-computing.org.uk/acl/applications/cocoa/p008.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;MASTER at IFIPS&amp;lt;/a&amp;gt;. Excerpt from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Alex%20Bell&amp;quot;&amp;gt;Alex Bell&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1978&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;The Machine Plays Chess?&amp;lt;/em&amp;gt;.  &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Pergamon_Press&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Pergamon Press&amp;lt;/a&amp;gt;, hosted by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Atlas%20Computer%20Laboratory&amp;quot;&amp;gt;Atlas Computer Laboratory&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Rutherford_Appleton_Laboratory&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Rutherford Appleton Laboratory (RAL)&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;. Atlas played a few sparring games against &lt;a class=&quot;wiki_link&quot; href=&quot;/Lancaster&quot;&gt;Lancaster&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:30:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/John%20J.%20Scott&amp;quot;&amp;gt;John J. Scott&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1969&amp;lt;/strong&amp;gt;). &amp;lt;em&amp;gt;Lancaster vs. Mac Hack&amp;lt;/em&amp;gt;. &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/ACM#SIG&amp;quot;&amp;gt;ACM SIGART Bulletin&amp;lt;/a&amp;gt;, Vol. 16&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:30 --&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/John%20J.%20Scott&quot;&gt;John Scott&#039;s&lt;/a&gt; program, then dubbed &amp;quot;Scott&amp;quot; &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://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/p005.htm#index22&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Chess programs: Scott&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Alex%20Bell&amp;quot;&amp;gt;Alex Bell&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1972&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.chilton-computing.org.uk/acl/literature/books/gamesplaying/overview.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Games Playing with Computers&amp;lt;/a&amp;gt;&amp;lt;/em&amp;gt;. &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Allen_%26_Unwin&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Allen &amp;amp;amp; Unwin&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:39 --&gt;, and largely suffered from &lt;a class=&quot;wiki_link&quot; href=&quot;/Horizon%20Effect&quot;&gt;horizon effect&lt;/a&gt;.&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Atlas_%28mythology%29&quot; rel=&quot;nofollow&quot;&gt;Atlas&lt;/a&gt; and the &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Hesperides&quot; rel=&quot;nofollow&quot;&gt;Hesperides&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:44:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://commons.wikimedia.org/wiki/File:Singer_Sargent,_John_-_Atlas_and_the_Hesperides_-_1925.jpg&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Atlas and the Hesperides&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Arts#JohnSingerSargent&amp;quot;&amp;gt;John Singer Sargent&amp;lt;/a&amp;gt;, between circa 1922 and circa 1925, current location: &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Museum_of_Fine_Arts,_Boston&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Museum of Fine Arts, Boston&amp;lt;/a&amp;gt;, &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://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-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:44 --&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:76:&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:76 --&gt;&lt;!-- ws:start:WikiTextTocRule:77: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Move Generation&quot;&gt;Move Generation&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;#Master&quot;&gt;Master&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;#Namesake&quot;&gt;Namesake&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;#External Links&quot;&gt;External Links&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;#External Links-Chess Program&quot;&gt;Chess Program&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;#External Links-Misc&quot;&gt;Misc&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;#References&quot;&gt;References&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;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:86 --&gt;&lt;!-- ws:start:WikiTextTocRule:87: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:87 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:56:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Move Generation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:56 --&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@@MoveGeneration&amp;quot; title=&amp;quot;Anchor: MoveGeneration&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;MoveGeneration&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:88 --&gt;Move Generation&lt;/h1&gt;
A description of Atlas&#039; &lt;a class=&quot;wiki_link&quot; href=&quot;/Move%20Generation&quot;&gt;move generation&lt;/a&gt; techniques along with a mate-in-two solver is given with Algol source code listing in &lt;em&gt;Games Playing with Computers&lt;/em&gt;, 3.1 Chess &lt;!-- ws:start:WikiTextRefRule:53:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/p003.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Games Playing with Computers | Chapter 3: Board Games&amp;lt;/a&amp;gt;, in &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Alex%20Bell&amp;quot;&amp;gt;Alex Bell&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1972&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.chilton-computing.org.uk/acl/literature/books/gamesplaying/overview.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Games Playing with Computers&amp;lt;/a&amp;gt;&amp;lt;/em&amp;gt;. &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;https://en.wikipedia.org/wiki/Allen_%26_Unwin&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Allen &amp;amp;amp; Unwin&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:53 --&gt;. Atlas uses two distinct &lt;a class=&quot;wiki_link&quot; href=&quot;/8x8%20Board&quot;&gt;8x8 boards&lt;/a&gt; [1:65] and &lt;a class=&quot;wiki_link&quot; href=&quot;/Piece-Lists&quot;&gt;piece lists&lt;/a&gt; [O:16] for white and black man with identical &lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces#PieceCoding&quot;&gt;piece coding&lt;/a&gt;, passing the boards per reference as &#039;mymanin&#039; or &#039;opponents&#039; dependent on &lt;a class=&quot;wiki_link&quot; href=&quot;/Side%20to%20move&quot;&gt;side to move&lt;/a&gt;. Pre-calculated rook and bishop tables contain one vector of &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;direction&lt;/a&gt; increments, i.e. east (+1), west (-1), north (+8), and south (-8) for rooks, and further for each square a vector of ray-direction terminal &lt;a class=&quot;wiki_link&quot; href=&quot;/Target%20Square&quot;&gt;destination squares&lt;/a&gt;. The embedded routine &#039;rookorbishopmove&#039; in scope of the outer move generation routine loops over all four directions, gets increment and terminal target square from the rook or bishop table, and iterates the destination along the ray. Inside the ray-loop it tests whether the target is occupied by an own man, to terminate the ray-loop, otherwise it stores the move, and then tests to break after a capture or even an illegal king capture with an extra exit &#039;cutoff&#039;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;pascal&amp;quot;&amp;gt;procedure rookorbishopmove(rookorbishop);&amp;lt;br/&amp;gt;  integer array rookorbishop;&amp;lt;br/&amp;gt;  begin &amp;lt;br/&amp;gt;    for j := 0 step 1 until 3 do&amp;lt;br/&amp;gt;    begin &amp;lt;br/&amp;gt;      k := rookorbishop[j]; k is increment:&amp;lt;br/&amp;gt;      l := rookorbishop[4 * square + j]; l is terminal square&amp;lt;br/&amp;gt;      for i := square + k step k until l do &amp;lt;br/&amp;gt;      begin &amp;lt;br/&amp;gt;        if mymanin[i] ≠ 0 then goto newdirection;&amp;lt;br/&amp;gt;        c := c+1;&amp;lt;br/&amp;gt;        moves[c] := i;&amp;lt;br/&amp;gt;        if opponents[i] ≠ 0 then &amp;lt;br/&amp;gt;        begin&amp;lt;br/&amp;gt;          if opponents[i] = 6 then goto cutoff else goto newdirection&amp;lt;br/&amp;gt;        end&amp;lt;br/&amp;gt;      end;&amp;lt;br/&amp;gt;newdirection:&amp;lt;br/&amp;gt;    end&amp;lt;br/&amp;gt;  end of rookorbishopmove;&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/)
 */
.pascal  {font-family:monospace;}
.pascal .imp {font-weight: bold; color: red;}
.pascal .kw1 {color: #000000; font-weight: bold;}
.pascal .kw2 {color: #000000; font-weight: bold;}
.pascal .kw3 {color: #000066;}
.pascal .kw4 {color: #000066; font-weight: bold;}
.pascal .co1 {color: #808080; font-style: italic;}
.pascal .co2 {color: #008000; font-style: italic;}
.pascal .coMULTI {color: #808080; font-style: italic;}
.pascal .es0 {color: #ff0000; font-weight: bold;}
.pascal .br0 {color: #009900;}
.pascal .sy0 {color: #000066;}
.pascal .sy1 {color: #000066;}
.pascal .sy2 {color: #000066;}
.pascal .sy3 {color: #000066;}
.pascal .st0 {color: #ff0000;}
.pascal .st_h {color: #ff0000;}
.pascal .nu0 {color: #cc66cc;}
.pascal .me1 {color: #006600;}
.pascal .re0 {color: #0000cc;}
.pascal .re1 {color: #ff0000;}
.pascal span.xtra { display:block; }

--&gt;
&lt;/style&gt;&lt;pre class=&quot;pascal&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;procedure&lt;/span&gt; rookorbishopmove&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rookorbishop&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;integer&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;array&lt;/span&gt; rookorbishop&lt;span class=&quot;sy1&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;begin&lt;/span&gt; 
    &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; j &lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt; step &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;until&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;begin&lt;/span&gt; 
      k &lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;=&lt;/span&gt; rookorbishop&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;j&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;;&lt;/span&gt; k is increment&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
      l &lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;=&lt;/span&gt; rookorbishop&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;sy3&quot;&gt;*&lt;/span&gt; square &lt;span class=&quot;sy3&quot;&gt;+&lt;/span&gt; j&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;;&lt;/span&gt; l is terminal square
      &lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;=&lt;/span&gt; square &lt;span class=&quot;sy3&quot;&gt;+&lt;/span&gt; k step k &lt;span class=&quot;kw1&quot;&gt;until&lt;/span&gt; l &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; 
      &lt;span class=&quot;kw1&quot;&gt;begin&lt;/span&gt; 
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; mymanin&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;nu0&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;then&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;goto&lt;/span&gt; newdirection&lt;span class=&quot;sy1&quot;&gt;;&lt;/span&gt;
        c &lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sy3&quot;&gt;=&lt;/span&gt; c&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;sy1&quot;&gt;;&lt;/span&gt;
        moves&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;c&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;sy3&quot;&gt;=&lt;/span&gt; i&lt;span class=&quot;sy1&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; opponents&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;nu0&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;then&lt;/span&gt; 
        &lt;span class=&quot;kw1&quot;&gt;begin&lt;/span&gt;
          &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; opponents&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;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;then&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;goto&lt;/span&gt; cutoff &lt;span class=&quot;kw1&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;goto&lt;/span&gt; newdirection
        &lt;span class=&quot;kw1&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;kw1&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;;&lt;/span&gt;
newdirection&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;of&lt;/span&gt; rookorbishopmove&lt;span class=&quot;sy1&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:58:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Master&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:58 --&gt;Master&lt;/h1&gt;
In the early 70s, Atlas evolved to &lt;a class=&quot;wiki_link&quot; href=&quot;/Master&quot;&gt;Master&lt;/a&gt; in collaboration with &lt;a class=&quot;wiki_link&quot; href=&quot;/Peter%20Kent&quot;&gt;Peter Kent&lt;/a&gt;, and later with &lt;a class=&quot;wiki_link&quot; href=&quot;/John%20Birmingham&quot;&gt;John Birmingham&lt;/a&gt; and chess expert &lt;a class=&quot;wiki_link&quot; href=&quot;/John%20Waldron&quot;&gt;John Waldron&lt;/a&gt;, while Alex Bell finally left Chilton.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:60:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Namesake&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:60 --&gt;Namesake&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Atlas%20%28ESP%29&quot;&gt;Atlas&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Andr%C3%A9s%20Manzanares%20Campillo&quot;&gt;Andrés Manzanares Campillo&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:62:&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:62 --&gt;See also&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Various%20Classifications#Astronomy&quot;&gt;Astronomy&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Various%20Classifications#Geography&quot;&gt;Geography&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Master&quot;&gt;Master&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Various%20Classifications#Mythology&quot;&gt;Mythology&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:64:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Publications&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:64 --&gt;Publications&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; (&lt;strong&gt;1972&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/overview.htm&quot; rel=&quot;nofollow&quot;&gt;Games Playing with Computers&lt;/a&gt;&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Allen_%26_Unwin&quot; rel=&quot;nofollow&quot;&gt;Allen &amp;amp; Unwin&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/index.htm&quot; rel=&quot;nofollow&quot;&gt;index&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; (&lt;strong&gt;1978&lt;/strong&gt;). &lt;em&gt;The Machine Plays Chess?&lt;/em&gt;  &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Pergamon_Press&quot; rel=&quot;nofollow&quot;&gt;Pergamon Press&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.amazon.com/Machine-Plays-Chess-Pergamon/dp/0080212220&quot; rel=&quot;nofollow&quot;&gt;amazon&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:66:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:66 --&gt;External Links&lt;/h1&gt;
&lt;!-- ws:start:WikiTextHeadingRule:68:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc6&quot;&gt;&lt;a name=&quot;External Links-Chess Program&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:68 --&gt;Chess Program&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/p003.htm&quot; rel=&quot;nofollow&quot;&gt;Games Playing with Computers | Chapter 3: Board Games&lt;/a&gt;, in &lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; (&lt;strong&gt;1972&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/overview.htm&quot; rel=&quot;nofollow&quot;&gt;Games Playing with Computers&lt;/a&gt;&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Allen_%26_Unwin&quot; rel=&quot;nofollow&quot;&gt;Allen &amp;amp; Unwin&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chilton-computing.org.uk/acl/applications/cocoa/p008.htm&quot; rel=&quot;nofollow&quot;&gt;MASTER at IFIPS&lt;/a&gt;. Excerpt from &lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; (&lt;strong&gt;1978&lt;/strong&gt;). &lt;em&gt;The Machine Plays Chess?&lt;/em&gt;.  &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Pergamon_Press&quot; rel=&quot;nofollow&quot;&gt;Pergamon Press&lt;/a&gt;, hosted by &lt;a class=&quot;wiki_link&quot; href=&quot;/Atlas%20Computer%20Laboratory&quot;&gt;Atlas Computer Laboratory&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Rutherford_Appleton_Laboratory&quot; rel=&quot;nofollow&quot;&gt;Rutherford Appleton Laboratory (RAL)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:70:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc7&quot;&gt;&lt;a name=&quot;External Links-Misc&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:70 --&gt;Misc&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Atlas_%28computer%29&quot; rel=&quot;nofollow&quot;&gt;Atlas (computer) 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/Atlas_%28disambiguation%29&quot; rel=&quot;nofollow&quot;&gt;Atlas (disambiguation) 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/Atlas&quot; rel=&quot;nofollow&quot;&gt;Atlas 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/Atlas_Mountains&quot; rel=&quot;nofollow&quot;&gt;Atlas Mountains 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/Atlas_%28mythology%29&quot; rel=&quot;nofollow&quot;&gt;Atlas (mythology) from Wikipedia&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Calypso_%28mythology%29&quot; rel=&quot;nofollow&quot;&gt;Calypso (mythology) 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/Farnese_Atlas&quot; rel=&quot;nofollow&quot;&gt;Farnese Atlas 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/Atlas_%28rocket_family%29&quot; rel=&quot;nofollow&quot;&gt;Atlas (rocket family) 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/Atlas_%28star%29&quot; rel=&quot;nofollow&quot;&gt;Atlas (star) 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/Atlas_%28moon%29&quot; rel=&quot;nofollow&quot;&gt;Atlas (moon) 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/Colossochelys_atlas&quot; rel=&quot;nofollow&quot;&gt;Colossochelys atlas from Wikipedia&lt;/a&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; &amp;amp; &lt;a class=&quot;wiki_link&quot; href=&quot;/Videos#UlfWakenius&quot;&gt;Ulf Wakenius&lt;/a&gt; - Calypso Blues @ &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://fr.wikipedia.org/wiki/Jazz_sous_les_pommiers&quot; rel=&quot;nofollow&quot;&gt;Jazz sous les pommiers&lt;/a&gt;, May 28, 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;
&lt;!-- ws:start:WikiTextMediaRule:54:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/youtube/Tw0XAggrigQ?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;Tw0XAggrigQ&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/Tw0XAggrigQ&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:54 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:72:&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:72 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:275:&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.chilton-computing.org.uk/acl/applications/cocoa/p008.htm&quot; rel=&quot;nofollow&quot;&gt;MASTER at IFIPS&lt;/a&gt;. Excerpt from &lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; (&lt;strong&gt;1978&lt;/strong&gt;). &lt;em&gt;The Machine Plays Chess?&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Pergamon_Press&quot; rel=&quot;nofollow&quot;&gt;Pergamon Press&lt;/a&gt;, hosted by &lt;a class=&quot;wiki_link&quot; href=&quot;/Atlas%20Computer%20Laboratory&quot;&gt;Atlas Computer Laboratory&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Rutherford_Appleton_Laboratory&quot; rel=&quot;nofollow&quot;&gt;Rutherford Appleton Laboratory (RAL)&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.chilton-computing.org.uk/acl/literature/acl/p004.htm&quot; rel=&quot;nofollow&quot;&gt;Atlas Computer Laboratory&lt;/a&gt;, hosted by &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Rutherford_Appleton_Laboratory&quot; rel=&quot;nofollow&quot;&gt;Rutherford Appleton Laboratory (RAL)&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.chilton-computing.org.uk/acl/applications/cocoa/p008.htm&quot; rel=&quot;nofollow&quot;&gt;MASTER at IFIPS&lt;/a&gt;. Excerpt from &lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; (&lt;strong&gt;1978&lt;/strong&gt;). &lt;em&gt;The Machine Plays Chess?&lt;/em&gt;.  &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Pergamon_Press&quot; rel=&quot;nofollow&quot;&gt;Pergamon Press&lt;/a&gt;, hosted by &lt;a class=&quot;wiki_link&quot; href=&quot;/Atlas%20Computer%20Laboratory&quot;&gt;Atlas Computer Laboratory&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Rutherford_Appleton_Laboratory&quot; rel=&quot;nofollow&quot;&gt;Rutherford Appleton Laboratory (RAL)&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;/John%20J.%20Scott&quot;&gt;John J. Scott&lt;/a&gt; (&lt;strong&gt;1969&lt;/strong&gt;). &lt;em&gt;Lancaster vs. Mac Hack&lt;/em&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/ACM#SIG&quot;&gt;ACM SIGART Bulletin&lt;/a&gt;, Vol. 16&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.chilton-computing.org.uk/acl/literature/books/gamesplaying/p005.htm#index22&quot; rel=&quot;nofollow&quot;&gt;Chess programs: Scott&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; (&lt;strong&gt;1972&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/overview.htm&quot; rel=&quot;nofollow&quot;&gt;Games Playing with Computers&lt;/a&gt;&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Allen_%26_Unwin&quot; rel=&quot;nofollow&quot;&gt;Allen &amp;amp; Unwin&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;https://commons.wikimedia.org/wiki/File:Singer_Sargent,_John_-_Atlas_and_the_Hesperides_-_1925.jpg&quot; rel=&quot;nofollow&quot;&gt;Atlas and the Hesperides&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#JohnSingerSargent&quot;&gt;John Singer Sargent&lt;/a&gt;, between circa 1922 and circa 1925, current location: &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Museum_of_Fine_Arts,_Boston&quot; rel=&quot;nofollow&quot;&gt;Museum of Fine Arts, Boston&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Wikimedia_Commons&quot; rel=&quot;nofollow&quot;&gt;Wikimedia Commons&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.chilton-computing.org.uk/acl/literature/books/gamesplaying/p003.htm&quot; rel=&quot;nofollow&quot;&gt;Games Playing with Computers | Chapter 3: Board Games&lt;/a&gt;, in &lt;a class=&quot;wiki_link&quot; href=&quot;/Alex%20Bell&quot;&gt;Alex Bell&lt;/a&gt; (&lt;strong&gt;1972&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/overview.htm&quot; rel=&quot;nofollow&quot;&gt;Games Playing with Computers&lt;/a&gt;&lt;/em&gt;. &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Allen_%26_Unwin&quot; rel=&quot;nofollow&quot;&gt;Allen &amp;amp; Unwin&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:275 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:74:&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:74 --&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@@page=&amp;amp;quot;Atlas&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;Atlas&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-Atlas includeBody-Atlas 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/Alex+Bell&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Alex Bell&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 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/AtlanChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;AtlanChess&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/Atlas&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Atlas&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 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/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/Atlas+Computer+Laboratory&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Atlas Computer Laboratory&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 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/Engines&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Engines&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/John+J.+Scott&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;John J. Scott&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 30, 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/Lancaster&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Lancaster&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 30, 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/Master&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Master&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/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/Peter+Kent&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Peter Kent&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/Table-driven+Move+Generation&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Table-driven Move Generation&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 19, 2017&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;/Engines&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>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>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>Obstruction Difference</title>
      <link>https://chessprogramming.wikispaces.com/Obstruction+Difference</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Obstruction+Difference</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Obstruction+Difference</comments>
      <pubDate>Fri, 27 May 2016 12:50:52 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; * Obstruction Difference&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:60:&amp;lt;a href=&amp;quot;http://www.imj.org.il/imagine/collections/item.asp?itemNum=194569&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/Obstruction.jpg/157882347/357x209/Obstruction.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;height: 209px; width: 357px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://www.imj.org.il/imagine/collections/item.asp?itemNum=194569&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/Obstruction.jpg/157882347/357x209/Obstruction.jpg&quot; alt=&quot;Obstruction.jpg&quot; title=&quot;Obstruction.jpg&quot; style=&quot;height: 209px; width: 357px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:60 --&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;Obstruction Difference&lt;/strong&gt; is another subtraction approach, proposed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Michael%20Hoffmann&quot;&gt;Michael Hoffmann&lt;/a&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.talkchess.com/forum/viewtopic.php?t=29087&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;DIRECT BITBOARD MOVEGENERATION&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Michael%20Hoffmann&amp;quot;&amp;gt;Michael Hoffmann&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 23, 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:8 --&gt;. The idea is to get disjoint &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 masks&lt;/a&gt; of the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt;, and to subtract the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#TheMostSignificantOneBitMS1B&quot;&gt;most significant one bit&lt;/a&gt; of the negative ray from the doubled &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#TheLeastSignificantOneBitLS1B&quot;&gt;least siginificat one bit&lt;/a&gt; (LS1B) of the positive ray. The difference is finally intersected with the linemask, excluding the &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Pieces&quot;&gt;sliding piece&lt;/a&gt; itself from the attack set.&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#Ray&quot;&gt;Man Ray&lt;/a&gt;, Obstruction, 1947 &lt;!-- ws:start:WikiTextRefRule:10:&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-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:10 --&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:29:&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:29 --&gt;&lt;!-- ws:start:WikiTextTocRule:30: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Empty Sets&quot;&gt;Empty Sets&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;#Isolation&quot;&gt;Isolation&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;#C Code&quot;&gt;C Code&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;#Java&quot;&gt;Java&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;#How it works&quot;&gt;How it works&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:34 --&gt;&lt;!-- ws:start:WikiTextTocRule:35: --&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:35 --&gt;&lt;!-- ws:start:WikiTextTocRule:36: --&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:36 --&gt;&lt;!-- ws:start:WikiTextTocRule:37: --&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:37 --&gt;&lt;!-- ws:start:WikiTextTocRule:38: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:38 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:13:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Empty Sets&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:13 --&gt;Empty Sets&lt;/h1&gt;
 If there is no obstruction inside the positive ray, we simply subtract from zero, aka borrow from the hidden 2^64 bit, same if doubling results in an empty set. If there is no obstruction inside the negative ray, we need at least to subtract one. With neither blocker available, the difference is the universal set -1 (~0), and we end up with the linemask, excluding the sliding piece, which are all &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board&quot;&gt;attacks on the otherwise empty board&lt;/a&gt;. Therefor, to subtract at least &#039;1&#039;, oring &#039;1&#039; is required if the negative ray occupancy is empty. Since setting the least significant bit does not affect any MS1B extraction, it can be done unconditionally on the negative ray.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:15:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Isolation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:15 --&gt;Isolation&lt;/h1&gt;
 While &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#LS1BIsolation&quot;&gt;isolation of the LS1B&lt;/a&gt; is the intersection of a bitboard with its &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#TheTwosComplement&quot;&gt;two&#039;s complement&lt;/a&gt;, the &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#TheMostSignificantOneBitMS1B&quot;&gt;MS1B&lt;/a&gt; is not that simple to extract, and requires a fast 64-bit &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#Bitscanreverse&quot;&gt;BitScanReverse&lt;/a&gt;, f.i. &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&lt;/a&gt; with throughput in the &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#x86Timing&quot;&gt;one cycle range&lt;/a&gt;, as with &lt;a class=&quot;wiki_link&quot; href=&quot;/Intel&quot;&gt;Intel&#039;s&lt;/a&gt; &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/Nehalem_%28microarchitecture%29&quot; rel=&quot;nofollow&quot;&gt;Nehalem architecture&lt;/a&gt;, or &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#LeadingZeroCount&quot;&gt;Leading Zero Count&lt;/a&gt;, f.i. &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;lzcnt&lt;/a&gt; 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/AMD_K10&quot; rel=&quot;nofollow&quot;&gt;K10&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/Intel&quot;&gt;Intel&lt;/a&gt; Nehalem CPUs.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:17:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;C Code&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:17 --&gt;C Code&lt;/h1&gt;
 The routine works for all lines, &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;/Files&quot;&gt;files&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; by applying appropriate line-masks, and could therefor used as a generalized routine with a line-direction parameter, or in &lt;a class=&quot;wiki_link&quot; href=&quot;/C&quot;&gt;C&lt;/a&gt; even passing a pointer to a structure with three (or multiples for several lines in parallel) bitboards per square and line, upper- and lower rays and the union of both.&lt;br /&gt;
&lt;!-- ws:start:WikiTextIncludeRule:05:&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:05 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt; * @author Michael Hoffmann, Gerd Isenberg&amp;lt;br/&amp;gt; * @param  U64 occ occupancy of the board&amp;lt;br/&amp;gt; * @param  SMasks* a mask structure by square and line&amp;lt;br/&amp;gt; * @return line attacks from that square&amp;lt;br/&amp;gt; */&amp;lt;br/&amp;gt;U64 lineAttacks(U64 occ, const SMasks *pMask) {&amp;lt;br/&amp;gt;   U64 lower, upper, mMS1B, ls1b, odiff;&amp;lt;br/&amp;gt;   lower = pMask-&amp;amp;gt;lower &amp;amp;amp; occ;&amp;lt;br/&amp;gt;   upper = pMask-&amp;amp;gt;upper &amp;amp;amp; occ;&amp;lt;br/&amp;gt;   mMS1B = -C64(1) &amp;amp;lt;&amp;amp;lt; bsr64(lower | 1); // ms1b of lower (at least bit zero)&amp;lt;br/&amp;gt;   ls1b  = upper &amp;amp;amp; -upper;&amp;lt;br/&amp;gt;   odiff = 2 * ls1b + mMS1B; // x86 lea option due to add -ms1b&amp;lt;br/&amp;gt;   return pMask-&amp;amp;gt;lineEx &amp;amp;amp; odiff; // (pMask-&amp;amp;gt;lower | pMask-&amp;amp;gt;upper) &amp;amp;amp; odiff;&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;/*
 * @author Michael Hoffmann, Gerd Isenberg
 * @param  U64 occ occupancy of the board
 * @param  SMasks* a mask structure by square and line
 * @return line attacks from that square
 */&lt;/span&gt;
U64 lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; SMasks &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;pMask&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 lower, upper, mMS1B, ls1b, odiff&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   lower &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pMask&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt;lower &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   upper &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; pMask&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt;upper &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   mMS1B &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sy2&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; bsr64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;lower &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;co1&quot;&gt;// ms1b of lower (at least bit zero)&lt;/span&gt;
   ls1b  &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; upper &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;upper&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   odiff &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;sy2&quot;&gt;*&lt;/span&gt; ls1b &lt;span class=&quot;sy2&quot;&gt;+&lt;/span&gt; mMS1B&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// x86 lea option due to add -ms1b&lt;/span&gt;
   &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; pMask&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt;lineEx &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; odiff&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// (pMask-&amp;gt;lower | pMask-&amp;gt;upper) &amp;amp; odiff;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;To use it that way:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;struct SMasks&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   U64 lower;&amp;lt;br/&amp;gt;   U64 upper;&amp;lt;br/&amp;gt;   U64 lineEx; // lower | upper&amp;lt;br/&amp;gt;} masks[64][4]; // 6 (4) KByte, needs initialization&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   return lineAttacks(occ, masks[sq] + 0) | lineAttacks(occ, masks[sq] + 1);&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   return lineAttacks(occ, masks[sq] + 2) | lineAttacks(occ, masks[sq] + 3);&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; SMasks
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 lower&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 upper&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 lineEx&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// lower | upper&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; masks&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;4&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;// 6 (4) KByte, needs initialization&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;kw1&quot;&gt;return&lt;/span&gt; lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, masks&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;sy2&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;sy3&quot;&gt;|&lt;/span&gt; lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, masks&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;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;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
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; lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, masks&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;sy2&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;sy3&quot;&gt;|&lt;/span&gt; lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, masks&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;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;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;Since with two&#039;s complement i &amp;lt;&amp;lt; x == - (-i &amp;lt;&amp;lt; x), 2*high-low is done by add for the option to use &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.cs.virginia.edu/%7Eevans/cs216/guides/x86.html&quot; rel=&quot;nofollow&quot;&gt;x86 lea-instruction&lt;/a&gt;. The routine looks competitive for CPUs with fast &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64#gpinstructions&quot;&gt;bsr&lt;/a&gt; or &lt;a class=&quot;wiki_link&quot; href=&quot;/x86-64#gpinstructions&quot;&gt;lzcnt&lt;/a&gt; but has problems on processors with slow bitScan or 32-bit processors. Register usage is moderate and should suffice all x88-64 scratch registers for two lines, even for &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;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:19:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Java&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:19 --&gt;Java&lt;/h1&gt;
 &lt;a class=&quot;wiki_link&quot; href=&quot;/Java&quot;&gt;Java&lt;/a&gt; programmers may rely on &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Long.html#numberOfLeadingZeros%28long%29&quot; rel=&quot;nofollow&quot;&gt;Long.numberOfLeadingZeros&lt;/a&gt;, where the 64-bit &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; may use appropriate machine instructions.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;java5&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt; * @author Michael Hoffmann, Gerd Isenberg&amp;lt;br/&amp;gt; * @param  long occ occupancy of the board&amp;lt;br/&amp;gt; * @param  int sq  0..63&amp;lt;br/&amp;gt; * @param  int line  0..3 for rank, file, dia, antidia&amp;lt;br/&amp;gt; * @return line attacks from that square&amp;lt;br/&amp;gt; */&amp;lt;br/&amp;gt;long lineAttacks(long occ, int sq, int line) {&amp;lt;br/&amp;gt;   long lower = longMasks[sq][line][0] &amp;amp;amp; occ;&amp;lt;br/&amp;gt;   long upper = longMasks[sq][line][1] &amp;amp;amp; occ;&amp;lt;br/&amp;gt;   long mMs1b = 0x8000000000000000 &amp;amp;gt;&amp;amp;gt; Long.numberOfLeadingZeros (lower | 1);&amp;lt;br/&amp;gt;   long ls1b  = upper &amp;amp;amp; -upper;&amp;lt;br/&amp;gt;   long odiff = 2*ls1b + mMs1b;&amp;lt;br/&amp;gt;   return longMasks[sq][line][2] &amp;amp;amp; odiff;&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;coMULTI&quot;&gt;/*
 * @author Michael Hoffmann, Gerd Isenberg
 * @param  long occ occupancy of the board
 * @param  int sq  0..63
 * @param  int line  0..3 for rank, file, dia, antidia
 * @return line attacks from that square
 */&lt;/span&gt;
&lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; lineAttacks&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;kw3&quot;&gt;int&lt;/span&gt; line&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; lower = longMasks&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;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;sy0&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; upper = longMasks&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;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;sy0&quot;&gt;&amp;amp;&lt;/span&gt; occ&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; mMs1b = 0x8000000000000000 &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &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;numberOfLeadingZeros&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;lower | &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;sy0&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; ls1b  = upper &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt; -upper&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; odiff = &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;ls1b + mMs1b&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw2&quot;&gt;return&lt;/span&gt; longMasks&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;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt; odiff&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:2 --&gt;One may also use unsigned shift right, to subtract the MS1B.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:3:
&amp;lt;pre class=&amp;quot;java5&amp;quot;&amp;gt;   long ms1b  = 0x8000000000000000 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; Long.numberOfLeadingZeros (lower | 1);&amp;lt;br/&amp;gt;   long ls1b  = upper &amp;amp;amp; -upper;&amp;lt;br/&amp;gt;   long odiff = 2*ls1b - ms1b;&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;kw3&quot;&gt;long&lt;/span&gt; ms1b  = 0x8000000000000000 &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &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;numberOfLeadingZeros&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;lower | &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;sy0&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; ls1b  = upper &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt; -upper&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw3&quot;&gt;long&lt;/span&gt; odiff = &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;ls1b - ms1b&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:3 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:21:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc4&quot;&gt;&lt;a name=&quot;How it works&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:21 --&gt;How it works&lt;/h1&gt;
 Following bitboard diagrams demonstrate how it works with &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations#LittleEndianRankFileMapping&quot;&gt;Little-Endian Rank-File Mapping&lt;/a&gt;, file attacks rook on d4 (27):&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;occupancy              fileMaskEx(d4)           occupancy d-file&amp;lt;br/&amp;gt; . . . 1 . 1 . .       . . . 1 . . . .          . . . 1 . . . .&amp;lt;br/&amp;gt; 1 . 1 . . 1 1 .       . . . 1 . . . .          . . . . . . . .&amp;lt;br/&amp;gt; . 1 . 1 . . . 1       . . . 1 . . . .          . . . 1 . . . .&amp;lt;br/&amp;gt; . . . . . 1 . .       . . . 1 . . . .          . . . . . . . .&amp;lt;br/&amp;gt; . 1 . 1 . . . .   &amp;amp;amp;   . . . . . . . .    =     . . . R . . . .&amp;lt;br/&amp;gt; . . . . . . 1 .       . . . 1 . . . .          . . . . . . . .&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;______________________________________&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;occupancy upper        occupancy lower&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; . . . . . . . .       . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .       . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .       . . . 1 . . . .&amp;lt;br/&amp;gt; . . . . . . . .       . . . 1 . . . .&amp;lt;br/&amp;gt;                   |&amp;lt;br/&amp;gt;LS1B upper         v   lower | 1&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; . . . . . . . .       . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .       . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .       . . . 1 . . . .&amp;lt;br/&amp;gt; . . . . . . . .       1 . . 1 . . . .&amp;lt;br/&amp;gt;______________________________________&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;2* LS1B upper      -   MS1B (lower | 1)   =    2*LS1Bhigh-MS1Blow&amp;lt;br/&amp;gt; . . . . . . . .       . . . . . . . .         . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .       . . . . . . . .         . . . . . . . .&amp;lt;br/&amp;gt; . . . . 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&amp;lt;br/&amp;gt; . . . . . . . .       . . . . . . . .         . . . . . . . .&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;2*LS1Bhigh-MS1Blow     fileMaskEx         =    fileAttacks&amp;lt;br/&amp;gt; . . . . . . . .       . . . 1 . . . .         . . . . . . . .&amp;lt;br/&amp;gt; . . . . . . . .       . . . 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       . . . 1 . . . .         . . . 1 . . . .&amp;lt;br/&amp;gt; 1 1 1 1 1 1 1 1   &amp;amp;amp;   . . . . . . . .    =    . . . . . . . .&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 . . . .&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;occupancy              fileMaskEx&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;d4&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;           occupancy d&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;file
 . . . &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;sy3&quot;&gt;&amp;amp;&lt;/span&gt;   . . . . . . . .    &lt;span class=&quot;sy1&quot;&gt;=&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;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; . . . .
______________________________________
&amp;nbsp;
occupancy upper        occupancy lower
 . . . &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;|&lt;/span&gt;
LS1B upper         v   lower &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;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; . . . .
______________________________________
&amp;nbsp;
&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt; LS1B upper      &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;   MS1B &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;lower &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;sy1&quot;&gt;=&lt;/span&gt;    &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;LS1Bhigh&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;MS1Blow
 . . . . . . . .       . . . . . . . .         . . . . . . . .
 . . . . . . . .       . . . . . . . .         . . . . . . . .
 . . . . &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;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;
 . . . . . . . .       . . . . . . . .         . . . . . . . .
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;LS1Bhigh&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;MS1Blow     fileMaskEx         &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;    fileAttacks
 . . . . . . . .       . . . &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;sy3&quot;&gt;&amp;amp;&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;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:23:&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:23 --&gt;See also&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/SBAMG&quot;&gt;SBAMG&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:25:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc6&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:25 --&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=29087&quot; rel=&quot;nofollow&quot;&gt;DIRECT BITBOARD MOVEGENERATION&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Michael%20Hoffmann&quot;&gt;Michael Hoffmann&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, July 23, 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.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;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:134 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:27:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:27 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:06:&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;Obstruction Difference&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;Obstruction Difference&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-Obstruction_Difference includeBody-Obstruction%20Difference 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/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/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/Michael+Hoffmann&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Michael Hoffmann&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 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/Nemo&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Nemo&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 24, 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/Obstruction+Difference&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Obstruction Difference&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/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/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/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/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;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:06 --&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>
    <item>
      <title>On an empty Board</title>
      <link>https://chessprogramming.wikispaces.com/On+an+empty+Board</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/On+an+empty+Board</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/On+an+empty+Board</comments>
      <pubDate>Tue, 18 Mar 2014 21:05:25 GMT</pubDate>
      <description>&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;#Ray Attacks&quot;&gt;Ray Attacks&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;#Ray Attacks-Rays by Line&quot;&gt;Rays by Line&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;#Ray Attacks-Positive Rays&quot;&gt;Positive Rays&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:57 --&gt;&lt;!-- ws:start:WikiTextTocRule:58: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Positive Rays-By Lookup&quot;&gt;By Lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:58 --&gt;&lt;!-- ws:start:WikiTextTocRule:59: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Positive Rays-Initialization&quot;&gt;Initialization&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:59 --&gt;&lt;!-- ws:start:WikiTextTocRule:60: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Positive Rays-By Calculation&quot;&gt;By Calculation&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;#Ray Attacks-Negative Rays&quot;&gt;Negative Rays&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:61 --&gt;&lt;!-- ws:start:WikiTextTocRule:62: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Negative Rays-By Lookup&quot;&gt;By Lookup&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:62 --&gt;&lt;!-- ws:start:WikiTextTocRule:63: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Negative Rays-Initialization&quot;&gt;Initialization&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:63 --&gt;&lt;!-- ws:start:WikiTextTocRule:64: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Ray Attacks-Negative Rays-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;#Line Attacks&quot;&gt;Line 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: 3em;&quot;&gt;&lt;a href=&quot;#Line Attacks--By Lookup&quot;&gt;By Lookup&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;#Line Attacks--By Calculation&quot;&gt;By Calculation&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:67 --&gt;&lt;!-- ws:start:WikiTextTocRule:68: --&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:68 --&gt;&lt;!-- ws:start:WikiTextTocRule:69: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#Piece Attacks--By Lookup&quot;&gt;By Lookup&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;#Piece Attacks--By Calculation&quot;&gt;By Calculation&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;#See also&quot;&gt;See also&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;#What links here?&quot;&gt;What links here?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:72 --&gt;&lt;!-- ws:start:WikiTextTocRule:73: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:73 --&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; * On an empty Board&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Single sliding piece attacks&lt;/strong&gt; on the &lt;strong&gt;otherwise empty board&lt;/strong&gt; or their disjoint subsets on lines or &lt;a class=&quot;wiki_link&quot; href=&quot;/Rays&quot;&gt;rays&lt;/a&gt; are that simple than none sliding pieces. We simply use pre-calculated tables for each &lt;a class=&quot;wiki_link&quot; href=&quot;/Pieces&quot;&gt;piece-type&lt;/a&gt;, line or ray, indexed by square-index. To initialize those tables, one may use a &lt;a class=&quot;wiki_link&quot; href=&quot;/Kogge-Stone%20Algorithm#Fillonanemptyboard&quot;&gt;fill approach&lt;/a&gt; with single populated from-sets, if availably anyway since used elsewhere. While the proposed line-routines here are quite small and cheap, incremental update during an initialization loop has some merits.&lt;br /&gt;
&lt;br /&gt;
The various ray-,line- and piece sets are foundation of further attack calculation considering blocking pieces, for instance to mask the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; of relevant rays. Of course the piece attacks are union-sets of the disjoint line attacks, while the line attacks are unions of the disjoint ray attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:74:&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@@RayAttacks&amp;quot; title=&amp;quot;Anchor: RayAttacks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;RayAttacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:74 --&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;Ray Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:18 --&gt;Ray Attacks&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextCodeRule:0:
&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:0 --&gt;&lt;!-- ws:start:WikiTextAnchorRule:75:&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@@SplitRaysFromLine&amp;quot; title=&amp;quot;Anchor: SplitRaysFromLine&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;SplitRaysFromLine&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:75 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:20:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Ray Attacks-Rays by Line&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:20 --&gt;Rays by Line&lt;/h2&gt;
 Ray-Attacks may be conducted from Line-Attacks by intersection with &amp;quot;positive&amp;quot; and &amp;quot;negative&amp;quot; squares:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt; positiveRay[sq] = lineAttacks[sq] &amp;amp;amp; (0 - 2*singleBit[sq]);&amp;lt;br/&amp;gt; negativeRay[sq] = lineAttacks[sq] &amp;amp;amp; (singleBit[sq] - 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; positiveRay&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; lineAttacks&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; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&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;sy2&quot;&gt;*&lt;/span&gt;singleBit&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;sy4&quot;&gt;;&lt;/span&gt;
 negativeRay&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; lineAttacks&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; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;singleBit&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;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;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;or with shifts instead of lookups&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt; positiveRay[sq] = lineAttacks[sq] &amp;amp;amp; (C64(-2) &amp;amp;lt;&amp;amp;lt; sq);&amp;lt;br/&amp;gt; negativeRay[sq] = lineAttacks[sq] &amp;amp;amp; ((C64(1) &amp;amp;lt;&amp;amp;lt; sq) - 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; positiveRay&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; lineAttacks&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; &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;sy2&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;sy1&quot;&gt;&amp;lt;&amp;lt;&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;
 negativeRay&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; lineAttacks&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; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&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; sq&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;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:2 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextAnchorRule:76:&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@@PositiveRays&amp;quot; title=&amp;quot;Anchor: PositiveRays&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;PositiveRays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:76 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:22:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Ray Attacks-Positive Rays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:22 --&gt;Positive Rays&lt;/h2&gt;
 &lt;em&gt;Remember &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;!-- ws:start:WikiTextHeadingRule:24:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Ray Attacks-Positive Rays-By Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:24 --&gt;By Lookup&lt;/h3&gt;
 &lt;!-- ws:start:WikiTextCodeRule:3:
&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:3 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:26:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Ray Attacks-Positive Rays-Initialization&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:26 --&gt;Initialization&lt;/h3&gt;
 North attacks are simple to initialize inside a loop, starting from a1, shifting left:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:4:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 nort = C64(0x0101010101010100);&amp;lt;br/&amp;gt;for (int sq=0; sq &amp;amp;lt; 64; sq++, nort &amp;amp;lt;&amp;amp;lt;= 1)&amp;lt;br/&amp;gt;   rayAttacks[sq][Nort] = nort;&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 nort &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;0x0101010101010100&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;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;, nort &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;
   rayAttacks&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;Nort&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; nort&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:4 --&gt;Similar, but tad trickier for &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;, due to the wraps. For instance the north-east &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;direction&lt;/a&gt;:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:5:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 noea = C64(0x8040201008040200);&amp;lt;br/&amp;gt;for (int f=0; f &amp;amp;lt; 8; f++, noea = eastOne(noea) {&amp;lt;br/&amp;gt;   U64 ne = noea;&amp;lt;br/&amp;gt;   for (int r8 = 0; r8 &amp;amp;lt; 8*8; r8 += 8, ne &amp;amp;lt;&amp;amp;lt;= 8)&amp;lt;br/&amp;gt;      rayAttacks[r8+f][NoEa] = ne;&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 noea &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;0x8040201008040200&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;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; f&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; f &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; f&lt;span class=&quot;sy2&quot;&gt;++&lt;/span&gt;, noea &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; eastOne&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;noea&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 ne &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; noea&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; r8 &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; r8 &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;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; r8 &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;, ne &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;
      rayAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;r8&lt;span class=&quot;sy2&quot;&gt;+&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;NoEa&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; ne&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;!-- ws:start:WikiTextHeadingRule:28:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Ray Attacks-Positive Rays-By Calculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:28 --&gt;By Calculation&lt;/h3&gt;
 Orthogonal positive rays are quite cheap to calculate on the fly. For diagonal rays split the lines as &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#SplitRaysFromLine&quot;&gt;mentioned&lt;/a&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:6:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 eastMaskEx(int sq) {&amp;lt;br/&amp;gt;   const U64 one = 1;&amp;lt;br/&amp;gt;   return 2*( (one &amp;amp;lt;&amp;amp;lt; (sq|7)) - (one &amp;amp;lt;&amp;amp;lt; sq) );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 nortMaskEx(int sq) {&amp;lt;br/&amp;gt;   return C64(0x0101010101010100) &amp;amp;lt;&amp;amp;lt; 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 eastMaskEx&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;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 one &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;return&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;br0&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;one &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;|&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;sy2&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;one &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; sq&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;
&amp;nbsp;
U64 nortMaskEx&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;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; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0101010101010100&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;
&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: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@@NegativeRays&amp;quot; title=&amp;quot;Anchor: NegativeRays&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;NegativeRays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:77 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:30:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc6&quot;&gt;&lt;a name=&quot;Ray Attacks-Negative Rays&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:30 --&gt;Negative Rays&lt;/h2&gt;
 Remember &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations&quot;&gt;Square Mapping Considerations&lt;/a&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:32:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Ray Attacks-Negative Rays-By Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:32 --&gt;By Lookup&lt;/h3&gt;
 &lt;!-- ws:start:WikiTextCodeRule:7:
&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:7 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:34:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc8&quot;&gt;&lt;a name=&quot;Ray Attacks-Negative Rays-Initialization&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:34 --&gt;Initialization&lt;/h3&gt;
 South attacks are simple to initialize inside a loop, starting from h8, shifting right:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:8:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 sout = C64(0x0080808080808080);&amp;lt;br/&amp;gt;for (int sq=63; sq &amp;amp;gt;= 0; sq&amp;amp;#45;-, sout &amp;amp;gt;&amp;amp;gt;= 1)&amp;lt;br/&amp;gt;   rayAttacks[sq][Sout] = sout;&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 sout &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;0x0080808080808080&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;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;63&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; sq &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; sq&lt;span class=&quot;sy2&quot;&gt;--&lt;/span&gt;, sout &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;
   rayAttacks&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;Sout&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; sout&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:8 --&gt;Similar, but tad trickier for &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;, due to the wraps.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:36:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc9&quot;&gt;&lt;a name=&quot;Ray Attacks-Negative Rays-By Calculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:36 --&gt;By Calculation&lt;/h3&gt;
 Orthogonal negative rays are quite cheap to calculate on the fly. For diagonal rays split the lines as &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#SplitRaysFromLine&quot;&gt;mentioned&lt;/a&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:9:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 westMaskEx(int sq) {&amp;lt;br/&amp;gt;   const U64 one = 1;&amp;lt;br/&amp;gt;   return (one &amp;amp;lt;&amp;amp;lt; sq) - (one &amp;amp;lt;&amp;amp;lt; (sq&amp;amp;amp;56));&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 soutMaskEx(int sq) {&amp;lt;br/&amp;gt;   return C64(0x0080808080808080) &amp;amp;gt;&amp;amp;gt; (sq ^ 63);&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 westMaskEx&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;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 one &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;return&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;one &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; sq&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;br0&quot;&gt;&amp;#40;&lt;/span&gt;one &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;56&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 soutMaskEx&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;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; C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0x0080808080808080&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;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;63&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:9 --&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@@LineAttacks&amp;quot; title=&amp;quot;Anchor: LineAttacks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;LineAttacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:78 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:38:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc10&quot;&gt;&lt;a name=&quot;Line Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:38 --&gt;Line Attacks&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextCodeRule:10:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt; RankAttacks[sq]         = EastAttacks[sq] | WestAttacks[sq];&amp;lt;br/&amp;gt; FileAttacks[sq]         = NortAttacks[sq] | SoutAttacks[sq];&amp;lt;br/&amp;gt; DiagonalAttacks[sq]     = NoEaAttacks[sq] | SoWeAttacks[sq];&amp;lt;br/&amp;gt; AntiDiagonalAttacks[sq] = NoWeAttacks[sq] | SoEaAttacks[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; RankAttacks&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; EastAttacks&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; WestAttacks&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;
 FileAttacks&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; NortAttacks&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; SoutAttacks&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;
 DiagonalAttacks&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; NoEaAttacks&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; SoWeAttacks&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;
 AntiDiagonalAttacks&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; NoWeAttacks&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; SoEaAttacks&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;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:10 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:40:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc11&quot;&gt;&lt;a name=&quot;Line Attacks--By Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:40 --&gt;By Lookup&lt;/h3&gt;
 &lt;!-- ws:start:WikiTextCodeRule:11:
&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:11 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:42:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc12&quot;&gt;&lt;a name=&quot;Line Attacks--By Calculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:42 --&gt;By Calculation&lt;/h3&gt;
 To calculate them on the fly, including...&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:12:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 rankMask(int sq) {return  C64(0xff) &amp;amp;lt;&amp;amp;lt; (sq &amp;amp;amp; 56);}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 fileMask(int sq) {return C64(0x0101010101010101) &amp;amp;lt;&amp;amp;lt; (sq &amp;amp;amp; 7);}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 diagonalMask(int sq) {&amp;lt;br/&amp;gt;   const U64 maindia = C64(0x8040201008040201);&amp;lt;br/&amp;gt;   int diag =8*(sq &amp;amp;amp; 7) - (sq &amp;amp;amp; 56);&amp;lt;br/&amp;gt;   int nort = -diag &amp;amp;amp; ( diag &amp;amp;gt;&amp;amp;gt; 31);&amp;lt;br/&amp;gt;   int sout =  diag &amp;amp;amp; (-diag &amp;amp;gt;&amp;amp;gt; 31);&amp;lt;br/&amp;gt;   return (maindia &amp;amp;gt;&amp;amp;gt; sout) &amp;amp;lt;&amp;amp;lt; nort;&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 antiDiagMask(int sq) {&amp;lt;br/&amp;gt;   const U64 maindia = C64(0x0102040810204080);&amp;lt;br/&amp;gt;   int diag =56- 8*(sq&amp;amp;amp;7) - (sq&amp;amp;amp;56);&amp;lt;br/&amp;gt;   int nort = -diag &amp;amp;amp; ( diag &amp;amp;gt;&amp;amp;gt; 31);&amp;lt;br/&amp;gt;   int sout =  diag &amp;amp;amp; (-diag &amp;amp;gt;&amp;amp;gt; 31);&amp;lt;br/&amp;gt;   return (maindia &amp;amp;gt;&amp;amp;gt; sout) &amp;amp;lt;&amp;amp;lt; nort;&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 rankMask&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;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;  C64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu12&quot;&gt;0xff&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;sy3&quot;&gt;&amp;amp;&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;sy4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 fileMask&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;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; 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;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;
&amp;nbsp;
U64 diagonalMask&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;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 maindia &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;int&lt;/span&gt; diag &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;&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;sy2&quot;&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;56&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;int&lt;/span&gt; nort &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;diag &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; diag &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;31&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;int&lt;/span&gt; sout &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  diag &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;sy2&quot;&gt;-&lt;/span&gt;diag &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;31&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;maindia &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; sout&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; nort&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 antiDiagMask&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;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 maindia &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;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; diag &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;56&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;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;sy2&quot;&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;56&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;int&lt;/span&gt; nort &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;diag &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; diag &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;31&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;int&lt;/span&gt; sout &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt;  diag &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;sy2&quot;&gt;-&lt;/span&gt;diag &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;31&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;maindia &lt;span class=&quot;sy1&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; sout&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; nort&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;... or excluding the square bit:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:13:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 rankMaskEx    (int sq) {return (C64(1) &amp;amp;lt;&amp;amp;lt; sq) ^ rankMask(sq);}&amp;lt;br/&amp;gt;U64 fileMaskEx    (int sq) {return (C64(1) &amp;amp;lt;&amp;amp;lt; sq) ^ fileMask(sq);}&amp;lt;br/&amp;gt;U64 diagonalMaskEx(int sq) {return (C64(1) &amp;amp;lt;&amp;amp;lt; sq) ^ diagonalMask(sq);}&amp;lt;br/&amp;gt;U64 antiDiagMaskEx(int sq) {return (C64(1) &amp;amp;lt;&amp;amp;lt; sq) ^ antiDiagMask(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 rankMaskEx    &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;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;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;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; rankMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 fileMaskEx    &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;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;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;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; fileMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 diagonalMaskEx&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;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;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;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; diagonalMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 antiDiagMaskEx&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;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;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;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; antiDiagMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:13 --&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@@PieceAttacks&amp;quot; title=&amp;quot;Anchor: PieceAttacks&amp;quot;/&amp;gt; --&gt;&lt;a name=&quot;PieceAttacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextAnchorRule:79 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:44:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc13&quot;&gt;&lt;a name=&quot;Piece Attacks&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:44 --&gt;Piece Attacks&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextCodeRule:14:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;RookAttacks[sq]   = RankAttacks[sq]     | FileAttacks[sq];&amp;lt;br/&amp;gt;BishopAttacks[sq] = DiagonalAttacks[sq] | AntiDiagonalAttacks[sq];&amp;lt;br/&amp;gt;QueenAttacks[sq]  = RookAttacks[sq] | BishopAttacks[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;RookAttacks&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; RankAttacks&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; FileAttacks&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;
BishopAttacks&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; DiagonalAttacks&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; AntiDiagonalAttacks&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;
QueenAttacks&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; RookAttacks&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; BishopAttacks&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;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:14 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:46:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc14&quot;&gt;&lt;a name=&quot;Piece Attacks--By Lookup&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:46 --&gt;By Lookup&lt;/h3&gt;
 &lt;!-- ws:start:WikiTextCodeRule:15:
&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:15 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:48:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc15&quot;&gt;&lt;a name=&quot;Piece Attacks--By Calculation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:48 --&gt;By Calculation&lt;/h3&gt;
 &lt;!-- ws:start:WikiTextCodeRule:16:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;U64 rookMask    (int sq) {return rankMask(sq)     | fileMask(sq);}&amp;lt;br/&amp;gt;U64 bishopMask  (int sq) {return diagonalMask(sq) | antiDiagMask(sq);}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookMaskEx  (int sq) {return rankMask(sq)     ^ fileMask(sq);}&amp;lt;br/&amp;gt;U64 bishopMaskEx(int sq) {return diagonalMask(sq) ^ antiDiagMask(sq);}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 queenMask   (int sq) {return rookMask(sq)     | bishopMask(sq);}&amp;lt;br/&amp;gt;U64 queenMaskEx (int sq) {return rookMask(sq)     ^ bishopMask(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 rookMask    &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;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; rankMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;     &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; fileMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 bishopMask  &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;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; diagonalMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; antiDiagMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
U64 rookMaskEx  &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;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; rankMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;     &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; fileMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 bishopMaskEx&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;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; diagonalMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; antiDiagMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
U64 queenMask   &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;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; rookMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;     &lt;span class=&quot;sy3&quot;&gt;|&lt;/span&gt; bishopMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;
U64 queenMaskEx &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;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; rookMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;     &lt;span class=&quot;sy3&quot;&gt;^&lt;/span&gt; bishopMask&lt;span class=&quot;br0&quot;&gt;&amp;#40;&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;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:16 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:50:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc16&quot;&gt;&lt;a name=&quot;See also&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:50 --&gt;See also&lt;/h1&gt;
 &lt;ul&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;/Kogge-Stone%20Algorithm#Fillonanemptyboard&quot;&gt;Fill on an empty Board&lt;/a&gt; with &lt;a class=&quot;wiki_link&quot; href=&quot;/Kogge-Stone%20Algorithm&quot;&gt;Kogge-Stone Algorithm&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:52:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc17&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:017:&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;On an empty Board&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;On an empty Board&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-On_an_empty_Board includeBody-On%20an%20empty%20Board 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/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/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/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/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/Direction&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Direction&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/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/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/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/Joker+IT&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Joker IT&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/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/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/Obstruction+Difference&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Obstruction Difference&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/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/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/Praetorian&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Praetorian&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 21, 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/Rays&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rays&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 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/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/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/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/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/Thor%27s+Hammer&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Thor&amp;#039;s Hammer&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 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;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:017 --&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>Reverse Bitboards</title>
      <link>https://chessprogramming.wikispaces.com/Reverse+Bitboards</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Reverse+Bitboards</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Reverse+Bitboards</comments>
      <pubDate>Sat, 29 Aug 2015 20:24:16 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:25:&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:25 --&gt;&lt;!-- ws:start:WikiTextTocRule:26: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#The Hyperbola Project - New Technologies&quot;&gt;The Hyperbola Project - New Technologies&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:26 --&gt;&lt;!-- ws:start:WikiTextTocRule:27: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#The Hyperbola Project - New Technologies-Bitboard Design and Sliding Piece Attack Generation&quot;&gt;Bitboard Design and Sliding Piece Attack Generation&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:27 --&gt;&lt;!-- ws:start:WikiTextTocRule:28: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#The Hyperbola Project - New Technologies-Bitboard Design and Sliding Piece Attack Generation-Now, how do reverse bitboards help generate sliding piece attacks?&quot;&gt;Now, how do reverse bitboards help generate sliding piece attacks?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:28 --&gt;&lt;!-- ws:start:WikiTextTocRule:29: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#The Hyperbola Project - New Technologies-What benefit comes from having a reversed bitboard in place of rotated bitboards?&quot;&gt;What benefit comes from having a reversed bitboard in place of rotated bitboards?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:29 --&gt;&lt;!-- ws:start:WikiTextTocRule:30: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#The Hyperbola Project - New Technologies-What benefit comes from having a reversed bitboard in place of rotated bitboards?-Where do the reverse bitboards come in?&quot;&gt;Where do the reverse bitboards come in?&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:30 --&gt;&lt;!-- ws:start:WikiTextTocRule:31: --&gt;&lt;div style=&quot;margin-left: 3em;&quot;&gt;&lt;a href=&quot;#The Hyperbola Project - New Technologies-What benefit comes from having a reversed bitboard in place of rotated bitboards?-How can the reverse bitboards be converted back to normal?&quot;&gt;How can the reverse bitboards be converted back to normal?&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;#See also&quot;&gt;See also&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;#Forum Discussions&quot;&gt;Forum Discussions&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;#References&quot;&gt;References&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:34 --&gt;&lt;!-- ws:start:WikiTextTocRule:35: --&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:35 --&gt;&lt;!-- ws:start:WikiTextTocRule:36: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:36 --&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; * Reverse Bitboards&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The idea of &lt;strong&gt;reverse bitboards&lt;/strong&gt; was proposed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Ryan%20Mack&quot;&gt;Ryan Mack&lt;/a&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/Timeline#2000&quot;&gt;2000&lt;/a&gt; while introducing his &lt;em&gt;Hyperbola Project&lt;/em&gt;. It was based on the &lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;x XOR (x - 2)&lt;/span&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Bit-Twiddling&quot;&gt;bit-twiddling&lt;/a&gt; trick to generate attacks in &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#PositiveRays&quot;&gt;positive&lt;/a&gt;  &lt;a class=&quot;wiki_link&quot; href=&quot;/Rays#RayDirections&quot;&gt;ray-directions&lt;/a&gt;  - and beside the usual &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; bitboard, to maintain a &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#Rotationby180degrees&quot;&gt;reversed or 180 degree rotated&lt;/a&gt; occupied bitboard to apply the trick for &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#NegativeRays&quot;&gt;negative&lt;/a&gt; ray-directions as well. It was intended to &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboard%20Serialization&quot;&gt;traverse&lt;/a&gt; reversed sets for move-generation, while re-reversion took place in the scalar, square centric world by &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#ExclusiveOr&quot;&gt;xor&lt;/a&gt; 63 after &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan&quot;&gt;bitscan&lt;/a&gt;. Alternatively, for other purposes a &lt;a class=&quot;wiki_link&quot; href=&quot;/MMX&quot;&gt;MMX&lt;/a&gt;-bitreversal routine was mentioned.&lt;br /&gt;
&lt;br /&gt;
Ryan made an interesting and thought-provoking contribution. He introduced the predecessor of 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;. With hindsight, the idea of keeping two reversed sets seemed not that successful as the author initially thought. However, &lt;a class=&quot;wiki_link&quot; href=&quot;/Hyperbola%20Quintessence&quot;&gt;Hyperbola Quintessence&lt;/a&gt;, where fast vertical byteswap flipping is used on the fly to reverse diagonals and files, is somehow the resurrection of Ryan&#039;s ideas, vastly improved by &lt;a class=&quot;wiki_link&quot; href=&quot;/Aleks%20Peshkov&quot;&gt;Aleks Peshkov&#039;s&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#ExclusiveOr&quot;&gt;xor&lt;/a&gt; wizardry. Aleks&#039; &lt;a class=&quot;wiki_link&quot; href=&quot;/SSSE3#Peshkov&quot;&gt;SSSE3 approach&lt;/a&gt; even relies on keeping reverse occupancies to further use only nine SIMD operations to generate bishop attacks. &lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:5:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;The Hyperbola Project - New Technologies&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:5 --&gt;The Hyperbola Project - New Technologies&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextRefRule:3:&amp;amp;lt;ref&amp;amp;gt;Copy of the no longer available site: &amp;lt;em&amp;gt;The Hyperbola Project - New Technologies&amp;lt;/em&amp;gt;, Copyright © 2000 &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Ryan%20Mack&amp;quot;&amp;gt;Ryan Mack&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:3 --&gt;&lt;br /&gt;
What follows here is merely a glimpse at the new advances in computer chess that the &lt;strong&gt;Hyperbola Project&lt;/strong&gt; will include. The revolutionary design will generate enormous speed improvements, optimized specifically for the Pentium III processor&#039;s SIMD and &lt;a class=&quot;wiki_link&quot; href=&quot;/MMX&quot;&gt;MMX&lt;/a&gt; enhancements. The downside is that the initial releases of &lt;strong&gt;Hyperbola&lt;/strong&gt; will require a P-III system to operate. As the core engine is being written in &lt;a class=&quot;wiki_link&quot; href=&quot;/Assembly&quot;&gt;assembly&lt;/a&gt; code, it is very difficult to optimize for more than one chip at a time.&lt;br /&gt;
&lt;br /&gt;
The past two years have yielded a serious look at the way computer chess programs operate today. The most significant problem with PC-oriented (non 64-bit) programs is the lack of speed associated with doing 64-bit arithmetic in a 32-bit environment.&lt;br /&gt;
&lt;br /&gt;
MMX technology introduced some 64-bit operations to the Pentium family of microprocessors, which do increase performance noticeably, but not optimally. When using MMX, many operations still have to be completed in the old 32-bit system, which degrades the performance gain when the data has to be exchanged back and forth between the regular registers and the MMX registers.&lt;br /&gt;
&lt;br /&gt;
The improvements shown below also address another significant bottleneck in chess programming: memory speeds. Despite the fact that &lt;strong&gt;Hyperbola&lt;/strong&gt; is designed for systems with extremely fast memory (RDRAM), memory is still a bottleneck for some calculations, which require a very tight dependency chain. Since a memory read from the fastest (L1) cache has a latency of three clock cycles, the processor remains stalled in a tight dependency chain such as this, where no other calculations can be completed while the processor waits for the memory read to complete.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:7:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc1&quot;&gt;&lt;a name=&quot;The Hyperbola Project - New Technologies-Bitboard Design and Sliding Piece Attack Generation&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:7 --&gt;Bitboard Design and Sliding Piece Attack Generation&lt;/h2&gt;
 Generating the attacks for &lt;a class=&quot;wiki_link&quot; href=&quot;/Sliding%20Pieces&quot;&gt;sliding pieces&lt;/a&gt; proved to be a significant bottleneck in the early trials. For example, before generating legal moves for a position, the program must determine whether the king is in check. To do this, the program has to find the attacks of every type of piece from the king&#039;s square and check if an appropriate enemy piece resides there. Since this cannot be done while analyzing other moves, this is a huge slowdown under the current technology, which uses four sets of bitboards (three rotated) and several memory lookups to determine the correct attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Hyperbola&#039;s&lt;/strong&gt; design is quite different in this respect from other programs. &lt;strong&gt;Hyperbola&lt;/strong&gt; introduces the concept of a reversed bitboard in place of three rotated bitboards, and TOTALLY eliminates the lookup tables in favor of simple calculations, all of which can be done in the 64-bit &lt;a class=&quot;wiki_link&quot; href=&quot;/MMX&quot;&gt;MMX&lt;/a&gt; registers.&lt;br /&gt;
&lt;br /&gt;
With the research still in progress on this topic, it is not clear as to exactly how much performance can be enhanced by this new technique, but it is clear that performance will be improved very significantly, especially with MMX hardware. Processors that are completely 64-bit, such as the &lt;a class=&quot;wiki_link&quot; href=&quot;/Intel&quot;&gt;Intel&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Itanium&quot;&gt;Itanium&lt;/a&gt;, will also be very much helped by this technique.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:9:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc2&quot;&gt;&lt;a name=&quot;The Hyperbola Project - New Technologies-Bitboard Design and Sliding Piece Attack Generation-Now, how do reverse bitboards help generate sliding piece attacks?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:9 --&gt;Now, how do reverse bitboards help generate sliding piece attacks?&lt;/h3&gt;
 First, let&#039;s cover what has to be maintained by the program. There is the normal set of bitboards, all generated in the normal direction. And there is a single &lt;strong&gt;reverse bitboard&lt;/strong&gt;, which roughly takes the place of the three rotated bitboards in most programs today. The &lt;strong&gt;reverse bitboard&lt;/strong&gt; contains the same information as the forward bitboard which denotes all occupied squares, but it is in reverse, that is, bit x in the forward bitboard corresponds to bit 63-x in the &lt;strong&gt;reverse bitboard&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:11:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;The Hyperbola Project - New Technologies-What benefit comes from having a reversed bitboard in place of rotated bitboards?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:11 --&gt;What benefit comes from having a reversed bitboard in place of rotated bitboards?&lt;/h2&gt;
 &lt;ul&gt;&lt;li&gt;&lt;strong&gt;Maintenance&lt;/strong&gt;&lt;br /&gt;
A single reversed bitboard is easier to maintain than one rotated bitboard, let alone three. This is because a table lookup is required to convert a bit from the forward format to most rotated formats. With the &lt;strong&gt;reverse bitboard&lt;/strong&gt;, simply subtract the bit number from 63. Considering that only one of these bitboards has to be maintained instead of three, this issue is important.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;The Calculations&lt;/strong&gt;&lt;br /&gt;
When taking account of memory latencies, calculating the piece attacks using the forward and &lt;strong&gt;reverse bitboards&lt;/strong&gt; can be done significantly faster due to total independence on lookup tables and complex calculations. There are a few slight snags with the diagonal calculations, but they are minor.&lt;br /&gt;
The benefit of having the forward and &lt;strong&gt;reverse bitboards&lt;/strong&gt; really shines in light of a very important bit manipulation trick: x XOR (x - 2) contains bits set to one, starting from the second bit, and stopping at the first bit of x that is one, but including it.&lt;br /&gt;
Now, if x is the bitboard of all occupied squares, and it is shifted to the right so that the square for which attacks are being calculated becomes bit zero, then XORing &lt;strong&gt;x with (x - 2)&lt;/strong&gt; gives a mask of all squares attacked by the piece on the desired square, once the result is shifted back to the left. It does not include the piece that is making the attack, but it does include the first occupied square. This is exactly the result the lookup tables return!&lt;br /&gt;
The snags come from wraparound - that is, when the mask goes to the end of the file, rank, or diagonal... and keeps going where it shouldn&#039;t. This can be easily fixed in rank/file attacks by masking only the rank or file in question, but it is more complicated on diagonals.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:13:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc4&quot;&gt;&lt;a name=&quot;The Hyperbola Project - New Technologies-What benefit comes from having a reversed bitboard in place of rotated bitboards?-Where do the reverse bitboards come in?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:13 --&gt;Where do the reverse bitboards come in?&lt;/h3&gt;
 The regular bitboard is fine for calculating any attacks that go in the positive direction from the starting square (by masking the rank, file, or diagonal), but the bit-manipulating trick won&#039;t work in the opposite direction. The solution is simple: calculate attacks in the opposite direction using a &lt;strong&gt;reverse bitboard&lt;/strong&gt;, so that on that bitboard they extend in the positive direction and can be calculated as above.&lt;br /&gt;
&lt;br /&gt;
The real problem comes in trying to combine the forward and &lt;strong&gt;reverse bitboards&lt;/strong&gt; - there is just no simple way to un-reverse the bitboard. The technique to do the switch is not terribly cumbersome, but it certainly cannot be used in cases where only one set of attacks is being generated... the delay far outweighs the gain.&lt;br /&gt;
&lt;br /&gt;
However, in &lt;strong&gt;Hyperbola&lt;/strong&gt;, this delay can be managed for an overall gain. Though it is unclear whether these types of calculations will even be used in generating legal moves, due to an incremental move generator, the two bitboards can be scanned separately, converting the returns from the bitscans from reverse to forward (by subtracting from 63) instead of converting the entire bitboard.&lt;br /&gt;
&lt;br /&gt;
A more pertinent issue arises with determining whether the king is in check, which is done before generating any legal moves. Possible ways to go about this include converting the &lt;strong&gt;reverse bitboard&lt;/strong&gt;, which is probably not optimal, maintaining &lt;strong&gt;reverse bitboards&lt;/strong&gt; for the sliding pieces of both colors, which is possible, and testing the individual squares on the bitboards both in forward and in reverse, which is nearly out of the question. In the newer chip architectures any unpredictable branches severely degrade performance, and the technique to avoid that is also slow because it can only be used on 32-bit registers.&lt;br /&gt;
&lt;br /&gt;
The most viable option is to maintain four &lt;strong&gt;reverse bitboards&lt;/strong&gt;, one for the bishops/queens and rooks/queens of each color. Updating them does not degrade performance because only one of the four must be updated for any move, or none at all, in addition to the regular updates.&lt;br /&gt;
&lt;br /&gt;
With the extra &lt;strong&gt;reverse bitboards&lt;/strong&gt;, it is now very easy to determine if the king is in check without any memory tables. First, calculate the attacks from the king&#039;s square for both types of sliding pieces, and simply AND them with the appropriate bitboards of enemy pieces. After that, OR all the results of the comparisons together, and take a single branch.&lt;br /&gt;
&lt;br /&gt;
A possible shortcut exists here still. If the king is not in check, which is almost always the case, and all of the possible sliding piece lines are closed or empty, which is usually true, then the king cannot be checked by a sliding piece. The merit of this idea is questionable, but a more concrete idea is much more helpful. If the previously used sliding piece attack bitboards are saved and it is determined that none of the squares on those bitboards have changed in the bitboard of occupied pieces, then the bitboards can be used again and the calculations skipped. If this shortcut is used, then it might be more economical to reverse the bitboard(s) after calculating them and ignoring the additional &lt;strong&gt;reverse bitboards&lt;/strong&gt;. That depends on the hit rate.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:15:&amp;lt;h3&amp;gt; --&gt;&lt;h3 id=&quot;toc5&quot;&gt;&lt;a name=&quot;The Hyperbola Project - New Technologies-What benefit comes from having a reversed bitboard in place of rotated bitboards?-How can the reverse bitboards be converted back to normal?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:15 --&gt;How can the reverse bitboards be converted back to normal?&lt;/h3&gt;
 The fastest way to do this isn&#039;t a huge deal, but it cannot be run in parallel with other operations and does degrade performance if it is run too often. Suppose we have the lower 16 bits of a bitboard, x: FEDCBA9876543210.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Load the constant, k = 5555555555555555h&lt;/li&gt;&lt;li&gt;x = [(x shl 1) and k] or [(x and k) shr 1] EFCDAB8967452301&lt;/li&gt;&lt;li&gt;Load the constant, k = 3333333333333333h&lt;/li&gt;&lt;li&gt;x = [(x shl 2) and k] or [(x and k) shr 2] CDEF89AB45670123&lt;/li&gt;&lt;li&gt;Load the constant, k = 0F0F0F0F0F0F0F0Fh&lt;/li&gt;&lt;li&gt;x = [(x shl 4) and k] or [(x and k) shr 4] 89ABCDEF01234567&lt;/li&gt;&lt;li&gt;Now, due to the availability of a MMX shift instruction that operates on 16-bit words, the bytes can now be switched more easily&lt;/li&gt;&lt;li&gt;x = (x shlw 8) or (x shrw 8) 0123456789ABCDEF&lt;/li&gt;&lt;li&gt;And finally, the pshufw on the P-III reorganizes the words in a single instruction&lt;/li&gt;&lt;li&gt;x = x pshufw 00011011b&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;
Since all of this arithmetic can be done in the MMX registers, it runs very much in parallel and can complete in a reasonable time frame on the P-III. If this algorithm were to be redesigned for P-II or PMMX architectures (without the pshufw) it would be a little slower since two more steps need to be completed. Trying to do this without 64-bit support would be extremely slow due to the extended-precision operands, despite that most of it could be done in parallel. (This algorithm is also in parallel, so it would probably take over twice as long.)&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Copyright © 2000 Ryan Mack&lt;/em&gt;&lt;br /&gt;
&lt;hr /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:17:&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:17 --&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&quot;&gt;Flipping Mirroring and Rotating&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;/Thor%27s%20Hammer#MoveGeneration&quot;&gt;Move Generation in Thor&#039;s Hammer&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Praetorian&quot;&gt;Praetorian&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:19:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc7&quot;&gt;&lt;a name=&quot;Forum Discussions&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:19 --&gt;Forum Discussions&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=177693&quot; rel=&quot;nofollow&quot;&gt;what do think about n xor (n-2) and &#039;reverse bitboards&#039;?!&lt;/a&gt; by Stefan, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, July 01, 2001&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=210339&quot; rel=&quot;nofollow&quot;&gt;Reversed vs. Rotated Bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Sune%20Fischer&quot;&gt;Sune Fischer&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 28, 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=276884&quot; rel=&quot;nofollow&quot;&gt;Reverse Bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Sander%20de%20Zoete&quot;&gt;Sander de Zoete&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 13, 2003&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:21:&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:21 --&gt;References&lt;/h1&gt;
&lt;!-- ws:start:WikiTextReferencesRule:240:&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; Copy of the no longer available site: &lt;em&gt;The Hyperbola Project - New Technologies&lt;/em&gt;, Copyright © 2000 &lt;a class=&quot;wiki_link&quot; href=&quot;/Ryan%20Mack&quot;&gt;Ryan Mack&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:240 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:23:&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:23 --&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;Reverse 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;Reverse 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-Reverse_Bitboards includeBody-Reverse%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/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/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/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/Praetorian&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Praetorian&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 21, 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/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/Sander+de+Zoete&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sander de Zoete&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 2, 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;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/Sune+Fischer&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sune Fischer&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 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/Thor%27s+Hammer&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Thor&amp;#039;s Hammer&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 23, 2013&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>Rotated Bitboards</title>
      <link>https://chessprogramming.wikispaces.com/Rotated+Bitboards</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Rotated+Bitboards</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Rotated+Bitboards</comments>
      <pubDate>Tue, 07 Mar 2017 20:56:09 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; * Rotated 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:193:&amp;lt;a href=&amp;quot;http://www.mcescher.com/Gallery/back-bmp/LW374.jpg&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/Curl-up.jpg/157878357/297x238/Curl-up.jpg&amp;quot; alt=&amp;quot;&amp;quot; title=&amp;quot;&amp;quot; style=&amp;quot;height: 238px; width: 297px;&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt; --&gt;&lt;a href=&quot;http://www.mcescher.com/Gallery/back-bmp/LW374.jpg&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/Curl-up.jpg/157878357/297x238/Curl-up.jpg&quot; alt=&quot;Curl-up.jpg&quot; title=&quot;Curl-up.jpg&quot; style=&quot;height: 238px; width: 297px;&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:193 --&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;Rotated Bitboards&lt;/strong&gt;,&lt;br /&gt;
a bitboard &lt;a class=&quot;wiki_link&quot; href=&quot;/Move%20Generation&quot;&gt;move generation&lt;/a&gt; technique coined by &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:7:&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 rotated bitboards&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:7 --&gt;, and later 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:16:&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&amp;lt;/a&amp;gt; in &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Ernst%20A.%20Heinz&amp;quot;&amp;gt;Ernst A. Heinz&amp;lt;/a&amp;gt; (&amp;lt;strong&amp;gt;1997&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://people.csail.mit.edu/heinz/dt/node2.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;How DarkThought Plays Chess.&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#20_3&amp;quot;&amp;gt;ICCA Journal, Vol. 20, No. 3&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:16 --&gt; and &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 &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#Rotation&quot;&gt;rotated&lt;/a&gt; copies of the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; in order to place bits along 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; in adjacent bits. Because of this, these bits can be easily extracted to obtain a dense &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy%20of%20any%20Line&quot;&gt;occupancy map&lt;/a&gt; for a &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;rank&lt;/a&gt;, file, diagonal, and anti-diagonal. These are used, along with the square of the sliding piece, to lookup a bitboard, containing attacks, in an &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
While the attack generation per line is more or less only one &lt;a class=&quot;wiki_link&quot; href=&quot;/Memory&quot;&gt;memory&lt;/a&gt; lookup, the &lt;a class=&quot;wiki_link&quot; href=&quot;/Incremental%20Updates&quot;&gt;incremental&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#UpdateByMove&quot;&gt;update&lt;/a&gt; of the &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt; during &lt;a class=&quot;wiki_link&quot; href=&quot;/Make%20Move&quot;&gt;make&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Unmake%20Move&quot;&gt;unmake move&lt;/a&gt; becomes more expensive, since beside the usual &lt;a class=&quot;wiki_link&quot; href=&quot;/Bitboard%20Board-Definition#Occupancy&quot;&gt;occupied bitboard&lt;/a&gt; there are three more rotated bitboards to update, including additional mapping from square coordinates to the rotated indices.&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;, Curl-up, 1951 &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.mcescher.com/Gallery/gallery-back.htm&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Picture gallery &amp;amp;quot;Back in Holland 1941 - 1954&amp;amp;quot;&amp;lt;/a&amp;gt; from &amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.mcescher.com/&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;The Official M.C. Escher Website&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: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:81:&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:81 --&gt;&lt;!-- ws:start:WikiTextTocRule:82: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#An Example&quot;&gt;An Example&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;#Square Mapping&quot;&gt;Square Mapping&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;#Square Mapping-by Hyatt&quot;&gt;by Hyatt&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;#Square Mapping-by Gillgasch and Heinz&quot;&gt;by Gillgasch and Heinz&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;#Square Mapping-Quotes&quot;&gt;Quotes&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;#Table size&quot;&gt;Table size&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;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:88 --&gt;&lt;!-- ws:start:WikiTextTocRule:89: --&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:89 --&gt;&lt;!-- ws:start:WikiTextTocRule:90: --&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:90 --&gt;&lt;!-- ws:start:WikiTextTocRule:91: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-1995 ...&quot;&gt;1995 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:91 --&gt;&lt;!-- ws:start:WikiTextTocRule:92: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-2000 ...&quot;&gt;2000 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:92 --&gt;&lt;!-- ws:start:WikiTextTocRule:93: --&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;a href=&quot;#Forum Posts-2005 ...&quot;&gt;2005 ...&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:93 --&gt;&lt;!-- ws:start:WikiTextTocRule:94: --&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:94 --&gt;&lt;!-- ws:start:WikiTextTocRule:95: --&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:95 --&gt;&lt;!-- ws:start:WikiTextTocRule:96: --&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:96 --&gt;&lt;!-- ws:start:WikiTextTocRule:97: --&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:97 --&gt;&lt;!-- ws:start:WikiTextTocRule:98: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:98 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:49:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;An Example&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:49 --&gt;An Example&lt;/h1&gt;
 As example file-attacks of rook a5 with occupancy along the a-file. The 90-degree rotated bitboard has consecutive bits of that file along its 8th rank, which serves as an index to lookup the pre-calculated file-attacks:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;  non-rotated           rotated             file_attacks[a5][rotated]&amp;lt;br/&amp;gt; ┌─┐                 ┌───────────────┐     ┌─┐&amp;lt;br/&amp;gt; │1│0 0 0 0 0 0 0    │1_0_0_1_R_0_1_1│════&amp;amp;gt;│0│0 0 0 0 0 0 0&amp;lt;br/&amp;gt; │1│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │1│0 0 0 0 0 0 0&amp;lt;br/&amp;gt; │0│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │1│0 0 0 0 0 0 0&amp;lt;br/&amp;gt; │R│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │0│0 0 0 0 0 0 0&amp;lt;br/&amp;gt; │1│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │1│0 0 0 0 0 0 0&amp;lt;br/&amp;gt; │0│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │0│0 0 0 0 0 0 0&amp;lt;br/&amp;gt; │0│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │0│0 0 0 0 0 0 0&amp;lt;br/&amp;gt; │1│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │0│0 0 0 0 0 0 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;  non-rotated           rotated             file_attacks[a5][rotated]
 ┌─┐                 ┌───────────────┐     ┌─┐
 │1│0 0 0 0 0 0 0    │1_0_0_1_R_0_1_1│════&amp;gt;│0│0 0 0 0 0 0 0
 │1│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │1│0 0 0 0 0 0 0
 │0│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │1│0 0 0 0 0 0 0
 │R│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │0│0 0 0 0 0 0 0
 │1│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │1│0 0 0 0 0 0 0
 │0│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │0│0 0 0 0 0 0 0
 │0│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │0│0 0 0 0 0 0 0
 │1│0 0 0 0 0 0 0     0 0 0 0 0 0 0 0      │0│0 0 0 0 0 0 0
 └─┘                                       └─┘&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;With a rook on the square marked &#039;R&#039;, an attack bitboard can be obtained with the array lookup file_attacks[R][10011011].&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:51:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Square Mapping&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:51 --&gt;Square Mapping&lt;/h1&gt;
 Interesting is the different mapping of both approaches. Crafty seemed to use &lt;a class=&quot;wiki_link&quot; href=&quot;/Square%20Mapping%20Considerations#LittleEndianRankFileMapping&quot;&gt;little endian square mapping&lt;/a&gt; but bit 0 (A1) is mentioned as MSB, while bit 63 (H8) is LSB. DarkThought uses big-endian file-mapping (H1 = 0).&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:53:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc2&quot;&gt;&lt;a name=&quot;Square Mapping-by Hyatt&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:53 --&gt;by Hyatt&lt;/h2&gt;
 Crafty didn&#039;t use byte aligned &lt;a class=&quot;wiki_link&quot; href=&quot;/diagonals&quot;&gt;diagonals&lt;/a&gt;, but visual rotation.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;  normal chess board bitmap            occupied_squares 90 degrees&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;  A8 B8 C8 D8 E8 F8 G8 H8              H8 H7 H6 H5 H4 H3 H2 H1&amp;lt;br/&amp;gt;  A7 B7 C7 D7 E7 F7 G7 H7              G8 G7 G6 G5 G4 G3 G2 G1&amp;lt;br/&amp;gt;  A6 B6 C6 D6 E6 F6 G6 H6              F8 F7 F6 F5 F4 F3 F2 F1&amp;lt;br/&amp;gt;  A5 B5 C5 D5 E5 F5 G5 H5              E8 E7 E6 E5 E4 E3 E2 E1&amp;lt;br/&amp;gt;  A4 B4 C4 D4 E4 F4 G4 H4              D8 D7 D6 D5 D4 D3 D2 D1&amp;lt;br/&amp;gt;  A3 B3 C3 D3 E3 F3 G3 H3              C8 C7 C6 C5 C4 C3 C2 C1&amp;lt;br/&amp;gt;  A2 B2 C2 D2 E2 F2 G2 H2              B8 B7 B6 B5 B4 B3 B2 B1&amp;lt;br/&amp;gt;  A1 B1 C1 D1 E1 F1 G1 H1              A8 A7 A6 A5 A4 A3 A2 A1&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;  original left 45                     original right 45&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;              H8                                 A8&amp;lt;br/&amp;gt;            G8  H7                             A7  B8&amp;lt;br/&amp;gt;          F8  G7  H6                         A6  B7  C8&amp;lt;br/&amp;gt;        E8  F7  G6  H5                     A5  B6  C7  D8&amp;lt;br/&amp;gt;      D8  E7  F6  G5  H4                 A4  B5  C6  D7  E8&amp;lt;br/&amp;gt;    C8  D7  E6  F5  G4  H3             A3  B4  C5  D6  E7  F8&amp;lt;br/&amp;gt;  B8  C7  D6  E5  F4  G3  H2         A2  B3  C4  D5  E6  F7  G8&amp;lt;br/&amp;gt;A8  B7  C6  D5  E4  F3  G2  H1     A1  B2  C3  D4  E5  F6  G7  H8&amp;lt;br/&amp;gt;  A7  B6  C5  D4  E3  F2  G1         B1  C2  D3  E4  F5  G6  H7&amp;lt;br/&amp;gt;    A6  B5  C4  D3  E2  F1             C1  D2  E3  F4  G5  H6&amp;lt;br/&amp;gt;      A5  B4  C3  D2  E1                 D1  E2  F3  G4  H5&amp;lt;br/&amp;gt;        A4  B3  C2  D1                     E1  F2  G3  H4&amp;lt;br/&amp;gt;          A3  B2  C1                         F1  G2  H3&amp;lt;br/&amp;gt;            A2  B1                             G1  H2&amp;lt;br/&amp;gt;              A1                                 H1&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;  original left 45                     original right 45&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;   G6 H5|F8 G7 H6|G8 H7|H8|            C7 D8|A6 B7 C8|A7 B8|A8|&amp;lt;br/&amp;gt;   H3|D8 E7 F6 G5 H4|E8 F7             F8|A4 B5 C6 D7 E8|A5 B6&amp;lt;br/&amp;gt;   F4 G3 H2|C8 D7 E6 F5 G4             E6 F7 G8|A3 B4 C5 D6 E7&amp;lt;br/&amp;gt;   E4 F3 G2 H1|B8 C7 D6 E5             E5 F6 G7 H8|A2 B3 C4 D5&amp;lt;br/&amp;gt;   D4 E3 F2 G1|A8 B7 C6 D5             E4 F5 G6 H7|A1 B2 C3 D4&amp;lt;br/&amp;gt;   B5 C4 D3 E2 F1|A7 B6 C5             D2 E3 F4 G5 H6|B1 C2 D3&amp;lt;br/&amp;gt;   C2 D1|A5 B4 C3 D2 E1|A6             G3 H4|D1 E2 F3 G4 H5|C1&amp;lt;br/&amp;gt;  |A1|A2 B1|A3 B2 C1|A4 B3            |H1|G1 H2|F1 G2 H3|E1 F2&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;  normal chess board bitmap            occupied_squares 90 degrees
&amp;nbsp;
  A8 B8 C8 D8 E8 F8 G8 H8              H8 H7 H6 H5 H4 H3 H2 H1
  A7 B7 C7 D7 E7 F7 G7 H7              G8 G7 G6 G5 G4 G3 G2 G1
  A6 B6 C6 D6 E6 F6 G6 H6              F8 F7 F6 F5 F4 F3 F2 F1
  A5 B5 C5 D5 E5 F5 G5 H5              E8 E7 E6 E5 E4 E3 E2 E1
  A4 B4 C4 D4 E4 F4 G4 H4              D8 D7 D6 D5 D4 D3 D2 D1
  A3 B3 C3 D3 E3 F3 G3 H3              C8 C7 C6 C5 C4 C3 C2 C1
  A2 B2 C2 D2 E2 F2 G2 H2              B8 B7 B6 B5 B4 B3 B2 B1
  A1 B1 C1 D1 E1 F1 G1 H1              A8 A7 A6 A5 A4 A3 A2 A1
&amp;nbsp;
  original left 45                     original right 45
&amp;nbsp;
              H8                                 A8
            G8  H7                             A7  B8
          F8  G7  H6                         A6  B7  C8
        E8  F7  G6  H5                     A5  B6  C7  D8
      D8  E7  F6  G5  H4                 A4  B5  C6  D7  E8
    C8  D7  E6  F5  G4  H3             A3  B4  C5  D6  E7  F8
  B8  C7  D6  E5  F4  G3  H2         A2  B3  C4  D5  E6  F7  G8
A8  B7  C6  D5  E4  F3  G2  H1     A1  B2  C3  D4  E5  F6  G7  H8
  A7  B6  C5  D4  E3  F2  G1         B1  C2  D3  E4  F5  G6  H7
    A6  B5  C4  D3  E2  F1             C1  D2  E3  F4  G5  H6
      A5  B4  C3  D2  E1                 D1  E2  F3  G4  H5
        A4  B3  C2  D1                     E1  F2  G3  H4
          A3  B2  C1                         F1  G2  H3
            A2  B1                             G1  H2
              A1                                 H1
&amp;nbsp;
  original left 45                     original right 45
&amp;nbsp;
   G6 H5|F8 G7 H6|G8 H7|H8|            C7 D8|A6 B7 C8|A7 B8|A8|
   H3|D8 E7 F6 G5 H4|E8 F7             F8|A4 B5 C6 D7 E8|A5 B6
   F4 G3 H2|C8 D7 E6 F5 G4             E6 F7 G8|A3 B4 C5 D6 E7
   E4 F3 G2 H1|B8 C7 D6 E5             E5 F6 G7 H8|A2 B3 C4 D5
   D4 E3 F2 G1|A8 B7 C6 D5             E4 F5 G6 H7|A1 B2 C3 D4
   B5 C4 D3 E2 F1|A7 B6 C5             D2 E3 F4 G5 H6|B1 C2 D3
   C2 D1|A5 B4 C3 D2 E1|A6             G3 H4|D1 E2 F3 G4 H5|C1
  |A1|A2 B1|A3 B2 C1|A4 B3            |H1|G1 H2|F1 G2 H3|E1 F2&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:1 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:55:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Square Mapping-by Gillgasch and Heinz&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:55 --&gt;by Gillgasch and Heinz&lt;/h2&gt;
 &lt;a class=&quot;wiki_link&quot; href=&quot;/DarkThought&quot;&gt;DarkThought&lt;/a&gt; used a similar mapping as proposed in &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating#PseudoRotationby45degrees&quot;&gt;Pseudo Rotation by 45 degrees&lt;/a&gt; from &lt;a class=&quot;wiki_link&quot; href=&quot;/Flipping%20Mirroring%20and%20Rotating&quot;&gt;Flipping Mirroring and Rotating&lt;/a&gt;, all diagonals are packed in file-aligned bytes.&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;Normal Bitboard.                       Flipped Bitboard.&amp;lt;br/&amp;gt;#7 #6 #5 #4 #3 #2 #1 #0 Bit/Byte       #7 #6 #5 #4 #3 #2 #1 #0 Bit/Byte&amp;lt;br/&amp;gt;a8 b8 c8 d8 e8 f8 g8 h8 #7             a8 a7 a6 a5 a4 a3 a2 a1 #7&amp;lt;br/&amp;gt;a7 b7 c7 d7 e7 f7 g7 h7 #6             b8 b7 b6 b5 b4 b3 b2 b1 #6&amp;lt;br/&amp;gt;a6 b6 c6 d6 e6 f6 g6 h6 #5             c8 c7 c6 c5 c4 c3 c2 c1 #5&amp;lt;br/&amp;gt;a5 b5 c5 d5 e5 f5 g5 h5 #4             d8 d7 d6 d5 d4 d3 d2 d1 #4&amp;lt;br/&amp;gt;a4 b4 c4 d4 e4 f4 g4 h4 #3             e8 e7 e6 e5 e4 e3 e2 e1 #3&amp;lt;br/&amp;gt;a3 b3 c3 d3 e3 f3 g3 h3 #2             f8 f7 f6 f5 f4 f3 f2 f1 #2&amp;lt;br/&amp;gt;a2 b2 c2 d2 e2 f2 g2 h2 #1             g8 g7 g6 g5 g4 g3 g2 g1 #1&amp;lt;br/&amp;gt;a1 b1 c1 d1 e1 f1 g1 h1 #0             h8 h7 h6 h5 h4 h3 h2 h1 #0&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;A1-H8 Bitboard.                        A8-H1 Bitboard.&amp;lt;br/&amp;gt;#7 #6 #5 #4 #3 #2 #1 #0 Bit/Byte       #7 #6 #5 #4 #3 #2 #1 #0 Bit/Byte&amp;lt;br/&amp;gt;a8|b1 c2 d3 e4 f5 g6 h7 #7             a8 b7 c6 d5 e4 f3 g2 h1 #7&amp;lt;br/&amp;gt;a7 b8|c1 d2 e3 f4 g5 h6 #6             a7 b6 c5 d4 e3 f2 g1|h8 #6&amp;lt;br/&amp;gt;a6 b7 c8|d1 e2 f3 g4 h5 #5             a6 b5 c4 d3 e2 f1|g8 h7 #5&amp;lt;br/&amp;gt;a5 b6 c7 d8|e1 f2 g3 h4 #4             a5 b4 c3 d2 e1|f8 g7 h6 #4&amp;lt;br/&amp;gt;a4 b5 c6 d7 e8|f1 g2 h3 #3             a4 b3 c2 d1|e8 f7 g6 h5 #3&amp;lt;br/&amp;gt;a3 b4 c5 d6 e7 f8|g1 h2 #2             a3 b2 c1|d8 e7 f6 g5 h4 #2&amp;lt;br/&amp;gt;a2 b3 c4 d5 e6 f7 g8|h1 #1             a2 b1|c8 d7 e6 f5 g4 h3 #1&amp;lt;br/&amp;gt;a1 b2 c3 d4 e5 f6 g7 h8|#0             a1|b8 c7 d6 e5 f4 g3 h2 #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;Normal Bitboard.                       Flipped Bitboard.
#7 #6 #5 #4 #3 #2 #1 #0 Bit/Byte       #7 #6 #5 #4 #3 #2 #1 #0 Bit/Byte
a8 b8 c8 d8 e8 f8 g8 h8 #7             a8 a7 a6 a5 a4 a3 a2 a1 #7
a7 b7 c7 d7 e7 f7 g7 h7 #6             b8 b7 b6 b5 b4 b3 b2 b1 #6
a6 b6 c6 d6 e6 f6 g6 h6 #5             c8 c7 c6 c5 c4 c3 c2 c1 #5
a5 b5 c5 d5 e5 f5 g5 h5 #4             d8 d7 d6 d5 d4 d3 d2 d1 #4
a4 b4 c4 d4 e4 f4 g4 h4 #3             e8 e7 e6 e5 e4 e3 e2 e1 #3
a3 b3 c3 d3 e3 f3 g3 h3 #2             f8 f7 f6 f5 f4 f3 f2 f1 #2
a2 b2 c2 d2 e2 f2 g2 h2 #1             g8 g7 g6 g5 g4 g3 g2 g1 #1
a1 b1 c1 d1 e1 f1 g1 h1 #0             h8 h7 h6 h5 h4 h3 h2 h1 #0
&amp;nbsp;
&amp;nbsp;
A1-H8 Bitboard.                        A8-H1 Bitboard.
#7 #6 #5 #4 #3 #2 #1 #0 Bit/Byte       #7 #6 #5 #4 #3 #2 #1 #0 Bit/Byte
a8|b1 c2 d3 e4 f5 g6 h7 #7             a8 b7 c6 d5 e4 f3 g2 h1 #7
a7 b8|c1 d2 e3 f4 g5 h6 #6             a7 b6 c5 d4 e3 f2 g1|h8 #6
a6 b7 c8|d1 e2 f3 g4 h5 #5             a6 b5 c4 d3 e2 f1|g8 h7 #5
a5 b6 c7 d8|e1 f2 g3 h4 #4             a5 b4 c3 d2 e1|f8 g7 h6 #4
a4 b5 c6 d7 e8|f1 g2 h3 #3             a4 b3 c2 d1|e8 f7 g6 h5 #3
a3 b4 c5 d6 e7 f8|g1 h2 #2             a3 b2 c1|d8 e7 f6 g5 h4 #2
a2 b3 c4 d5 e6 f7 g8|h1 #1             a2 b1|c8 d7 e6 f5 g4 h3 #1
a1 b2 c3 d4 e5 f6 g7 h8|#0             a1|b8 c7 d6 e5 f4 g3 h2 #0&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:2 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:57:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc4&quot;&gt;&lt;a name=&quot;Square Mapping-Quotes&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:57 --&gt;Quotes&lt;/h2&gt;
 From &lt;a class=&quot;wiki_link&quot; href=&quot;/Robert%20Hyatt&quot;&gt;Robert Hyatt&lt;/a&gt; as repost to &lt;a class=&quot;wiki_link&quot; href=&quot;/Urban%20Koistinen&quot;&gt;Urban Koistinen&lt;/a&gt; from 1997 &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://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/00013e6c504ace86&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Bitboard Representation&amp;lt;/a&amp;gt; by Carl Tillotson, &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;, September 18, 1997, post 23 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-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:23 --&gt; :&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;tt&gt;When I first thought about doing the rotated bitmap idea, I discussed it with Peter G. of the DarkThought team. He thought (as I did) that the idea was pretty neat and worth trying. I (from the first thought) had always planned on updating the rotated bitmaps by the following approach: I have a set of 64 bitmaps callet set_mask[n]. To set bit 32, I simply AND(bit-map,set_mask[32]). If I have a rotated-90 bitmap, then I also create a rotated-90 set_mask, and do this: AND(bit-map-R90,set_mask_R90[32]) and I am done. Peter didn&#039;t like this, and wanted to get rid of the extra memory load for the rotated set_mask variable. (note there are actually 4 of these loads needed, for each of the rotated bitmaps). So he thought about it a bit and found a cute mathematical transformation based on shifts, AND&#039;s and OR&#039;s (I won&#039;t give it here since it is his idea) that avoide needing the set_mask_Rxx masks (note that on some machines, even the set_mask itself is not needed. to set bit 32 you just start with &amp;quot;1&amp;quot; and shift it to the right position avoiding the memory load altogether. However, the effect of Peter&#039;s approach is to map diagonal bits on the real bitmap to adjacent bits in a &amp;quot;psuedo-rotated&amp;quot; bitmap, without needing the set_mask_R90 stuff at all. Is it better? I&#039;m not sure. My tests on the P6 said NO. My tests on the alpha with big cache also said NO. Peter&#039;s tests on the machine he used said YES. It definitely takes more instructions to do what Peter is doing. On a machine with a huge memory latency, like the &lt;a class=&quot;wiki_link&quot; href=&quot;/IBM%20PC&quot;&gt;PC&lt;/a&gt;, my memory loading can be slow. But with a decent sized cache, the 64 words X 8 bytes per word (512 bytes) really tucks into a corner in cache and doesn&#039;t hurt at all, particularly since a cache hit on the P6 operates at CPU speed. The PII is a different case since the cache operates at 1/2 CPU speed, which might swing things in his favor. For the record, they are *close* under all cases. We are not talking 10% here...one might be 2% faster on one machine, the other 3% faster on another machine... But the &amp;quot;mapping&amp;quot; is really odd and would not let us just simply swap the L45 and R45 maps...&lt;/tt&gt;&lt;br /&gt;
&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:59:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc5&quot;&gt;&lt;a name=&quot;Table size&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:59 --&gt;Table size&lt;/h1&gt;
 The initial implementations of rotated bitboards missed the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;outer square optimization&lt;/a&gt; and used the 8-bit occupied state with four lookup tables of 256*64*8 or 128-Kbyte each, thus 1/2 MByte in total. &lt;a class=&quot;wiki_link&quot; href=&quot;/Roberto%20Waldteufel&quot;&gt;Roberto Waldteufel&lt;/a&gt; seemed first time mentioned the optimization trick 1998 &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://www.stmintz.com/ccc/index.php?id=31456&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Re: Extracting information from rotated Bitboards&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Roberto%20Waldteufel&amp;quot;&amp;gt;Roberto Waldteufel&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;, November 02, 1998&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;, masking off the redundant outer occupancies for a four fold table reduction.&lt;br /&gt;
&lt;br /&gt;
Of course one may use calculations similar to &lt;a class=&quot;wiki_link&quot; href=&quot;/Kindergarten%20Bitboards&quot;&gt;kindergarten bitboards&lt;/a&gt; to further shrink the tables. In fact, getting the occupancy state and pre-calculated information based on that are two different steps.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:61:&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:61 --&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&quot;&gt;Flipping Mirroring and Rotating&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;/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%20Indices&quot;&gt;Rotated Indices&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;toc7&quot;&gt;&lt;a name=&quot;Publications&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:63 --&gt;Publications&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Ernst%20A.%20Heinz&quot;&gt;Ernst A. Heinz&lt;/a&gt; (&lt;strong&gt;1997&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://people.csail.mit.edu/heinz/dt/node2.html&quot; rel=&quot;nofollow&quot;&gt;How DarkThought Plays Chess&lt;/a&gt;.&lt;/em&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal#20_3&quot;&gt;ICCA Journal, Vol. 20, No. 3&lt;/a&gt;&lt;/li&gt;&lt;li&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#22_4&quot;&gt;ICCA Journal, Vol. 22, No. 4&lt;/a&gt; &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.stmintz.com/ccc/index.php?id=71880&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Bitboard user&#039;s information request&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 05, 1999&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:31 --&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.stmintz.com/ccc/index.php?id=95468&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Nice Rotated-bitmaps Article by Hyatt in ICCA&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;/CCC&amp;quot;&amp;gt;CCC&amp;lt;/a&amp;gt;, February 07, 2000&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:35 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Borko%20Bo%C5%A1kovi%C4%87&quot;&gt;Borko Bošković&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Sa%C5%A1o%20Greiner&quot;&gt;Sašo Greiner&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Janez%20Brest&quot;&gt;Janez Brest&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Viljem%20%C5%BDumer&quot;&gt;Viljem Žumer&lt;/a&gt; (&lt;strong&gt;2005&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1491153&quot; rel=&quot;nofollow&quot;&gt;The Representation of Chess Game&lt;/a&gt;&lt;/em&gt;. Proceedings of the 27th International Conference on Information Technology Interfaces&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Johannes%20Buchner&quot;&gt;Johannes Buchner&lt;/a&gt; (&lt;strong&gt;2005&lt;/strong&gt;). &lt;em&gt;Rotated bitboards in FUSc#&lt;/em&gt;. &lt;a class=&quot;wiki_link&quot; href=&quot;/Free%20University%20of%20Berlin&quot;&gt;Free University of Berlin&lt;/a&gt;, &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://fusch.mi.fu-berlin.de/publications/Joe-Paper_rotated_bitboards.pdf&quot; rel=&quot;nofollow&quot;&gt;pdf&lt;/a&gt; » &lt;a class=&quot;wiki_link&quot; href=&quot;/FUSCsharp&quot;&gt;FUSc#&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;toc8&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:65 --&gt;Forum Posts&lt;/h1&gt;
&lt;!-- ws:start:WikiTextHeadingRule:67:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc9&quot;&gt;&lt;a name=&quot;Forum Posts-1995 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:67 --&gt;1995 ...&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://groups.google.com/d/msg/gnu.chess/lSsvkY3St7s/wZ-3sG9rNmcJ&quot; rel=&quot;nofollow&quot;&gt;bitmaps of rotated boards&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;/GNU%20Chess#NewsGroup&quot;&gt;gnu.chess&lt;/a&gt;, March 2, 1995&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://groups.google.com/group/rec.games.chess.computer/msg/d3e64cbd920b1153&quot; rel=&quot;nofollow&quot;&gt;Re: Speed of Move 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;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, August 17, 1995&lt;/li&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/b6d3210fc02baa93&quot; rel=&quot;nofollow&quot;&gt;Rotated bitboards - experiment and result&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;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, February 28, 1996&lt;/li&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/a97c78bd49c9c9e6&quot; rel=&quot;nofollow&quot;&gt;bitboard move generation question&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Stuart%20Cracraft&quot;&gt;Stuart Cracraft&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, September 05, 1997&lt;/li&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/00013e6c504ace86&quot; rel=&quot;nofollow&quot;&gt;Bitboard Representation&lt;/a&gt; by Carl Tillotson, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, September 18, 1997&lt;/li&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/62f15a832b95a20c&quot; rel=&quot;nofollow&quot;&gt;Rotated bitboards&lt;/a&gt; by Mats Forsén, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, October 29, 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=17377&quot; rel=&quot;nofollow&quot;&gt;Rotated bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Peter%20Fendrich&quot;&gt;Peter Fendrich&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, April 22, 1998&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=30863&quot; rel=&quot;nofollow&quot;&gt;Efficient Rotated Bitboard Representations&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 28, 1998&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=31429&quot; rel=&quot;nofollow&quot;&gt;Extracting information from rotated Bitboards&lt;/a&gt; by John Stoneham, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, November 02, 1998&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=71880&quot; rel=&quot;nofollow&quot;&gt;Bitboard user&#039;s information request&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 05, 1999&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:69:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc10&quot;&gt;&lt;a name=&quot;Forum Posts-2000 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:69 --&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=95468&quot; rel=&quot;nofollow&quot;&gt;Nice Rotated-bitmaps Article by Hyatt in ICCA&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;/CCC&quot;&gt;CCC&lt;/a&gt;, February 07, 2000 &lt;!-- ws:start:WikiTextRefRule:43:&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#22_4&amp;quot;&amp;gt;ICCA Journal, Vol. 22, No. 4&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:43 --&gt;&lt;/li&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/8cd63a61ab02a1ed&quot; rel=&quot;nofollow&quot;&gt;Rotated Bitboards?&lt;/a&gt; by Mauricio Castro, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, October 07, 2001&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=194920&quot; rel=&quot;nofollow&quot;&gt;Attack Bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Sune%20Fischer&quot;&gt;Sune Fischer&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, October 30, 2001&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.stmintz.com/ccc/index.php?id=342372&quot; rel=&quot;nofollow&quot;&gt;Resources about rotated bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Federico%20Andr%C3%A9s%20Corigliano&quot;&gt;Federico Corigliano&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 02, 2004&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:71:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc11&quot;&gt;&lt;a name=&quot;Forum Posts-2005 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:71 --&gt;2005 ...&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=29577&quot; rel=&quot;nofollow&quot;&gt;Generating &amp;quot;through&amp;quot; attacks with rotated bitboard&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Vlad%20Stamate&quot;&gt;Vlad Stamate&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, August 28, 2009 » &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;!-- ws:start:WikiTextHeadingRule:73:&amp;lt;h2&amp;gt; --&gt;&lt;h2 id=&quot;toc12&quot;&gt;&lt;a name=&quot;Forum Posts-2010 ...&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:73 --&gt;2010 ...&lt;/h2&gt;
&lt;ul&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=1376&quot; rel=&quot;nofollow&quot;&gt;A question on rotated bitboard&lt;/a&gt; by n_ven, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;OpenChess Forum&lt;/a&gt;, May 04, 2011&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:75:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc13&quot;&gt;&lt;a name=&quot;External Links&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:75 --&gt;External Links&lt;/h1&gt;
&lt;ul&gt;&lt;li&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&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Ernst%20A.%20Heinz&quot;&gt;Ernst A. Heinz&lt;/a&gt;&lt;/li&gt;&lt;li&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;, revisited version of the &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal&quot;&gt;ICCA Journal&lt;/a&gt; paper &lt;!-- ws:start:WikiTextRefRule:46:&amp;amp;lt;ref&amp;amp;gt;The &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; paper does not mention the &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/First%20Rank%20Attacks#TheOuterSquares&amp;quot;&amp;gt;outer square optimization&amp;lt;/a&amp;gt; with the four fold table reduction&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:46 --&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.frayn.net/beowulf/theory.html#bitboards&quot; rel=&quot;nofollow&quot;&gt;Computer Chess Programming Theory - Bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Colin%20Frayn&quot;&gt;Colin Frayn&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Herb_Alpert&quot; rel=&quot;nofollow&quot;&gt;Herb Alpert&lt;/a&gt; - &lt;a class=&quot;wiki_link_ext&quot; href=&quot;https://en.wikipedia.org/wiki/Rise_%28Herb_Alpert_album%29&quot; rel=&quot;nofollow&quot;&gt;Rotation&lt;/a&gt; (1979),  &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:47:&amp;lt;img src=&amp;quot;https://www.wikispaces.com/site/embedthumbnail/youtube/4vACvafOvq0?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;4vACvafOvq0&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/4vACvafOvq0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;!-- ws:end:WikiTextMediaRule:47 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:77:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc14&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:77 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:358:&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://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 rotated bitboards&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://people.csail.mit.edu/heinz/dt/node8.html&quot; rel=&quot;nofollow&quot;&gt;Rotated Bitboards&lt;/a&gt; in &lt;a class=&quot;wiki_link&quot; href=&quot;/Ernst%20A.%20Heinz&quot;&gt;Ernst A. Heinz&lt;/a&gt; (&lt;strong&gt;1997&lt;/strong&gt;). &lt;em&gt;&lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://people.csail.mit.edu/heinz/dt/node2.html&quot; rel=&quot;nofollow&quot;&gt;How DarkThought Plays Chess.&lt;/a&gt;&lt;/em&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal#20_3&quot;&gt;ICCA Journal, Vol. 20, No. 3&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.mcescher.com/Gallery/gallery-back.htm&quot; rel=&quot;nofollow&quot;&gt;Picture gallery &amp;quot;Back in Holland 1941 - 1954&amp;quot;&lt;/a&gt; from &lt;a class=&quot;wiki_link_ext&quot; href=&quot;http://www.mcescher.com/&quot; rel=&quot;nofollow&quot;&gt;The Official M.C. Escher Website&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://groups.google.com/group/rec.games.chess.computer/browse_frm/thread/00013e6c504ace86&quot; rel=&quot;nofollow&quot;&gt;Bitboard Representation&lt;/a&gt; by Carl Tillotson, &lt;a class=&quot;wiki_link&quot; href=&quot;/Computer%20Chess%20Forums&quot;&gt;rgcc&lt;/a&gt;, September 18, 1997, post 23 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-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.stmintz.com/ccc/index.php?id=31456&quot; rel=&quot;nofollow&quot;&gt;Re: Extracting information from rotated Bitboards&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;, November 02, 1998&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=71880&quot; rel=&quot;nofollow&quot;&gt;Bitboard user&#039;s information request&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 05, 1999&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.stmintz.com/ccc/index.php?id=95468&quot; rel=&quot;nofollow&quot;&gt;Nice Rotated-bitmaps Article by Hyatt in ICCA&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;/CCC&quot;&gt;CCC&lt;/a&gt;, February 07, 2000&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#22_4&quot;&gt;ICCA Journal, Vol. 22, No. 4&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; The &lt;a class=&quot;wiki_link&quot; href=&quot;/ICGA%20Journal&quot;&gt;ICCA Journal&lt;/a&gt; paper does not mention the &lt;a class=&quot;wiki_link&quot; href=&quot;/First%20Rank%20Attacks#TheOuterSquares&quot;&gt;outer square optimization&lt;/a&gt; with the four fold table reduction&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:358 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:79:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc15&quot;&gt;&lt;a name=&quot;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:79 --&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;Rotated Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;100&amp;amp;quot;&amp;quot; title=&amp;quot;Include backlinks: page=&amp;amp;quot;Rotated Bitboards&amp;amp;quot; component=&amp;amp;quot;backlinks&amp;amp;quot; limit=&amp;amp;quot;100&amp;amp;quot;&amp;quot; /&amp;gt; --&gt;&lt;div class=&quot;includeBody-Rotated_Bitboards includeBody-Rotated%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/Rotated+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/Alarm&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Alarm&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 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/Alessandro+Damiani&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Alessandro Damiani&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/Alice&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Alice&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 20, 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/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/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/Aristarch&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Aristarch&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 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/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/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/Beaches&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Beaches&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/Beowulf&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Beowulf&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/Betsy&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Betsy&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 28, 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/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/Bison&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Bison&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 29, 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/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/BMI1&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;BMI1&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 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/Booot&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Booot&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 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/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/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/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/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/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/ChessV&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;ChessV&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/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/Cinnamon&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Cinnamon&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/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/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/Cupcake&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Cupcake&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 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/DarkThought&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;DarkThought&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 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/David+Rasmussen&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;David Rasmussen&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/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/Dorky&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Dorky&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 10, 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/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/Ernst+A.+Heinz&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Ernst A. Heinz&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 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/Federico+Andr%C3%A9s+Corigliano&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Federico Andrés Corigliano&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 13, 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/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/Fischerle&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fischerle&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Aug 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/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/Fortress+%28Engine%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fortress (Engine)&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/Freyr&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Freyr&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/FUSCsharp&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;FUSCsharp&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jun 7, 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/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/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/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/HeavyChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;HeavyChess&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 14, 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/IsiChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;IsiChess&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/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/Johannes+Buchner&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Johannes Buchner&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 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/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/Kiwi&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Kiwi&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 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/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/La+Dame+Blanche&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;La Dame Blanche&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Oct 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/LittleThought&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;LittleThought&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Nov 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/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/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/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/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/Nesik&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Nesik&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jan 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/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/Parrot&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Parrot&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 31, 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/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/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/Peter+Gillgasch&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Peter Gillgasch&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;May 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/Pharaon&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Pharaon&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Sep 2, 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/Plisk&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Plisk&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 31, 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/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/Protej&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Protej&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 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/PsycoChess&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;PsycoChess&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/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/Requiem&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Requiem&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 5, 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/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/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/Rotated+Indices&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rotated Indices&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/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/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/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/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/Simon&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Simon&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Mar 15, 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/Sinobyl&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sinobyl&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Jul 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/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/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/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/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/Sune+Fischer&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Sune Fischer&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Apr 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/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/Terra&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Terra&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 11, 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/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;tr class=&quot;includeBacklinksLink&quot;&gt;
      &lt;td class=&quot;includeBacklinksLinkPage&quot;&gt;
        &lt;a href=&quot;https://chessprogramming.wikispaces.com/Vlad+Stamate&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Vlad Stamate&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Dec 31, 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/Warrior&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Warrior&lt;/a&gt;
      &lt;/td&gt;
      &lt;td class=&quot;includeBacklinksLinkDate&quot;&gt;Feb 23, 2015&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>Rotated Indices</title>
      <link>https://chessprogramming.wikispaces.com/Rotated+Indices</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/Rotated+Indices</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/Rotated+Indices</comments>
      <pubDate>Mon, 09 Oct 2017 08:04:39 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; * Rotated Indices&lt;/strong&gt;&lt;br /&gt;


&lt;table class=&quot;wiki_table&quot;&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;!-- ws:start:WikiTextLocalImageRule:55:&amp;lt;a href=&amp;quot;http://www.barbaramittman.com/Site/Yellow_Cherries.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;/file/view/Yellow_Cherries.jpg/157881701/Yellow_Cherries.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://www.barbaramittman.com/Site/Yellow_Cherries.html&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;/file/view/Yellow_Cherries.jpg/157881701/Yellow_Cherries.jpg&quot; alt=&quot;Yellow_Cherries.jpg&quot; title=&quot;Yellow_Cherries.jpg&quot; /&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextLocalImageRule:55 --&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;Rotated indices&lt;/strong&gt;,&lt;br /&gt;
a deconcentrated version of &lt;a class=&quot;wiki_link&quot; href=&quot;/Rotated%20Bitboards&quot;&gt;rotated bitboards&lt;/a&gt;, proposed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Alessandro%20Damiani&quot;&gt;Alessandro Damiani&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:3:&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/msg/5c1c40a08c7176f8&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;/Alessandro%20Damiani&amp;quot;&amp;gt;Alessandro Damiani&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-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:3 --&gt; as used in his engine &lt;a class=&quot;wiki_link&quot; href=&quot;/Fortress%20%28Engine%29&quot;&gt;Fortress&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Instead of using rotated bitboards with packed 15 &lt;a class=&quot;wiki_link&quot; href=&quot;/Diagonals&quot;&gt;diagonals&lt;/a&gt; and 15 &lt;a class=&quot;wiki_link&quot; href=&quot;/Anti-Diagonals&quot;&gt;anti-diagonals&lt;/a&gt; each, Alessandro applies an &lt;a class=&quot;wiki_link&quot; href=&quot;/Array&quot;&gt;array&lt;/a&gt; of 16 + 30 rotated indices for all 16 orthogonal and 30 diagonal lines on the board. Those indices are &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;, which takes a tad more effort - but once updated, the rotated indices pay off, the more often they are used inside a &lt;a class=&quot;wiki_link&quot; href=&quot;/Node&quot;&gt;node&lt;/a&gt; of the &lt;a class=&quot;wiki_link&quot; href=&quot;/Search&quot;&gt;search&lt;/a&gt;. No further computation is required to look up attacks, pure indexed memory accesses.&lt;br /&gt;
&lt;br /&gt;
The possible disadvantage - rotated indices, similar or slightly worse than rotated bitboards, are not as versatile as techniques relying on one occupancy bitboard only - if it is about a temporary change of the occupancy on the fly for &lt;a class=&quot;wiki_link&quot; href=&quot;/X-ray%20Attacks%20%28Bitboards%29&quot;&gt;x-rays&lt;/a&gt; and &lt;a class=&quot;wiki_link&quot; href=&quot;/Pin&quot;&gt;pinned pieces&lt;/a&gt; etc..&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#Mittman&quot;&gt;Barbara Mittman&lt;/a&gt;, Yellow Cherries &lt;!-- ws:start:WikiTextRefRule:6:&amp;amp;lt;ref&amp;amp;gt;&amp;lt;a class=&amp;quot;wiki_link_ext&amp;quot; href=&amp;quot;http://www.barbaramittman.com/Site/Still_Lifes.html&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Still Lifes&amp;lt;/a&amp;gt; by &amp;lt;a class=&amp;quot;wiki_link&amp;quot; href=&amp;quot;/Arts#Mittman&amp;quot;&amp;gt;Barbara Mittman&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: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: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;#See also&quot;&gt;See also&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:17 --&gt;&lt;!-- ws:start:WikiTextTocRule:18: --&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:18 --&gt;&lt;!-- ws:start:WikiTextTocRule:19: --&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:19 --&gt;&lt;!-- ws:start:WikiTextTocRule:20: --&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:20 --&gt;&lt;!-- ws:start:WikiTextTocRule:21: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:21 --&gt;&lt;!-- ws:start:WikiTextHeadingRule:8:&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:8 --&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&quot;&gt;Flipping Mirroring and Rotating&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class=&quot;wiki_link&quot; href=&quot;/Fortress%20%28Engine%29&quot;&gt;Fortress&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;/Gk#SlidingAttacks&quot;&gt;Rotated Indices in Gk&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:10:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:10 --&gt;Forum Posts&lt;/h1&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/msg/5c1c40a08c7176f8&quot; rel=&quot;nofollow&quot;&gt;Re: Rotated bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Alessandro%20Damiani&quot;&gt;Alessandro Damiani&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=342812&quot; rel=&quot;nofollow&quot;&gt;Re: Resources about rotated bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Alessandro%20Damiani&quot;&gt;Alessandro Damiani&lt;/a&gt;, &lt;a class=&quot;wiki_link&quot; href=&quot;/CCC&quot;&gt;CCC&lt;/a&gt;, January 16, 2004&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:12:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc2&quot;&gt;&lt;a name=&quot;References&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:12 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:106:&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://groups.google.com/group/rec.games.chess.computer/msg/5c1c40a08c7176f8&quot; rel=&quot;nofollow&quot;&gt;Re: Rotated bitboards&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Alessandro%20Damiani&quot;&gt;Alessandro Damiani&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-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.barbaramittman.com/Site/Still_Lifes.html&quot; rel=&quot;nofollow&quot;&gt;Still Lifes&lt;/a&gt; by &lt;a class=&quot;wiki_link&quot; href=&quot;/Arts#Mittman&quot;&gt;Barbara Mittman&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:106 --&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;What links here?&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:14 --&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;Rotated Indices&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;Rotated Indices&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-Rotated_Indices includeBody-Rotated%20Indices 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/Alessandro+Damiani&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Alessandro Damiani&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/Fortress+%28Engine%29&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Fortress (Engine)&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/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/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/Rotated+Indices&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Rotated Indices&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/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: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>SBAMG</title>
      <link>https://chessprogramming.wikispaces.com/SBAMG</link>
      <dc:creator>GerdIsenberg</dc:creator>
      <guid isPermaLink="true">https://chessprogramming.wikispaces.com/SBAMG</guid>
      <comments>https://chessprogramming.wikispaces.com/page/messages/SBAMG</comments>
      <pubDate>Sun, 04 Dec 2016 09:16:26 GMT</pubDate>
      <description>&lt;!-- ws:start:WikiTextTocRule:21:&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:21 --&gt;&lt;!-- ws:start:WikiTextTocRule:22: --&gt;&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#Sample&quot;&gt;Sample&lt;/a&gt;&lt;/div&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;#C Code&quot;&gt;C Code&lt;/a&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:23 --&gt;&lt;!-- ws:start:WikiTextTocRule:24: --&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:24 --&gt;&lt;!-- ws:start:WikiTextTocRule:25: --&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:25 --&gt;&lt;!-- ws:start:WikiTextTocRule:26: --&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:26 --&gt;&lt;!-- ws:start:WikiTextTocRule:27: --&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:27 --&gt;&lt;!-- ws:start:WikiTextTocRule:28: --&gt;&lt;/div&gt;
&lt;!-- ws:end:WikiTextTocRule:28 --&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; * SBAMG&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;SBAMG&lt;/strong&gt;, (Subtraction based Attack Mask Generation)&lt;br /&gt;
a subtraction based approach proposed by &lt;a class=&quot;wiki_link&quot; href=&quot;/Syed%20Fahad&quot;&gt;Syed Fahad&lt;/a&gt; &lt;!-- ws:start:WikiTextRefRule:6:&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=59845&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;SBAMG - Completing Hyperbola Quintessence&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 10, 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:6 --&gt; which combines techniques used in &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; aka o^(o-2r) and &lt;a class=&quot;wiki_link&quot; href=&quot;/Obstruction%20Difference&quot;&gt;Obstruction Difference&lt;/a&gt;. The idea is to subtract three times the closest blocker in &lt;a class=&quot;wiki_link&quot; href=&quot;/On%20an%20empty%20Board#NegativeRays&quot;&gt;negative ray&lt;/a&gt; &lt;a class=&quot;wiki_link&quot; href=&quot;/Direction&quot;&gt;direction&lt;/a&gt; (&lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#TheMostSignificantOneBitMS1B&quot;&gt;most significant one bit&lt;/a&gt; of lower ray &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt;)  from the line  &lt;a class=&quot;wiki_link&quot; href=&quot;/Occupancy&quot;&gt;occupancy&lt;/a&gt;, to &lt;a class=&quot;wiki_link&quot; href=&quot;/General%20Setwise%20Operations#ExclusiveOr&quot;&gt;exclusive or&lt;/a&gt; that difference with the line occupancy again: &lt;strong&gt;o^(o-3cbn)&lt;/strong&gt;. Three times is necessary, since we need not only to subtract the next highest neigbouring square of the closest blocker for the borrow propagation, but the blocker square itself. The line occupancy excludes the sliding piece itself, and equivalently the final result is again restricted by the line-mask excluding the square of the attacker. Outer squares of the line occupancy, which don&#039;t affect resulting line attacks, are always set to avoid conditional code.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:9:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc0&quot;&gt;&lt;a name=&quot;Sample&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:9 --&gt;Sample&lt;/h1&gt;
A two &lt;a class=&quot;wiki_link&quot; href=&quot;/Nibble&quot;&gt;nibble&lt;/a&gt; sample calculating the &lt;a class=&quot;wiki_link&quot; href=&quot;/Ranks&quot;&gt;rank&lt;/a&gt; aka &lt;a class=&quot;wiki_link&quot; href=&quot;/Byte&quot;&gt;byte&lt;/a&gt; attacks of a rook illustrates the technique:&lt;br /&gt;
&lt;ul class=&quot;quotelist&quot;&gt;&lt;li&gt;&lt;!-- ws:start:WikiTextCodeRule:0:
&amp;lt;pre class=&amp;quot;text&amp;quot;&amp;gt;                   binary     hex  dez&amp;lt;br/&amp;gt;bit-index          7654 3210  &amp;lt;br/&amp;gt;blockers and rook  .b.. r.bb&amp;lt;br/&amp;gt;occ (without rook) 0100 0011  0x43  67&amp;lt;br/&amp;gt;cbn                0000 0010  0x02   2 &amp;lt;br/&amp;gt;occ-3cbn           0011 1101  0x3d  61&amp;lt;br/&amp;gt;occ^(occ-3cbn)     0111 1110  0x7e 126&amp;lt;br/&amp;gt;attacks (/rook)    0111 0110  0x76 118&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;                   binary     hex  dez
bit-index          7654 3210  
blockers and rook  .b.. r.bb
occ (without rook) 0100 0011  0x43  67
cbn                0000 0010  0x02   2 
occ-3cbn           0011 1101  0x3d  61
occ^(occ-3cbn)     0111 1110  0x7e 126
attacks (/rook)    0111 0110  0x76 118&lt;/pre&gt;

&lt;!-- ws:end:WikiTextCodeRule:0 --&gt;&lt;/li&gt;&lt;/ul&gt;&lt;!-- ws:start:WikiTextHeadingRule:11:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc1&quot;&gt;&lt;a name=&quot;C Code&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:11 --&gt;C Code&lt;/h1&gt;
 The routine works for all lines, &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;/Files&quot;&gt;files&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; by applying appropriate line-masks, and could therefor used as a generalized routine with a line-direction parameter. Signature and &lt;a class=&quot;wiki_link&quot; href=&quot;/BitScan#Bitscanreverse&quot;&gt;BitScanReverse&lt;/a&gt; (bsr64) similar to &lt;a class=&quot;wiki_link&quot; href=&quot;/Obstruction%20Difference&quot;&gt;Obstruction Difference&lt;/a&gt;.&lt;br /&gt;
&lt;!-- ws:start:WikiTextIncludeRule:03:&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:03 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:1:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;/*&amp;lt;br/&amp;gt; * @author Syed Fahad, Gerd Isenberg&amp;lt;br/&amp;gt; * @param  U64 occ occupancy of the board&amp;lt;br/&amp;gt; * @param  SMasks* a mask structure by square and line&amp;lt;br/&amp;gt; * @return line attacks from that square&amp;lt;br/&amp;gt; */&amp;lt;br/&amp;gt;U64 lineAttacks(U64 occ, const SMasks *pMask) {&amp;lt;br/&amp;gt;   occ &amp;amp;amp;= pMask-&amp;amp;gt;lineEx;&amp;lt;br/&amp;gt;   occ |= pMask-&amp;amp;gt;outer;&amp;lt;br/&amp;gt;   int bsq = bsr64(occ &amp;amp;amp; pMask-&amp;amp;gt;lower);&amp;lt;br/&amp;gt;   U64 cbnx3 = C64(3) &amp;amp;lt;&amp;amp;lt; bsq; // or lookup&amp;lt;br/&amp;gt;   occ = occ ^ (occ - cbnx3);&amp;lt;br/&amp;gt;   return occ &amp;amp;amp; pMask-&amp;amp;gt;lineEx;&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;/*
 * @author Syed Fahad, Gerd Isenberg
 * @param  U64 occ occupancy of the board
 * @param  SMasks* a mask structure by square and line
 * @return line attacks from that square
 */&lt;/span&gt;
U64 lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;U64 occ, &lt;span class=&quot;kw4&quot;&gt;const&lt;/span&gt; SMasks &lt;span class=&quot;sy2&quot;&gt;*&lt;/span&gt;pMask&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; pMask&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt;lineEx&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; pMask&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt;outer&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; bsq &lt;span class=&quot;sy1&quot;&gt;=&lt;/span&gt; bsr64&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pMask&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt;lower&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
   U64 cbnx3 &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;3&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; bsq&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// or lookup&lt;/span&gt;
   occ &lt;span class=&quot;sy1&quot;&gt;=&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;occ &lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt; cbnx3&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; occ &lt;span class=&quot;sy3&quot;&gt;&amp;amp;&lt;/span&gt; pMask&lt;span class=&quot;sy2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;&amp;gt;&lt;/span&gt;lineEx&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;To use it that way:&lt;br /&gt;
&lt;!-- ws:start:WikiTextCodeRule:2:
&amp;lt;pre class=&amp;quot;cpp&amp;quot;&amp;gt;struct SMasks&amp;lt;br/&amp;gt;{&amp;lt;br/&amp;gt;   U64 lower;  // 1 for sq 0, otherwise (1 &amp;amp;lt;&amp;amp;lt; sq) - 1&amp;lt;br/&amp;gt;   U64 lineEx; // excluding (1 &amp;amp;lt;&amp;amp;lt; sq)&amp;lt;br/&amp;gt;   U64 outer;  // outer &amp;amp;amp; 1 must be 1 to avoid calling bsr(0)&amp;lt;br/&amp;gt;} masks[64][4]; // needs initialization&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;U64 rookAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   return lineAttacks(occ, masks[sq] + 0) | lineAttacks(occ, masks[sq] + 1);&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;U64 bishopAttacks(U64 occ, enumSquare sq) {&amp;lt;br/&amp;gt;   return lineAttacks(occ, masks[sq] + 2) | lineAttacks(occ, masks[sq] + 3);&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; SMasks
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
   U64 lower&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// 1 for sq 0, otherwise (1 &amp;lt;&amp;lt; sq) - 1&lt;/span&gt;
   U64 lineEx&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// excluding (1 &amp;lt;&amp;lt; sq)&lt;/span&gt;
   U64 outer&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;// outer &amp;amp; 1 must be 1 to avoid calling bsr(0)&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt; masks&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;4&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;// needs initialization&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;kw1&quot;&gt;return&lt;/span&gt; lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, masks&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;sy2&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;sy3&quot;&gt;|&lt;/span&gt; lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, masks&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;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;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
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; lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, masks&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;sy2&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;sy3&quot;&gt;|&lt;/span&gt; lineAttacks&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;occ, masks&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;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;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:13:&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:13 --&gt;See also&lt;/h1&gt;
&lt;ul&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;/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:15:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id=&quot;toc3&quot;&gt;&lt;a name=&quot;Forum Posts&quot;&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:15 --&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=56468&quot; rel=&quot;nofollow&quot;&gt;Slider attack mask generation without table lookup&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;, May 24, 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=59845&quot; rel=&quot;nofollow&quot;&gt;SBAMG - Competing Hyperbola Quintessence&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 10, 2016 »  &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=62159&quot; rel=&quot;nofollow&quot;&gt;Subtraction based 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;, November 16, 2016&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:17:&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:17 --&gt;References&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextReferencesRule:107:&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=59845&quot; rel=&quot;nofollow&quot;&gt;SBAMG - Completing Hyperbola Quintessence&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 10, 2016&lt;/li&gt;
&lt;/ol&gt;&lt;!-- ws:end:WikiTextReferencesRule:107 --&gt;&lt;br /&gt;
&lt;!-- ws:start:WikiTextHeadingRule:19:&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:19 --&gt;What links here?&lt;/h1&gt;
 &lt;!-- ws:start:WikiTextIncludeRule:04:&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;SBAMG&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;SBAMG&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-SBAMG includeBody-SBAMG 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/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/Obstruction+Difference&quot; class=&quot;includeBacklinksLinkUrl&quot;&gt;Obstruction Difference&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/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/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/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;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;&lt;!-- ws:end:WikiTextIncludeRule:04 --&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>