Giter Site home page Giter Site logo

Parsing bad(?) sgf about sgfparser HOT 7 CLOSED

trevoke avatar trevoke commented on June 6, 2024
Parsing bad(?) sgf

from sgfparser.

Comments (7)

Trevoke avatar Trevoke commented on June 6, 2024

Hi, I'm glad you're using it and you're happy with it!

Hmm, interesting. When I built this gem I assumed that AB/AW was to be a unique property that took a list of stones. If I'm right, then goproblems is using an invalid format by having many of these.. But that doesn't solve your problem. Thanks for bringing this to my attention. The SGF Standard is actually silent on this point.

I will ask the SGF people about whether goproblems.com is doing something correct or not (for my own edification), and then fix that problem anyway.

from sgfparser.

jphager2 avatar jphager2 commented on June 6, 2024

Yeah. Im just wondering if it has something to do with how goproblems lets you add problems (through a flash application) which might generate this strange syntax. I assume most sgf editors are designed to output correct sgf

from sgfparser.

Trevoke avatar Trevoke commented on June 6, 2024

Do all the problems on goproblems have this issue? Do you have, by chance,
an example of one that doesn't have it?

On Sat, Mar 15, 2014 at 1:57 PM, John Hager [email protected]:

Yeah. Im just wondering if it has something to do with how goproblems lets
you add problems (through a flash application) which might generate this
strange syntax. I assume most sgf editors are designed to output correct sgf


Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-37732902
.

from sgfparser.

jphager2 avatar jphager2 commented on June 6, 2024

Yeah this is problem 1000:

GM[1]FF[4]VW[]AP[Many Faces of Go:10.0]
SZ[13]
HA[0]
ST[1]
DT[2001-08-13]
KM[0.0]
RU[GOE]

AB[lb][lc][ld][kc][jb][ka][ck][dg][ei][fb][fc][fd][ee][db][cd][ej][fk][fl][fh][eg][fg][lj][kk][jj][ij][md][lf][gm][fm][gc]

AW[ib][jc][kd][jd][le][jf][hc][fi][gb][gd][fe][ff][ia][fj][gl][gk][gh][gg][jk][kg][lh][kl][ll][ik][me][ke][hm][hl]

C[After the previous problem, Black has played at 1 rather than
protecting his corner. How can white punish him?
]
PL[W]LB[gc:A]

(;W[mb](;B[ma]
%28;W[la];B[ge];W[ma];B[mc];W[ja];B[ma];W[kb]
C[White has given up too much when black plays A
]LB[ge:A]
%29
%28;W[ja];B[kb];W[la]
C[RIGHT
]%29)
(;B[ja];W[la]))
(;W[ja];B[mb]
C[Black is unconditionally alive.
])
(;W[ge];B[ja]
C[Black has had another chance to repair his defect.
]))

from sgfparser.

Trevoke avatar Trevoke commented on June 6, 2024

I got a response from the SGF folks. I'm quoting it here.

in a correct SGF file every property appears at most once in a single node. Nowadays bad SGF files are rare (goproblems is apparently an exception). But if you want to write a resilient parser, then maybe should take duplicate properties into account. Like Postel's law: be conservative in what you do, be liberal in what you accept from others.

Reading malformed SGF files is ok, although it could get us into trouble in the long term. But the internal representation (if accessible through an API) or the output should be correct SGF. Check files with sgfc, it is my reference implementation of the SGF standard.

I've been busy as well and haven't had time to work on this, but clearly some of these goproblems are malformed. I will have to do some work to handle that, which probably means adding in some kind of notifications for the user, like an array of errors or something.

from sgfparser.

Trevoke avatar Trevoke commented on June 6, 2024

I just pushed a fix to github ( d99b575 ), it's not deployed to rubygems yet. Can you try it from here and see how it works for you?

from sgfparser.

Trevoke avatar Trevoke commented on June 6, 2024

At least this use case is handled. Closing.

from sgfparser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.