I saw this on the web a JSON library for C:

"JSON-C implements a reference counting object model that allows you to
easily construct JSON objects in C, output them as JSON formatted
strings and parse JSON formatted strings back into the C representation
of JSON objects."


I think I will change CGOS over to using JSON for the game records
:-)    Just kidding!

But seriously,  a simple system just for storing games would be to use
the same "tags" that the
xml version uses and use it pretty much like I have below - assuming
that is valid JSON.

Don't worry,  I'm not going to push for yet another standard - but I do
hate SGF.  

- Don



Don Dailey wrote:
> I tried to manually compose a JSON example to roughly match the xml
> example Stuart Yates gave.  I don't know if I did it right because I'm
> not an expert on JSON although I've used it a little bit in javascript
> programming:
>
> {
>        "White":  "John Doe",
>        "Black":  "Fred Johnson",
>    "BoardSize":  19,
>        "Moves":  [ "D16", "E16", "H13", "D15", "E12", "C16", "G15" ]
> }
>
> The moves can be on separate lines if you want them to.
>
> JSON is designed to be read directly into a data structure in your
> program.  Square brackets are for lists, strings are quoted and colons
> represent records or hashes.
>
> This would be directly read into a data structure in your programming
> language of choice.
>
> I'm guessing here because I haven't looked at JSON in C, but it might
> place this information in the following data structure:
>
> typedef struct
> {
>     char   *White;
>     char   *Black;
>     int      boardsize;
>     char   **Moves;
> };
>
>
> There would have to be some agreement on what to call the names of the
> various elements.
>
> Variations can be expressed rescursively with JSON, just as in SGF, so
> you can make trees if you want to.
>
>
> - Don
>
>
>
>
>
>
> Stuart A. Yeates wrote:
>   
>> I've been looking further at the jago xml format, and for a very
>> simple game it looks like:
>>
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <?xml-stylesheet href="go.xsl" type="text/xsl"?>
>> <!DOCTYPE Go SYSTEM "go.dtd">
>> <Go>
>> <GoGame name="*">
>> <Information>
>> <Application>Jago:Version 4.7</Application>
>> <BoardSize>19</BoardSize>
>> </Information>
>> <Nodes>
>> <Node/>
>> <Black number="1" at="D16"/>
>> <White number="2" at="E16"/>
>> <Black number="3" at="H13"/>
>> <White number="4" at="D15"/>
>> <Black number="5" at="E12"/>
>> <White number="6" at="C16"/>
>> <Black number="7" at="G15"/>
>> <White number="8" at="D17"/>
>> </Nodes>
>> </GoGame>
>> </Go>
>>
>> cheers
>> stuart
>> _______________________________________________
>> computer-go mailing list
>> computer-go@computer-go.org
>> http://www.computer-go.org/mailman/listinfo/computer-go/
>>
>>   
>>     
> _______________________________________________
> computer-go mailing list
> computer-go@computer-go.org
> http://www.computer-go.org/mailman/listinfo/computer-go/
>
>   
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to