Changes

Jump to: navigation, search

Diagonal Mirroring

456 bytes added, 16:25, 6 March 2020
no edit summary
'''[[Main Page|Home]] * [[Chess]] * [[Chess Position|Position]] * Diagonal Mirroring'''
 
[[FILE:Hilma af Klint - Group IX SUW, The Swan No. 7 (13945).jpg|border|right|thumb| [[:Category:Hilma af Klint|Hilma af Klint]] - Group IX SUW, The Swan No. 7
<ref>[[:Category:Hilma af Klint|Hilma af Klint]] - [https://commons.wikimedia.org/wiki/File:Hilma_af_Klint_-_Group_IX_SUW,_The_Swan_No._7_(13945).jpg Group IX SUW, The Swan No. 7], 1915, [https://en.wikipedia.org/wiki/Wikimedia_Commons Wikimedia Commons]</ref> ]]
'''Diagonal mirroring''' mirrors all [[Pieces|pieces]] along the [[Diagonals|main diagonal]] or [[Anti-Diagonals|main anti-diagonal]]. It is applicable in pawn-less [[Endgame|endgames]] with [[Castling|castling]] no longer possible. Along with [[Horizontal Mirroring|horizontal]] and/or [[Vertical Flipping|vertical flipping]], diagonal mirroring is used in pawn-less [[Endgame Tablebases|endgame tablebases]] to restrict a white king to the 10 squares of the a1-d4-d1 triangle of the board.
 
=Mirroring an 8x8 Board=
An [[8x8 Board]] with a [[Squares|rank-file mapping]] needs to swap [[Ranks|rank]] and [[Files|file]]. A pure 8x8 Board may be mirrored along the main diagonal that way in [[C]]:
<pre>
int board[64], f, r, sm, sq, s;
 
for (f = 1; f < 8; ++f)
for (r = 0; r < f; ++r)
{
sq = 8*r + f;
sm = 8*f + r;
s = board[sq];
board[sq] = board[sm];
board[sm] = s;
}
</pre>
=Sample Position=
| k1N5/2K5/8/8/2B5/8/8/8 w - -
|}
 
=Mirroring an 8x8 Board=
An [[8x8 Board]] with a [[Squares|rank-file mapping]] needs to swap [[Ranks|rank]] and [[Files|file]]. A pure 8x8 Board may be mirrored along the main diagonal that way in [[C]]:
<pre>
int board[64], f, r, sm, sq, s;
 
for (f = 1; f < 8; ++f)
for (r = 0; r < f; ++r)
{
sq = 8*r + f;
sm = 8*f + r;
s = board[sq];
board[sq] = board[sm];
board[sm] = s;
}
</pre>
=See also=
'''[[Chess Position|Up one Level]]'''
[[Category:Hilma af Klint]]

Navigation menu