https://www.chessprogramming.org/index.php?title=Pawn_Attacks_(Bitboards)&feed=atom&action=history
Pawn Attacks (Bitboards) - Revision history
2024-03-29T05:05:30Z
Revision history for this page on the wiki
MediaWiki 1.30.1
https://www.chessprogramming.org/index.php?title=Pawn_Attacks_(Bitboards)&diff=21458&oldid=prev
GerdIsenberg at 09:40, 26 September 2020
2020-09-26T09:40:11Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 09:40, 26 September 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l26" >Line 26:</td>
<td colspan="2" class="diff-lineno">Line 26:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Only intersection with the opponent pieces is required.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Only intersection with the opponent pieces is required.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>We may include a possible [[En passant|en passant]] target square.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>We may include a possible [[En passant|en passant]] target square.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=Pawns set-wise=  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=Pawns set-wise=  </div></td></tr>
</table>
GerdIsenberg
https://www.chessprogramming.org/index.php?title=Pawn_Attacks_(Bitboards)&diff=21457&oldid=prev
GerdIsenberg at 09:39, 26 September 2020
2020-09-26T09:39:56Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 09:39, 26 September 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l89" >Line 89:</td>
<td colspan="2" class="diff-lineno">Line 89:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>. . . . . . . .                                              . . . . . . . .  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>. . . . . . . .                                              . . . . . . . .  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><span id="PawnAttackMaps"></span></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><span id="PawnAttackMaps"></span></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Attack Maps==  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Attack Maps==  </div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l108" >Line 108:</td>
<td colspan="2" class="diff-lineno">Line 106:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Those attack maps are among other things useful to decide about [[Candidates (Bitboards)|candidates]] and [[Backward Pawns (Bitboards)|backward pawns]] .</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Those attack maps are among other things useful to decide about [[Candidates (Bitboards)|candidates]] and [[Backward Pawns (Bitboards)|backward pawns]] .</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"><span id="PawnCaptures"></span></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Captures==  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Captures==  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>As usual, capture targets are the intersection of attack-sets with opponent pieces. Except [[En passant|en passant]] captures of course. A reverse shift of disjoint direction-wise sets obtains the pawns which may capture.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>As usual, capture targets are the intersection of attack-sets with opponent pieces. Except [[En passant|en passant]] captures of course. A reverse shift of disjoint direction-wise sets obtains the pawns which may capture.</div></td></tr>
</table>
GerdIsenberg
https://www.chessprogramming.org/index.php?title=Pawn_Attacks_(Bitboards)&diff=15688&oldid=prev
GerdIsenberg at 23:12, 29 November 2019
2019-11-29T23:12:27Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 23:12, 29 November 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l25" >Line 25:</td>
<td colspan="2" class="diff-lineno">Line 25:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Captures==  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Captures==  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Only intersection with the opponent pieces is required.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Only intersection with the opponent pieces is required.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>We may include a possible en<del class="diffchange diffchange-inline">-</del>passant target square.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>We may include a possible <ins class="diffchange diffchange-inline">[[En passant|</ins>en passant<ins class="diffchange diffchange-inline">]] </ins>target square.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l110" >Line 110:</td>
<td colspan="2" class="diff-lineno">Line 110:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Captures==  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Captures==  </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>As usual, capture targets are the intersection of attack-sets with opponent pieces. Except [[en<del class="diffchange diffchange-inline">-</del>passant]] captures of course. A reverse shift of disjoint direction-wise sets obtains the pawns which may capture.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>As usual, capture targets are the intersection of attack-sets with opponent pieces. Except [[<ins class="diffchange diffchange-inline">En passant|</ins>en passant]] captures of course. A reverse shift of disjoint direction-wise sets obtains the pawns which may capture.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>To find the pawn set, which can actually capture, on the fly, we can start with the target squares as well:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>To find the pawn set, which can actually capture, on the fly, we can start with the target squares as well:</div></td></tr>
</table>
GerdIsenberg
https://www.chessprogramming.org/index.php?title=Pawn_Attacks_(Bitboards)&diff=13477&oldid=prev
GerdIsenberg at 08:16, 23 July 2019
2019-07-23T08:16:04Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 08:16, 23 July 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l6" >Line 6:</td>
<td colspan="2" class="diff-lineno">Line 6:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><span id="AttacksOfaSinglePawn"></span></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><span id="AttacksOfaSinglePawn"></span></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Attacks==  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>==Attacks==  </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>To get attacks, we use a lookup of pre-calculated pawn-<del class="diffchange diffchange-inline">atacks</del>, similar to knight- and king-attacks, except the need to consider color of the pawn.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>To get attacks, we use a lookup of pre-calculated pawn-<ins class="diffchange diffchange-inline">attacks</ins>, similar to knight- and king-attacks, except the need to consider color of the pawn.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>whitePawnAttacks = arrPawnAttacks[white][sqOfWhitePawn];</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>whitePawnAttacks = arrPawnAttacks[white][sqOfWhitePawn];</div></td></tr>
</table>
GerdIsenberg
https://www.chessprogramming.org/index.php?title=Pawn_Attacks_(Bitboards)&diff=13257&oldid=prev
GerdIsenberg at 18:02, 15 July 2019
2019-07-15T18:02:02Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 18:02, 15 July 2019</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''[[Main Page|Home]] * [[Board Representation]] * [[Bitboards]] * [[Pawn Pattern and Properties]] * Pawn Attacks'''</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''[[Main Page|Home]] * [[Board Representation]] * [[Bitboards]] * [[Pawn Pattern and Properties]] * Pawn Attacks'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>A pawn captures diagonally forward, and controls or attacks one (rook pawn) or two squares one step ahead in diagonal [[Direction|direction(s)]]. For white versus black pawns forward and backward are considered relative from either whites or blacks point of view.  </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>A pawn captures diagonally forward, and controls or <ins class="diffchange diffchange-inline">[[Attacks|</ins>attacks<ins class="diffchange diffchange-inline">]] </ins>one (rook pawn) or two squares one step ahead in diagonal [[Direction|direction(s)]]. For white versus black pawns forward and backward are considered relative from either whites or blacks point of view.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=Single Pawn=  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=Single Pawn=  </div></td></tr>
</table>
GerdIsenberg
https://www.chessprogramming.org/index.php?title=Pawn_Attacks_(Bitboards)&diff=1484&oldid=prev
GerdIsenberg: Created page with "'''Home * Board Representation * Bitboards * Pawn Pattern and Properties * Pawn Attacks''' A pawn captures diagonally forward, and controls or attac..."
2018-05-08T13:10:10Z
<p>Created page with "'''<a href="/Main_Page" title="Main Page">Home</a> * <a href="/Board_Representation" title="Board Representation">Board Representation</a> * <a href="/Bitboards" title="Bitboards">Bitboards</a> * <a href="/Pawn_Pattern_and_Properties" title="Pawn Pattern and Properties">Pawn Pattern and Properties</a> * Pawn Attacks''' A pawn captures diagonally forward, and controls or attac..."</p>
<p><b>New page</b></p><div>'''[[Main Page|Home]] * [[Board Representation]] * [[Bitboards]] * [[Pawn Pattern and Properties]] * Pawn Attacks'''<br />
<br />
A pawn captures diagonally forward, and controls or attacks one (rook pawn) or two squares one step ahead in diagonal [[Direction|direction(s)]]. For white versus black pawns forward and backward are considered relative from either whites or blacks point of view. <br />
<br />
=Single Pawn= <br />
<span id="AttacksOfaSinglePawn"></span><br />
==Attacks== <br />
To get attacks, we use a lookup of pre-calculated pawn-atacks, similar to knight- and king-attacks, except the need to consider color of the pawn.<br />
<pre><br />
whitePawnAttacks = arrPawnAttacks[white][sqOfWhitePawn];<br />
if ( whitePawnAttacks & pieceBB[black] ) -> pseudo legal captures possible<br />
</pre><br />
<br />
<pre><br />
arrPawnAttacks[white][d4]<br />
. . . . . . . .<br />
. . . . . . . .<br />
. . . . . . . .<br />
. . 1 . 1 . . .<br />
. . . . . . . .<br />
. . . . . . . .<br />
. . . . . . . .<br />
. . . . . . . .<br />
</pre><br />
==Captures== <br />
Only intersection with the opponent pieces is required.<br />
We may include a possible en-passant target square.<br />
<br />
<br />
=Pawns set-wise= <br />
Working in the '''bitboard centric''' world to determine attacks and properties set-wise.<br />
<span id="PawnAttacks"></span><br />
==Attacks== <br />
Generate all squares that are attacked by pawns of a color. It makes sense to keep disjoint sets for both attacking directions. For [[Move Generation|move geneneration]] purpose, disjoint east-west attacks has the advantage of unique source-target relation ship (+-7,9). After obtaining the direction-wise target-set a reverse shift is sufficient to get the source-set without further intersections and wrap issues.<br />
<br />
''The code snippets rely on [[General Setwise Operations#ShiftingBitboards|shifting bitboards]], specially by [[General Setwise Operations#OneStepOnly|one step only]].''<br />
<pre><br />
U64 wPawnEastAttacks(U64 wpawns) {return noEaOne(wpawns);}<br />
U64 wPawnWestAttacks(U64 wpawns) {return noWeOne(wpawns);}<br />
<br />
U64 bPawnEastAttacks(U64 bpawns) {return soEaOne(bpawns);}<br />
U64 bPawnWestAttacks(U64 bpawns) {return soWeOne(bpawns);}<br />
</pre><br />
A bit-wise boolean instruction to combine those disjoint sets:<br />
<pre><br />
U64 wPawnAnyAttacks(U64 wpawns) {<br />
return wPawnEastAttacks(wpawns) | wPawnWestAttacks(wpawns);<br />
}<br />
<br />
U64 wPawnDblAttacks(U64 wpawns) {<br />
return wPawnEastAttacks(wpawns) & wPawnWestAttacks(wpawns);<br />
}<br />
<br />
U64 wPawnSingleAttacks(U64 wpawns) {<br />
return wPawnEastAttacks(wpawns) ^ wPawnWestAttacks(wpawns);<br />
}<br />
</pre><br />
and similar for black.<br />
<br />
<pre><br />
white pawns white pawns << 9 & notAFile == wPawnEastAttacks<br />
. . . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . <br />
. . . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . <br />
. . . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . <br />
. . . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . <br />
. . . . . . . . h . . c . . . . . 1 1 1 1 1 1 1 . . . c . . . . <br />
. . c . . . . . . a b . d . f g . 1 1 1 1 1 1 1 . a b . d . f g <br />
a b . d . f g h . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . <br />
. . . . . . . . / . . . . . . . . 1 1 1 1 1 1 1 / . . . . . . . <br />
<br />
white pawns white pawns << 7 & notHFile == wPawnWestAttacks<br />
. . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . . <br />
. . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . . <br />
. . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . . <br />
. . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . . <br />
. . . . . . . . . c . . . . . . 1 1 1 1 1 1 1 . . c . . . . . . <br />
. . c . . . . . b . d . f g h . 1 1 1 1 1 1 1 . b . d . f g h . <br />
a b . d . f g h . . . . . . . a 1 1 1 1 1 1 1 . . . . . . . . . <br />
. . . . . . . . . . . . . . . \ 1 1 1 1 1 1 1 . . . . . . . . \ <br />
<br />
white pawns wPawnAnyAttacks<br />
. . . . . . . . . . . . . . . . <br />
. . . . . . . . . . . . . . . . <br />
. . . . . . . . . . . . . . . . <br />
. . . . . . . . . . . . . . . . <br />
. . . . . . . . . c . c . . . . <br />
. . c . . . . . b a 1 . 1 g 1 g <br />
a b . d . f g h . . . . . . . . <br />
. . . . . . . . . . . . . . . . <br />
</pre><br />
<br />
<br />
<span id="PawnAttackMaps"></span><br />
==Attack Maps== <br />
One idea to combine pawn-attacks is about safe squares or push-targets for white respectively black pawns. A kind if of set-wise static exchange evaluation - only considering pawn-attacks from both sides. A square is assumed safe, if the number of own pawn defends if greater or equal than opponent pawn attacks. That is true if the own side defends a square twice, or the opposite side has no attacks at all, or own side attacks once and opponent not twice.<br />
<pre><br />
U64 wSafePawnSquares(U64 wpawns, U64 bpawns) {<br />
U64 wPawnEastAttacks = wPawnEastAttacks (wpawns);<br />
U64 wPawnWestAttacks = wPawnWestAttacks (wpawns);<br />
U64 bPawnEastAttacks = bPawnEastAttacks (bpawns);<br />
U64 bPawnWestAttacks = bPawnWestAttacks (bpawns);<br />
U64 wPawnDblAttacks = wPawnEastAttacks & wPawnWestAttacks;<br />
U64 wPawnOddAttacks = wPawnEastAttacks ^ wPawnWestAttacks;<br />
U64 bPawnDblAttacks = bPawnEastAttacks & bPawnWestAttacks;<br />
U64 bPawnAnyAttacks = bPawnEastAttacks | bPawnWestAttacks;<br />
return wPawnDblAttacks |~bPawnAnyAttacks | (wPawnOddAttacks &~bPawnDblAttacks);<br />
}<br />
</pre><br />
Those attack maps are among other things useful to decide about [[Candidates (Bitboards)|candidates]] and [[Backward Pawns (Bitboards)|backward pawns]] .<br />
<br />
==Captures== <br />
As usual, capture targets are the intersection of attack-sets with opponent pieces. Except [[en-passant]] captures of course. A reverse shift of disjoint direction-wise sets obtains the pawns which may capture.<br />
<br />
To find the pawn set, which can actually capture, on the fly, we can start with the target squares as well:<br />
<pre><br />
U64 wPawnsAble2CaptureEast(U64 wpawns, U64 bpieces) {<br />
return wpawns & bPawnWestAttacks(bpieces);<br />
}<br />
<br />
U64 wPawnsAble2CaptureWest(U64 wpawns, U64 bpieces) {<br />
return wpawns & bPawnEastAttacks(bpieces);<br />
}<br />
<br />
U64 wPawnsAble2CaptureAny(U64 wpawns, U64 bpieces) {<br />
return wpawns & bPawnAnyAttacks(bpieces);<br />
}<br />
</pre><br />
<br />
'''[[Pawn Pattern and Properties|Up one Level]]'''</div>
GerdIsenberg