Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comment get attached to wrong node when it precedes the move #123

Open
toomasr opened this issue Jun 17, 2023 · 4 comments
Open

comment get attached to wrong node when it precedes the move #123

toomasr opened this issue Jun 17, 2023 · 4 comments

Comments

@toomasr
Copy link

toomasr commented Jun 17, 2023

I noticed that sometimes the comments felt out of place. I tracked this down to comments preceding the move property. I couldn't figure out a fix though. I hope the test case helps.

test("test for comments being attached to right nodes", () => {
    let sgfStr = "(;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2] RU[Japanese]SZ[19]KM[0.00]PW[White]PB[Black];W[aa]C[Comment after move property];W[pd])";
    let goban = new TestGoban({ original_sgf: sgfStr, removed: "",  });

    goban.engine.jumpToOfficialMoveNumber(0);
    
    expect(goban.engine.cur_move.text).toMatch("");
    goban.engine.showNext();
    expect(goban.engine.cur_move.text).toMatch("Comment after move property");
    
    // now let's have the comment before the move property
    sgfStr = "(;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2] RU[Japanese]SZ[19]KM[0.00]PW[White]PB[Black];C[Comment before move property]W[aa];W[pd]C[second comment])";

    goban = new TestGoban({ original_sgf: sgfStr, removed: "",  });
    goban.engine.jumpToOfficialMoveNumber(0);

    expect(goban.engine.cur_move.text).toMatch("");
    goban.engine.showNext();
    expect(goban.engine.cur_move.text).toMatch("Comment before move property");
    goban.engine.showNext();
    expect(goban.engine.cur_move.text).toMatch("Second comment");
});
@anoek
Copy link
Member

anoek commented Jun 17, 2023

Interesting, do you have an example game too by any chance?

@toomasr
Copy link
Author

toomasr commented Jun 18, 2023

I have many such files. Most of the problems I get from my teacher have this. I see the tool used is GoWrite.

@anoek
Copy link
Member

anoek commented Jun 18, 2023

If you can provide a link to an example game that would be very helpful, that way we have something we can start debugging from and validate works when a fix is released.

@toomasr
Copy link
Author

toomasr commented Jun 18, 2023

Here you go https://toomasr.com/problematic.sgf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants