6

My son and I are rank chess amateurs, and we wanted to play our first "real" game where we keep track of moves to analyze later. We started the game but then realized that the board was reversed (i.e. the black pieces were on rows 1 and 2). Since we didn't notice until a few moves had been played, we just continued to use this reversed notation for the whole game.

The resulting PGN file doesn't want to import into lichess. Is there any way to take our "reversed" PGN game file and make it compatible? Perhaps some automated way to reverse the notation, or alert the PGN importer that the notation is reversed so it can handle it?

5
  • How did you create the pgn file? May 26, 2020 at 14:47
  • 3
    By hand, in a text editor
    – Haydentech
    May 26, 2020 at 14:48
  • 6
    There is no automated way to do it because it's a really rare situation. People who type in PGN manually are usually experienced enough with chess to know the names of the squares without having to actually look at the board. You'll get there soon enough :-) May 26, 2020 at 15:30
  • 3
    Fun question. I teach intro to programming using Python sometimes. I might turn this question into a homework assignment in the future (with an extra credit part involving truly clueless players who start with the board rotated 90 or 270 degrees rather than the 180 degrees that you had). May 27, 2020 at 12:11
  • 1
    It's ok, one day you'll look back and laugh when you see that PGN with an e5 opening. ;)
    – J...
    May 27, 2020 at 12:12

2 Answers 2

11

If you set the board up correctly, i.e. "white on the right and queen on her own colour", then you need to flip the letters like this:

a ↔ h
b ↔ g
c ↔ f
d ↔ e
and the numbers like this:
1 ↔ 8
2 ↔ 7
3 ↔ 6
4 ↔ 5

So, if white's first move was to push the pawn in front of the king 2 squares you will have written "d5" or "d7-d5". Using the look-up above change this to "e4" or "e2-e4". Do the same for black's first move. If white's second move was to move the knight nearest the king to the square two in front of the bishop and you have written "Nc6" use the look-up to change this to "Nf3". Work through all the moves changing them according to the look-up.

If you are a programmer and the game is long it will probably be easier to write a simple program to do this.

3
  • I am a programmer, as it turns out. I was hoping there would be a simple setting I could put in the PGN file header, similar to the [StartFlipped "1"] setting, to do this for me, but apparently not.
    – Haydentech
    May 26, 2020 at 15:15
  • 7
    In the end, it was easier to do it by hand than try to program a solution. It worked, and we now have a working PGN file. Now to see all the blunders we made!
    – Haydentech
    May 26, 2020 at 18:30
  • 2
    2 relevant xkcd: first one and second one
    – pulsar512b
    May 28, 2020 at 0:46
14

Adding on to Brian Towers' answer, there is a quick way you can script this (assuming you are on Linux or another POSIX system with the tr command):

cat gamelog.txt | tr 'abcdefgh12345678' 'hgfedcba87654321' > gamelog_reversed.txt

Edit: as @wimi said, this will mess up move numbers, so be careful about that. You may want to use cut and paste to seperate only the columns with the moves.

3
  • 9
    Just to play devil's advocate: this will mess up the move numbers...
    – wimi
    May 27, 2020 at 7:18
  • 1
    Just to play dog's advocate: this is a useless (use of) cat.
    – YSC
    May 27, 2020 at 16:55
  • @wimi edited to add a note. May 28, 2020 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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