A node is an object whose keys are property names and whose values are the corresponding values. The value types are defined later.
SGF:
;FF[4]GM[1]SZ[19]
JSON:
{
"FF": 4,
"GM": 1,
"SZ": 19
}
SGF:
;FF[4]GM[1]SZ[19];B[aa];W[bb]
JSON:
{
"FF": 4,
"GM": 1,
"SZ": 19
},
{
"B": "aa"
},
{
"W": "bb"
}
SGF:
(;FF[4]GM[1]SZ[19];B[aa];W[bb])
JSON:
[
{
"FF": 4,
"GM": 1,
"SZ": 19
},
{
"B": "aa"
},
{
"W": "bb"
}
]
SGF:
(;FF[4]GM[1]SZ[19];B[aa];W[bb])
(;FF[4]GM[1]SZ[19];B[cc];W[dd])
JSON:
[
[
{
"FF": 4,
"GM": 1,
"SZ": 19
},
{
"B": "aa"
},
{
"W": "bb"
}
],
[
{
"FF": 4,
"GM": 1,
"SZ": 19
},
{
"B": "cc"
},
{
"W": "dd"
}
]
]
A node can contain a special property named variations
whose value is an array of arrays (game trees).
SGF:
(;FF[4]C[root](;C[a];C[b])(;C[c];C[d]))
JSON:
[
{
"FF": 4,
"C": "root",
"variations": [
[
{
"C": "a"
},
{
"C": "b"
}
],
[
{
"C": "c"
},
{
"C": "d"
}
]
]
}
]
SGF:
;GM[1]KM[6.5]HA[9]
JSON:
{
"GM": 1,
"KM": 6.5,
"HA": 9
}
SGF:
;C[hello]
JSON:
{
"C": "hello"
}
SGF:
;B[aa]
JSON:
{
"B": "aa"
}
A compressed point list is an array of strings (moves/points). The compressed list must be always expanded (XXX)
SGF:
;AB[aa:bb]
JSON:
{
"AB": [ "aa", "ab", "ba", "bb" ]
}
SGF:
(;LB[aa:label];AP[CGoban:1.6.2];LN[aa:bb];AR[aa:bb])
JSON:
{
"LB": [ "aa", "label" ],
"AP": [ "CGoban", "1.6.2" ],
"LN": [ "aa", "bb" ],
"AR": [ "aa", "bb" ]
}
Copyright Ryo Anazawa, 2014.
This document is licensed under the Creative Commons license by-sa.
thank you! this will help me improve my parser for https://github.com/deebloo/go-board