Extending SGF?
Posted: Wed Feb 06, 2019 6:36 am
Are there any interested parties, i.e. people working on Go software, reading this?
While working on a few things in q5go I've run across a few situations where the SGF file format is inadequate. The major issue is that it cannot be safely extended: any extra properties a program might add which go beyond the specification could be misunderstood by another tool that chooses the same property name with a different meaning.
The imminent problem is that I'd like a way to save LZ evaluations. There is V[], specifying a value, but it's defined as an estimated score (negative for White). I suppose I could set V[0] to represent 50% winrate to and adjust everything else accoringly to a range of +/-50. But it would be nice to also save the visit count that was used to arrive at that evaluation, and the komi used by the program (which could be different from the game, and an application could have an option to flip between 7.5 and -7.5 for engines with fixed komi).
Ideally there'd be a namespace which programs could use to define their own properties, such as Zxx[]. A program would have to verify AP[] first to see whether it understands these or not. This would of course only be useful for properties that can safely be ignored. For others, the issue of interoperability is less critical - for example, for toroidal boards I've chosen to simply use a different (and invalid, according to the spec) GM, to make sure the file isn't misinterpreted by other tools. In an ideal world we'd perhaps also have another namespace (Yxx?) for non-standard but also non-ignorable properties.
So, what to do with the immediate problem? Overload V[] or add a new ZV[val:visits:komi]?
While working on a few things in q5go I've run across a few situations where the SGF file format is inadequate. The major issue is that it cannot be safely extended: any extra properties a program might add which go beyond the specification could be misunderstood by another tool that chooses the same property name with a different meaning.
The imminent problem is that I'd like a way to save LZ evaluations. There is V[], specifying a value, but it's defined as an estimated score (negative for White). I suppose I could set V[0] to represent 50% winrate to and adjust everything else accoringly to a range of +/-50. But it would be nice to also save the visit count that was used to arrive at that evaluation, and the komi used by the program (which could be different from the game, and an application could have an option to flip between 7.5 and -7.5 for engines with fixed komi).
Ideally there'd be a namespace which programs could use to define their own properties, such as Zxx[]. A program would have to verify AP[] first to see whether it understands these or not. This would of course only be useful for properties that can safely be ignored. For others, the issue of interoperability is less critical - for example, for toroidal boards I've chosen to simply use a different (and invalid, according to the spec) GM, to make sure the file isn't misinterpreted by other tools. In an ideal world we'd perhaps also have another namespace (Yxx?) for non-standard but also non-ignorable properties.
So, what to do with the immediate problem? Overload V[] or add a new ZV[val:visits:komi]?