UTIL: PGN Translator already written?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

UTIL: PGN Translator already written?

Post by Dann Corbit »

The latest SSDF games come with a weird mish-mash of nomenclature in them. They start off with English PGN, but then switch off to a jumble of Swedish (I assume) piece notation but it's an odd format that I don't remember seeing before. For example, OOO is obviously long castle, but not in any standards based format that I am familiar with.

Is there (already written, I am not asking anyone to write this for me) a utility that will convert stuff like "Sf6xe4 Le2f3 d6d5" into standard PGN?

Part of a sample game:

Code: Select all

[Event "SSDF"]
[Site "TONY-DATOR"]
[Date "2018.05.20"]
[Round "1"]
[White "Stockfish 8 x64 Q6600"]
[Black "Stockfish 9 x64 1800X"]
[Result "1/2-1/2"]
[ECO "B47"]
[PlyCount "229"]
[EventDate "2018.??.??"]
[TimeControl "40/7200:40/7200:40/7200"]

1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nc6 5. Nc3 d6 6. Be3 Bd7 7. g4 {[%eval
48,30] (g2g4 a7a6 h2h4 h7h6 f2f4 Ta8c8 Sd4xc6 Tc8xc6 Dd1d3 Sg8f6 Lf1e2 Tc6xc3
b2xc3 Sf6xe4 Le2f3 d6d5 Lf3xe4 d5xe4 Dd3d4 Ld7c6 Dd4xd8+ Ke8xd8 c3c4 Kd8c7
Ta1b1 Lf8e7 Le3b6+ Kc7c8 Ke1e2 Lc6a4 Ke2d2 e4e3+ Kd2d3 e3e2 Kd3xe2 La4xc2) 388}
a6 8. h4 {[%eval 49,31] (h2h4 Sg8e7 a2a3 Sc6xd4 Dd1xd4 Se7c6 Dd4d1 b7b5 g4g5
h7h6 g5xh6 g7xh6 Th1g1 Dd8xh4 Dd1e2 Ta8c8 OOO Sc6e5 f2f4 Se5c4 Kc1b1 h6h5
Le3d4 e6e5 f4xe5 Ld7g4 Tg1xg4 Dh4xg4 e5xd6 Dg4xe2 Lf1xe2 Th8h6 e4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 {[%eval 37,
33] (Dd1d2 Sc6xd4 Le3xd4 a6a5 f2f4 Sc8e7 b2b3 b5b4 a3xb4 a5xb4 Sc3a4 Se7c6
Ld4e3 e6e5 f4f5 Lf8e7 OOO Sc6d4 Le3xd4 e5xd4 g4g5 Dd8a5 Dd2xd4 h6xg5 Dd4xg7
Da5e5 Dg7xe5 d6xe5 h4xg5 Th8xh1 Td1xh1 Le7xg5+ Kc1b1 Ke8e7 Th1h7 Ld7c6 Le2c4
Tb8f8 Sa4c5 Ke7d6) 187} N8e7 14. f4 {[%eval 56,31] (f2f4 Sc6xd4 Le3xd4 a6a5
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: UTIL: PGN Translator already written?

Post by Dann Corbit »

On second glance, I may already be OK with my existing parser.
It appears that the unusual notation is contained in the comments.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
hgm
Posts: 27793
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UTIL: PGN Translator already written?

Post by hgm »

Looks like German (but it could be that Swedish is the same).

WinBoard has an option -pieceNickNames that can be used to define a set of alternative IDs during SAN or FEN parsing. E.g. specifying -pieceNickNames ".SLTD..sltd." would make it recognize S as Knight, L as Bishop, etc. It would still recognize the usual piece IDs, as long these are not eclipsed by any of the nick-names.

I use this in Xiangqi, where the official WXF standard is Horse = H and Elephant = E, but where one often encounters games that use Elephant = B and Horse = N.