Symmetries in chess positions
Let's assign codes to the content of squares in a chess position in the following way:
empty | 0 | ||
white pawn | 1 | black pawn | -1 |
white knight | 2 | black knight | -2 |
white bishop | 3 | black bishop | -3 |
white rook | 4 | black rook | -4 |
white queen | 5 | black queen | -5 |
white king | 6 | black king | -6 |
Let's define function ' c ' which returns the code of the content of a square referenced in algebraic notation.
A position matrix is a 8 x 8 matrix which corresponds to a chess position in the following way:
We define the 8 x 8 mirror matrix:
Mirroring a position over the vertical axis can be done by multiplying it with the mirror matrix from the right side ( PM ), mirroring a position over the horizontal axis can be done by multiplying it with the mirror matrix from the left side ( MP ). Reversing piece colors in a position can be done by multiplying its matrix with the constant -1.
The evaluation of the same position from black's perspective :
Conjectures:
in any position:
in a position without castling rights:
in a position without castling rights and pawns:
The symmetry in (1) states that the value of a position from white's perspective if a certain side is to move is the same that of a position with reversed colors, mirrored over the horizontal axis in which the opposing side is to move from black's perspective. The practical benefit of this symmetry is that we only need store the evaluations of positions in our database assuming white's turn. If it is black's turn, we use this symmetry to infer the evaluation of the position by looking up the evaluation of the dual position in which white is to move ( and the evaluation of which we have in our database ):
The symmetry in (2) states that the evaluation is invariant under mirroring the board over the vertical axis except for the case when the position has at least one castling right.
Symmetries in (3) and (4) assume in addition to no castling rights that there are no pawns on the board. Under these circumstances mirroring over the horizontal axis (3) and transponation (4) ( mirroring over the main diagonal of the position matrix ) don't affect the evaluation of the position.
It can be shown that the symmetries under (2), (3) and (4) are independent. This means that none of three symmetry transformations can be performed by applying any combination of the other two. They also have the characteristic that applying them twice in a row is equal to the identitiy transformation ( leaves the position unchanged ).
Applying the transformations under (2), (3) and (4) in this order, each zero to one time generates the 8 possible symmetry transformations which can be reached by any combination of reflections over the vertical axis, the horizontal axis and the diagonals, and rotations of any integer multiple of 90 degrees ( we get the identity transformation when all are applied zero times ).
Explicitly stated these 8 distinct positions have the same evaluation if they have no castling rights and pawns: