- Square wksq = pos.king_square(strongSide);
- Square bksq = pos.king_square(weakSide);
- Square wrsq = pos.list<ROOK>(strongSide)[0];
- Square wpsq = pos.list<PAWN>(strongSide)[0];
- Square brsq = pos.list<ROOK>(weakSide)[0];
-
- // Orient the board in such a way that the stronger side is white, and the
- // pawn is on the left half of the board.
- if (strongSide == BLACK)
- {
- wksq = ~wksq;
- wrsq = ~wrsq;
- wpsq = ~wpsq;
- bksq = ~bksq;
- brsq = ~brsq;
- }
-
- if (file_of(wpsq) > FILE_D)
- {
- wksq = mirror(wksq);
- wrsq = mirror(wrsq);
- wpsq = mirror(wpsq);
- bksq = mirror(bksq);
- brsq = mirror(brsq);
- }
+ // Assume strongSide is white and the pawn is on files A-D
+ Square wksq = normalize(pos, strongSide, pos.king_square(strongSide));
+ Square bksq = normalize(pos, strongSide, pos.king_square(weakSide));
+ Square wrsq = normalize(pos, strongSide, pos.list<ROOK>(strongSide)[0]);
+ Square wpsq = normalize(pos, strongSide, pos.list<PAWN>(strongSide)[0]);
+ Square brsq = normalize(pos, strongSide, pos.list<ROOK>(weakSide)[0]);