julianandrews / sgf-parse

SGF parsing library for Rust.
MIT License
13 stars 3 forks source link

Support non-go games #9

Closed julianandrews closed 3 years ago

julianandrews commented 3 years ago

Right now the parser assumes a game is go. However, sgf supports a wider range of games, and so should sgf-parse!

julianandrews commented 3 years ago

According to the spec HA, KM, TB, and TW are go specific, and the format for the move, point and stone types are game specific. and game 1 (go) is the default, so I should only need to change the behavior if another game is explicitly specified.

As a first step, it should be possible to parse the HA, KM, TB, and TW properties as Unknown for non-go games, and store moves, points and stones as un-parsed strings.

Later, support could be added for other game specific properties, but that isn't essential at this point.

This came up in issue #8

@kurnevsky - would that address your use cases?

kurnevsky commented 3 years ago

Yes, it would. Though I already used sgf-parser crate which also parses moves as go-specific. But in case move can't be parsed it leaves the property as unknown. But I'd probably leave all moves as plain strings for unknown game types because they can have unique format.