A Square in chess is one of 64 elements of a chessboard, which might be empty or occupied by a chess man. Square centricrepresentations, like mailbox or 0x88 board arrays, contain piece codes, the information, what piece, if any, resides on a particular square. The piece centricbitboard, 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, each square has an address inside the 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 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 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 determines how bit-indices associate the squares on the board.

A Square, like a point inside a cartesian coordinate system, can be determined by x- and y-coordinates, here the labels of files and ranks. Since each rank and file has eight squares, the mentioned rank-file mapping implies following formulas to determine the the square address:

Home * Chess * SquaresSquarein chess is one of 64 elements of a chessboard, which might be empty or occupied by a chess man.Square centricrepresentations, like mailbox or 0x88 board arrays, contain piece codes, the information, what piece, if any, resides on a particular square. Thepiece centricbitboard, 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, each square has an address inside the 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 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 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 determines how bit-indices associate the squares on the board.

^{[1]}## Table of Contents

## Square by Rank and File

A Square, like a point inside a cartesian coordinate system, can be determined by x- and y-coordinates, here the labels of files and ranks. Since each rank and file has eight squares, the mentioned rank-file mapping implies following formulas to determine the the square address:with the obvious relation to calculate rank- and file-indices from the square index:

## Algebraic Square Notation

In Algebraic chess notation a target square of a move is specified by two characters for its cartesian coordinate, per convention a letter for the file ('a'-'h'), followed by a digit for the rank number ('1'-'8').## Square Definition

A typical little-endian rank-file mapping enumeration in C++:## Square Properties

## Multiple Squares

## Lines

## Two squares

Often, but not always related to a move## Areas

## The whole Board

Lists, Arrays and Sets of SquaresMailbox

0x88 Board Representation

Bitboards

- Flipping Mirroring and Rotating
- Square Mapping Considerations
- Setwise Rule of the Square

Quad-Bitboards## Pawn Squares

En passant target square inside the Forsyth-Edwards Notation

## See also

## External Links

## References

## What links here?

Up one Level