From Chessprogramming wiki
Sample Position
Original
|
Vertical Flip
|
Color Flip
|
♚ ♘♔ ♗
|
|
♘♔ ♗ ♚
|
|
♞♚ ♝ ♔
|
|
k7/8/NK2B3/8/8/8/8/8 w - -
|
8/8/8/8/8/NK2B3/8/k7 w - -
|
8/8/8/8/8/nk2b3/8/K7 b - -
|
Flipping an 8x8 Board
An 8x8 Board with a rank-file mapping, needs to perform an exclusive or with 56 (A8 in LERF) to vertically flip square coordinates. A pure 8x8 Board may be vertically flipped that way in C:
int board[64], sq, s, f;
for (sq = 0; sq < 32; ++sq) {
s = board[sq];
board[sq] = board[sq^56];
board[sq^56] = s;
}
See alsoExternal LinksReferences