Chess variant pawn moves in pgn files

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Chess variant pawn moves in pgn files

Post by Evert »

My command-line match program currently produces .pgn files in the simplest way possible. For a test game (with variant Spartan) the result looks like this:

Code: Select all

[Event "Computer Match"]
[Site "unknown"]
[Date ""]
[Round "1"]
[White "Sjaak 478M"]
[Black "Leonidas 50"]
[Result "0-1"]
[TimeControl "40/0:05+0"]
[Variant "spartan"]
[FEN "lgkcckwl/hhhhhhhh/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ -"]

1. Nc3 Lc6 2.  d4  bd5 3.  e4 dxd4 4. Qxd4 Wf6 5.  e5  d5 6. Qf4 Wh5 7. Qd2  e6 
8. Nxd5 exe5 9. Nb4 Le4 10. Ne2  f5 11. Ng3 Wf6 12. Nxe4 Wxe4 13.  a3 Wxd2 
14. Bxd2 Lf6 15. O-O-O Ld4 16.  f4 Ce6 17.  g4  e4 18. fxe5 Le3 19. Bxe3 exe3 
20. Nd3 Gb5 21.  b4 Cxe5 22. Bh3 Cd6 23. Rhf1 Ke8 24.  a4 Gd5 25. Bg2 Ge6 
26.  h4  ef6 27.  g5 Cf5 28. Nc5 Ge5 29. gxf6 Cfxf6 30. Rf3 Cfe6 31. Bh3  f6 
32. Rxd6 Cxd6 33. Nd3 Ge4 34. Rf1 Kb8 35. Nc5 Gxh4 36. Rf3  f2 37. Rxf2 Gxh3 
38. Rd2 Ke7 39. Rd3 Gh5 40. Rd1  ce5 41. Rd3  g5 42.  c3  h4 43.  b5  f4 
44. Re3 Kf7 45. Nd3 Gg5 46. Re4  fg3 47. Re5 Gg4 48. Re2 Gc4 49. Rf2 Gxc3 
50. Kb1 Kf6 51. Nb2  c5 52. Rc2 Gxc2 53. Kxc2  f2 54. Nd3  2g1W 55. Kb1 Wd4 
56. Ka2  g3 57. Nb4  f2 58. Na6 Kc8 59. Nxc5 Wxc5 60. Kb1  2e1W 61.  a5 Wcd3 
62. Ka2 Wc3 63. Kb3 Wdxb5 64. Kc2 Wbd4 65. Kd3 Cd5 66. Kc4 Wa2 
0-1
When I try to load the resulting file in XBoard, I get an "Invalid move: 2. ... bd5" error. If I enter the sequence of moves manually, it becomes clear than XBoard expects "2. ... Hbd5", so including the piece-character for the Hoplite.

Is this really the correct behaviour, or have I found a bug? The logic behind not printing the initial "H" is that the Hoplite is the pawn replacement, and therefore by analogy it doesn't get the initial.
User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant pawn moves in pgn files

Post by hgm »

Well, according to WinBoard a Hoplite is not a Pawn, but a Lance, so it does not make the exception for it in SAN that it makes for Pawns.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Chess variant pawn moves in pgn files

Post by Evert »

Hmm... I see.

To me it sounds debatable whether that is correct or not (the example game on the Spartan Chess website has no H prefix for hoplites, treating them as pawns), but it also sounds like something that is a fairly fundamental part of how XBoard works and not so easy to change (for this specific case or in general).

I'll see about making a work-around (probably post-processing the PGN file to add in the H prefix for hoplites). Does this affect other variants with exotic pawns (only Berolina in practice, I guess)?
User avatar
hgm
Posts: 27701
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Chess variant pawn moves in pgn files

Post by hgm »

No, in Berolina the Pawns are represented by normal Pawns. As are Xiangqi and Shogi Pawns. For Spartan Chess I thought this a bit confusing, though, because the Hoplites move differently from the FIDE Pawns. So I wanted them to have different representation.