Closed ajax333221 closed 3 years ago
Ic.initBoard({fen : "8/4K3/8/1Rp1k3/4p3/2q2b2/Q7/8 w - - 2 90", pgn : "90. Rb6"})
x
Ic.initBoard({fen : "8/4K3/8/1Rp1k3/4p3/2q2b2/Q7/8 w - - 2 90", pgn : "1. Rb6"})
✓
it appears that the recent bug-fix of #15 broke something here.
Upon investigation, I noticed cleanSan()
was only keeping digits 1-8 (square ranks), 0-2 (match results 1-0, 1/2-1/2, etc), 0 (unconventional allowed castling 0-0-0, 0-0)... so basically 0-8
without the 9.
Our parser doesn't complain with missing move numbers (so having some or all digits in the move number to the left of the SAN was not a problem), however, some bug (#15) was making a regexp match 0-0-0 and 0-0 and it was patched with the solution of doing a regexp match (1-9 and (0-9 zero or more)).
Now the interesting part comes: because the 9s were removed, the move number 90 turned into a 0 (which was not being matched to comply with the castling zeroes patch), so attempting to parse any game with move number 90 (or 900, 9000, etc) would try to play a SAN move of "0"
(or "00"
, "000"
, etc) and miserably fail.
[FEN "8/4K3/8/1Rp1k3/4p3/2q2b2/Q7/8 w - - 2 90"]
90. Rb6 Kf4 91. Qh2+ Ke3 92. Qg1+ Kd2 93. Qf2+ Kc1 94. Qg1+ Kd2 95. Qf2+ Kc1 96. Qg1+ Kd2 1/2-1/2
This PGN worked in v6.5.1 but is now failing to be parsed in the current version v6.6.3.