2

This board shows the black pieces on the bottom, but the white pieces are supposed to be there; I accidentally set up the board so that white's pieces are on the black side. I am looking to flip the board with the following FEN:

# R2K1B1R/PPP2QPP/5N1N/1n2q3/8/1p3n2/pbpp3p/1kr4r w KQkq - 0 1

Board:

R2K1B1R/PPP2QPP/5N1N/1n2q3/8/1p3n2/pbpp3p/1kr4r w KQkq - 0 1

How may I accomplish this without re-setting the pieces manually? I tried switching the rows, but I got:

# 1kr4r/pbpp3p/1p3n2/8/1n2q3/5N1N/PPP2QPP/R2K1B1R w KQkq - 0 1

Board:

1kr4r/pbpp3p/1p3n2/8/1n2q3/5N1N/PPP2QPP/R2K1B1R w KQkq - 0 1
  • Unless you accidentally switch black and white pieces on a regular basis, this seems like a.problem which takes much longer to "automate" than to just solve it manually this one time. – TMM Oct 18 '17 at 13:04
  • Switch the rows and then switch the columns, or vice versa. – Wais Kamal May 21 '18 at 22:54
3

Although one may try to place the first row as the eighth, the second row as the seventh, etc., the board will appear flipped (as shown above).

This is a horizontal flip (mirror-image over the x-axis) and does not look quite right. Switching the letters from lower-case to capital and vice-versa would switch the colors, but that's not the best solution.

Upon closer examination, a vertical flip (or mirror over the y-axis) of this horizontal flip would solve the problem: Reverse each sub-string delimited by a slash until you hit the second field, then leave it as is.

The final product is the same FEN, except the first field is a reverse string of itself.

# r4rk1/p3ppbp/2n3p1/8/3q2n1/N1N5/PPQ2PPP/R1B1K2R w KQkq - 0 1

Board:

r4rk1/p3ppbp/2n3p1/8/3q2n1/N1N5/PPQ2PPP/R1B1K2R w KQkq - 0 1
| improve this answer | |
1

The free chess GUI Arena does what you are asking and many other useful things for creating or studying chess problems.

It works with epd files, fen strings and pgn databases.

| improve this answer | |
1

I disagree with Jossie's solution. If you follow that method, and flip the initial game board, you'd end up with queens on the wrong colors. Doing a vertical flip and switching the colors is the method I use.

Detailed efficient methods of performing these board flips (as well as rotations) can be found here.

UPDATE: As Jossie has since pointed out, his solution is correct for the question asked. My solution is for when you need to transform a board (oriented with white at the bottom and black at the top) in which it's black's turn, to one in the same orientation, but seen as if it was white's turn. An example of when you'd use my solution is converting a database of boards to one where they're all being represented with the same orientation, and same player to move.

| improve this answer | |
  • The queens are on the right colors (black queen on e1, white queen on e8). Doing a vertical flip (white queen is now on e1) and then switching the colors (black queen on e1) is exactly what my solution does. – Jossie Calderon May 20 '18 at 19:44
  • Ah, I see now that the question was not to change the board to one where it was the perspective of black's turn to the perspective of white's turn, but instead literally flip where the pieces are located. My solution is for making a board where it appears as blacks turn (with the pieces in the correct locations), to a board where it appears to be white's turn. – Sam Ragusa May 21 '18 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.