On 6/29/24 22:25, Greg Marks wrote:
After upgrading Scid to version 4.7.4, I find that Scid won't properly
load PGN files that contain the "Black crushing" symbol.  A minimal
example:

$cat test.pgn

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "0-1"]

1.e4 e5 2.f3?! Bc5 3.g4?? --+ Qh4+ 0-1

$scid test.pgn

After Scid loads, an error window opens, reading:

    (game 1, line 9) Failed to parse the move: Qh4+
    (game 1, line 9) End of game, ignoring the part after the last error.

I got the same result in version 5.0.2.

The display in the PGN window of Scid reads:

    ? -- ?
    ? ???? 0-1

    1.e4 e5 2.f3?! Bc5 3.g4?? -- 0-1

(Note the deletion of everything after the --+ symbol.)

Scid is interpreting '--' as a null move and thinks the next move is
4.Qh4+ (for white), which is illegal. As with any parsing error, it
ignores the rest of the game.

I haven't
encountered a similar problem with any of the other annotation symbols,
so for example, after running:

$sed -i 's/--+/-+/g' test.pgn

the file opens just fine in Scid.  I'd rather not have to do this on
every single PGN file, though.

Is there some simple edit ...

Unfortunately, no, it won't be a simple edit.
The changes to Scid were extensive and it's hard to say where the
breaking change was made.

~/Downloads/scid-4.5.2/src
$ grep -inF "isnullmove" *.h *.cpp
game.h:157:isNullMove (moveT * m)
game.h:159:    return isNullMove(&(m->moveData));
movelist.h:51:inline bool isNullMove (simpleMoveT * sm)
game.cpp:2311:            IsPlainFormat()  &&  isNullMove(m)) {
game.cpp:2350:        if (isNullMove(m)) {
game.cpp:2547:                    if (isNullMove(m->next)  &&
position.cpp:1864:    if (isNullMove(sm)) {
position.cpp:2007:    if (isNullMove(m)) {
position.cpp:2193:        if (isNullMove(m)) {
$

~/Downloads/scid-4.7.4/src
$ grep -inF "isnullmove" *.h *.cpp
movelist.h:50:  bool isNullMove() const {
movetree.h:89:  bool isNull() const { return moveData.isNullMove(); }
game.cpp:846:           if (move->moveData.isNullMove()) {
position.cpp:1433:      if (sm.isNullMove() || sm.isCastle()) {
position.cpp:1489:      if (sm.isNullMove())
position.cpp:1590:    if (m->isNullMove()) {
position.cpp:1772:        if (m->isNullMove()) {
$

... to, say, a TCL file in the directory
/usr/share/scid/tcl/tools/ that might fix this?  If it's relevant,
I do notice that the file analysis.tcl contains a comment:

# Nags. Note the slight inconsistency for the "crushing" symbol (see game.cpp)

The inconsistency is in analysis.tcl, where the previous line has "++-"
for crushing, whereas the following line has "+--".

which doesn't make sense to me, as the file game.cpp doesn't exist
anywhere.

You can find the .h and .cpp files in the sources.
https://sourceforge.net/projects/scid/files/Scid/Scid%204.7/
download <= scid-code-4.7.4.zip

In scid-4.7.4/src/game.cpp look at lines 191-203. These lines were
unchanged from 4.5.2 which is why I think the problem lies elsewhere.

if (*str == '-') {
    // Must be "-+", "-/+" or "--+", "->":
    str++;
    if (*str == '+') { return NAG_BlackDecisive; }     // -+     $19
    if (*str == '>') { return NAG_WithBlackAttack; }   // ->     $41
    if (*str == '/'  &&  str[1] == '+') {              // -/+    $17
       return NAG_BlackClear; }
    if (*str == '-'  &&  str[1] == '+') {              // --+    $21
       return NAG_BlackCrushing; }
    if (*str == '-'  &&  str[1] == 0) {                // --     $210
       return NAG_See; }
    return 0;
}


Best regards,
Greg Marks

--
Alan


_______________________________________________
Scid-users mailing list
Scid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scid-users

Reply via email to