Files
OpenBench/UnitTests/example2.pgn
andrew 9f3fc1141f Improve robustness of PGN parsing
Attempts to ensure any malformed PGN comment, or missing comment, produces an {unknown} comment in the processed version, without eating away at the move list. Three example pgns are included in a new UnitTests folder for this.

The first two PGNs contain intentionally damaged results -- either by missing fields, having wrong formats for the fields, or just outright having no comment at all. The third PGN is from self-play with Weiss, as an example of a proper output
2024-05-26 13:56:56 -04:00

84 lines
4.3 KiB
Plaintext

[Event "?"]
[Site "?"]
[Date "2024.05.26"]
[Round "1"]
[White "Torch"]
[Black "Torch"]
[Result "1-0"]
[FEN "rnb1k1nr/pp1pbppp/8/q1p1p3/P4P2/R3PN2/1PPP2PP/1NBQKB1R w Kkq - 0 1"]
[GameDuration "00:00:04"]
[GameEndTime "2024-05-26T12:57:30.145 EDT"]
[GameStartTime "2024-05-26T12:57:25.472 EDT"]
[PlyCount "139"]
[SetUp "1"]
[TimeControl "inf"]
1. fxe5 {+4.23 12/16 42 39485} d5 {-4.15 12/17 43 38473}
2. Nc3 {+3.83 12/17 40 34560} Be6 {-4.30 13/22 39 36002}
3. Bb5+ {+4.18 14/14 38 38924} Nc6 {-4.35 14/18 37 34854}
4. e4 {+4.18 13/17 42 28288} dxe4 {-3.98 14/21 39 32608}
5. Nxe4 {+3.96 13/12 40 29723} Nh6 {-4.20 14/23 36 35760}
6. O-O {+4.28 12/17 41 35389} Qb6 {-4.26 12/17 41 35735}
7. Nd6+ {+3.50 12/17 42 37697} Bxd6 {-3.81 13/18 41 38274}
8. exd6 {+4.36 13/19 42 38645} O-O-O {-3.89 13/18 40 39048}
9. d4 {+4.69 14/17 36 39006} Nxd4 {-3.97 12/17 40 34214}
10. Nxd4 {+4.41 13/18 39 36786} cxd4 {-4.09 13/17 39 34846}
11. h3 {+4.22 12/17 43 17157} Nf5 {-3.41 13/13 41 34143}
12. d7+ {+4.43 14/17 43 33165} Kb8 {-3.91 13/20 40 39120}
13. Qd3 {+4.04 12/18 39 37958} Ne3 {-3.91 14/22 38 39962}
14. Bxe3 {+5.07 15/23 35 39261} dxe3 {-5.90 15/20 37 37377}
15. a5 {+5.32 13/20 38 39290} Qc7 {-5.13 13/20 37 31953}
16. Qxe3 {+5.68 14/17 36 34560} a6 {-5.93 13/20 38 35655}
17. Ba4 {+6.14 14/20 39 33272} Ka8 {-6.14 13/17 40 39677}
18. Rf4 {+5.60 14/19 43 39488} Rhg8 {-5.46 12/18 42 33699}
19. Rf1 {+4.60 13/14 43 31456} g5 {-4.41 14/20 42 36233}
20. Qb6 {+3.63 14/26 41 36607} Qxb6+ {-3.52 16/19 38 37826}
21. axb6 {+4.35 16/26 39 39192} Bxd7 {-4.17 15/23 38 38646}
22. Rxf7 {+4.37 14/19 35 39040} Bxa4 {-3.97 15/21 32 37259}
23. Rxa4 {+4.24 15/21 34 38881} Rd6 {-3.85 14/18 35 36911}
24. Rb4 {+3.71 15/21 32 39209} h6 {-3.72 13/20 33 34852}
25. c4 {+3.69 14/13 35 26237} Rd4 {-2.68 15/14 37 33902}
26. Rf6 {+2.39 13/13 35 39084} Kb8 {-2.26 13/18 36 37450}
27. Rb3 {+3.34 15/20 34 37710} Rxc4 {-2.93 15/20 38 37205}
28. Rxh6 {+5.84 15/15 35 36844} Rc6 {-2.19 16/17 37 37014}
29. Rxc6 {+7.27 16/18 34 33813} bxc6 {-2.19 14/26 37 35564}
30. Rg3 {+7.90 15/22 28 37624} Kb7 {-7.07 13/19 40 38243}
31. h4 {+8.10 15/17 32 33634} g4 {-7.38 14/15 33 37494}
32. Kh2 {+8.30 13/14 31 37907} a5 {-7.79 13/14 33 39481}
33. Rb3 {+8.78 14/19 29 36379} c5 {-8.02 13/13 32 38286}
34. Rb5 {+9.45 14/19 34 39981} Kc6 {-8.91 13/18 35 35241}
35. Rxa5 {+9.40 14/20 36 35616} Kxb6 {-9.75 12/15 33 36732}
36. Ra1 {+9.80 15/18 33 39301} g3+ {-10.15 12/18 34 30587}
37. Kh3 {+10.06 15/17 34 33600} Kc6 {-10.70 13/12 36 35603}
38. Rc1 {+10.72 15/16 32 36443} Kd5 {-10.75 13/19 34 39733}
39. b3 {+11.46 14/13 30 33084} Re8 {-11.41 12/15 32 35252}
40. Rd1+ {+12.66 15/13 32 35486} Kc6 {-12.90 13/16 35 36189}
41. Rd3 {+13.29 13/14 31 36697} Re2 {-12.98 11/15 33 33955}
42. Kxg3 {+13.85 14/15 32 32920} Kb5 {-13.77 13/16 36 36298}
43. h5 {+14.23 14/13 32 34421} Kb4 {-14.47 11/17 32 36183}
44. Kh2 {+15.02 13/18 28 32803} Re8 {-14.66 11/12 32 37600}
45. Rh3 {+15.39 15/19 29 35793} c4 {-15.29 12/19 35 36843}
46. bxc4 {+15.80 14/19 29 37057} Kxc4 {-15.35 15/20 31 36507}
47. g4 {+16.17 13/13 26 35516} Kd5 {-15.76 11/12 32 33904}
48. Rf3 {+16.60 13/14 29 32251} Ke4 {-16.43 12/14 31 35541}
49. Kg3 {+16.95 12/15 27 28203} Re6 {-16.96 12/14 31 35219}
50. Rf5 {+18.09 14/15 22 32595} Rh6 {-18.03 11/14 30 20617}
51. Kh4 {+18.99 13/14 20 39864} Rh7 {-18.99 11/17 25 29705}
52. Rf1 {+19.70 12/15 21 39612} Rh8 {-19.75 10/12 24 37115}
53. g5 {+21.12 12/15 31 25717} Kd3 {-21.16 12/15 31 31037}
54. h6 {+21.65 13/17 30 39824} Re8 {-21.76 11/14 30 25120}
55. h7 {+22.79 12/14 30 35242} Ke2 {-22.47 12/14 31 18311}
56. Rf6 {+23.44 12/13 28 24765} Rb8 {-23.70 13/18 33 37862}
57. g6 {+25.41 13/18 34 23189} Rb1 {-24.83 13/16 33 38798}
58. Kg5 {+26.55 12/17 31 29398} Rh1 {-25.17 11/13 36 5389}
59. Rf4 {+27.35 13/21 33 30750} Rg1+ {-27.39 14/17 36 33050}
60. Rg4 {+28.67 13/19 34 32747} Rh1 {-29.83 14/14 35 34343}
61. Rh4 {+28.79 13/17 29 33671} Rg1+ {-29.30 13/17 30 33229}
62. Kh6 {+32.81 12/16 31 26657} Kf2 {-29.33 13/8 34 35604}
63. Rh5 {+36.19 12/14 33 28525} Ke2 {-36.84 12/16 33 27852}
64. g7 {+38.23 12/18 33 39867} Rxg7 {-37.88 12/12 34 24254}
65. Kxg7 {+40.41 14/19 26 29276} Kd3 {-44.12 14/17 27 31734}
66. Kg8 {+49.68 14/22 21 35430} Kc2 {-52.79 15/21 17 27360}
67. Rh3 {+M9 22/10 20 38234} Kc1 {-M50 12/17 6 39103} 68. Rh2 {+M5 30/6 6 37836}
Kb1 {-M4 96/5 9 36036} 69. h8=Q {+M3 96/4 10 35602} Kc1
70. Qa1# {+M1 96/2 3 2516, White mates} 1-0