Skip to content

Black ply not read when the move comes after a comment #13

@lluisalemanypuig

Description

@lluisalemanypuig

I'm trying to parse a 36-move game from the Gibraltar Battle of the Sexes 2022 (Round 1 - Game 1). I downloaded the PGN file from lichess. I'm using python 3.10 on Ubuntu 22.04 (fresh install).

Here's a small extract from the game I'm trying to parse

1. e4 { [%eval 0.25] [%clk 1:30:56] } 1... e5 { [%eval 0.12] [%clk 1:30:37] } 2. Nf3 { [%eval 0.28] [%clk 1:31:20] } 2... Nc6 { [%eval 0.25] [%clk 1:30:48] } 1/2-1/2

I'm reading the game as explained in the "tutorial"

game = parser.parse(game_str, actions = pgn.Actions())

and I'm trying to query information about the first move as explained

m1 = game.move(1)

As expected, the object m1 has the field white, that is, I can do

print(m1)
print(m1.white.san)
print(m1.white.comment)
print(m1.white.nags)

and I get the right information. But it does not seem to have the field black, that is, if I do

print(m1.black)
print(m1.black.san)
print(m1.black.comment)
print(m1.black.nags)

I only get blank lines. If I continue with move 2, the information I get for white is correct, and I still get blank lines for black.

Now, I think this is a bug because, if I remove the string "1..." and leave all the comments

1. e4 { [%eval 0.25] [%clk 1:30:56] } e5 { [%eval 0.12] [%clk 1:30:37] } 2. Nf3 { [%eval 0.28] [%clk 1:31:20] } 2... Nc6 { [%eval 0.25] [%clk 1:30:48] }  1/2-1/2

the output is correct for move 1 (for both black and white) but not for the second move. If I remove both strings "1..." and "2..."

1. e4 e5 { [%eval 0.12] [%clk 1:30:37] } 2. Nf3 Nc6 { [%eval 0.25] [%clk 1:30:48] } 1/2-1/2

then the output is correct for both moves (and both white and black).

Problem

I think the strings "1...", "2...", ... are causing severe interferences here.

Expected behavior

The strings "1...", "2..." are part of pgn files (I think) and should not cause the game to be parsed incorrectly. Parsing the game

1. e4 1... e5 2. Nf3 2... Nc6 1/2-1/2

should produce the same result as parsing

1. e4 e5 2. Nf3 Nc6 1/2-1/2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions