Changes

Jump to: navigation, search

Squares

4,957 bytes added, 10:07, 9 May 2018
Created page with "'''Home * Chess * Squares''' border|right|thumb| [[Arts#Mondrian|Piet Mondrian - Tableau I <ref>Arts#Mondrian|Pi..."
'''[[Main Page|Home]] * [[Chess]] * Squares'''

[[FILE:Tableau I, by Piet Mondriaan.jpg|border|right|thumb|
[[Arts#Mondrian|Piet Mondrian]] - Tableau I <ref>[[Arts#Mondrian|Piet Mondrian]] - [https://commons.wikimedia.org/wiki/File:Tableau_I,_by_Piet_Mondriaan.jpg Tableau I], 1921, [https://en.wikipedia.org/wiki/Gemeentemuseum_Den_Haag Gemeentemuseum Den Haag]</ref>]]

A '''Square''' in chess is one of 64 elements of a [[Chessboard|chessboard]], which might be empty or [[Occupancy|occupied]] by a chess [[Pieces|man]]. '''Square centric''' [[Board Representation|representations]], like [[Mailbox|mailbox]] or [[0x88]] board [[Array|arrays]], contain [[Pieces#PieceCoding|piece codes]], the information, what piece, if any, resides on a particular square. The '''piece centric''' [[Bitboards|bitboard]], as array of 64 bits, represent a boolean property of each square by a single bit.

Depending on the underlying data structure of the [[Board Representation|board representation]], each square has an [https://en.wikipedia.org/wiki/Memory_address address] inside the [[Chessboard|board]]. Square centric representations keep arrays of squares, containing the information which piece (if any) resides on each square. That is why these representation is often called [[Mailbox|mailbox]] approach, since each square has a associated mailbox which is either empty or contains a chess piece. To find the address of a certain square index in the a1..h8 aka 0..63 range sometimes requires additional computation or lookup, for instance to map coordinates for [[0x88]] boards or surrounded mailbox boards.

In [[Bitboards|bitboards]] the address of a square correspondents to a bit-index, containing a boolean property of that square (bit set), or not (bit clear). The [[Square Mapping Considerations|square mapping]] determines how bit-indices associate the squares on the [[Chessboard|board]].

=Square by Rank and File=
A Square, like a point inside a [https://en.wikipedia.org/wiki/Cartesian_coordinates cartesian coordinate system], can be determined by x- and y-coordinates, here the labels of [[Files|files]] and [[Ranks|ranks]]. Since each rank and file has eight squares, the mentioned rank-file mapping implies following formulas to determine the the square address:
<pre>
square = 8*rank + file;
square = (rank << 3) + file;
</pre>
with the obvious relation to calculate rank- and file-indices from the square index:
<pre>
rank = square >> 3; // div 8
file = square & 7; // modulo 8
</pre>
<span id="Algebraic"></span>
=Algebraic Square Notation=
In [[Algebraic chess notation]] a [[Target Square|target square]] of a [[Moves|move]] is specified by two characters for its [https://en.wikipedia.org/wiki/Cartesian_coordinates cartesian coordinate], per convention a letter for the [[Files|file]] ('a'-'h'), followed by a digit for the [[Ranks|rank]] number ('1'-'8').

=Square Definition=
A typical [[Little-endian|little-endian]] rank-file mapping enumeration in [[Cpp|C++]]:
<pre>
enum enumSquare {
a1, b1, c1, d1, e1, f1, g1, h1,
a2, b2, c2, d2, e2, f2, g2, h2,
a3, b3, c3, d3, e3, f3, g3, h3,
a4, b4, c4, d4, e4, f4, g4, h4,
a5, b5, c5, d5, e5, f5, g5, h5,
a6, b6, c6, d6, e6, f6, g6, h6,
a7, b7, c7, d7, e7, f7, g7, h7,
a8, b8, c8, d8, e8, f8, g8, h8
};
</pre>

=Square Properties=
* [[Center Distance]]
* [[Center Manhattan-Distance]]
* [[Color of a Square]]
* [[Occupancy]]
* [[Square Attacked By]]
* [[Square Control]]

=Multiple Squares=
==Lines==
* [[Ranks]]
* [[Files]]
* [[Diagonals]]
* [[Anti-Diagonals]]
* [[Rays]] as subset of Lines
* [[On an empty Board#LineAttacks|Line-masks]] from [[Bitboards]]
==Two squares==
Often, but not always related to a [[Moves|move]]
* [[Origin Square]]
* [[Target Square]]
* [[Distance]]
* [[Manhattan-Distance]]
* [[Knight-Distance]]
* [[Direction]]
* [[0x88#SquareRelations|0x88 Square Relations]]
* [[Square Attacked By#InBetween|In Between]]
* [[Intersection Squares]]
* [[Butterfly Boards]]
==Areas==
* [[Center]]
* [[Wings]]

==The whole Board==
Lists, Arrays and Sets of Squares
* [[Chessboard]]
* [[Board Representation]]
: [[Mailbox]]
: [[0x88|0x88 Board Representation]]
: [[Bitboards]]
** [[Flipping Mirroring and Rotating]]
** [[Square Mapping Considerations]]
** [[King Pattern#SetwiseRuleoftheSquare|Setwise Rule of the Square]]
: [[Quad-Bitboards]]

=Pawn Squares=
* [[En passant]]
: [[Forsyth-Edwards Notation#Enpassanttargetsquare|En passant target square]] inside the [[Forsyth-Edwards Notation]]
* [[Promotion Square]]
* [[Stop Square]]
* [[Pawn Spans#StopandDistantStop|Stop and Telestop]]

=See also=
* [[Corresponding Squares]]

=External Links=
* [https://en.wikipedia.org/wiki/Square Square from Wikipedia]
* [https://en.wikipedia.org/wiki/Magic_square Magic square from Wikipedia]
* [http://www.chess.com/article/view/the-eulers-8x8-magic-square The Euler's 8x8 magic square - Chess.com]

=References=
<references />

'''[[Chess|Up one Level]]'''

Navigation menu