pasky / pachi

A fairly strong Go/Baduk/Weiqi playing program
http://pachi.or.cz/
GNU General Public License v2.0
510 stars 116 forks source link

uct json reporting of candidate moves, fix illegal json #125

Closed stapel closed 5 years ago

stapel commented 5 years ago

I was playing around with goreviewpartner and a 9x9 game and goreviewpartner would apparently always hickup on the submitted json. (first move) For example (notice the extra comma at the end):

# {"frame": {"playouts": 80000, "extrakomi": 7.5, "best": {"E5": 0.542092}, "can": [[{"E5": [0.542, 375853]},{"E7": [0.540, 130287]},{"F6": [0.547, 98212]},{"F7": [0.539, 43326]},{"G7": [0.548, 22104]},{"G8": [0.540, 15857]},{"G6": [0.551, 9919]},{"H8": [0.554, 2834]},{"C3": [0.570, 687]},{"D4": [0.578, 153]},{"C4": [0.614, 44]},{"D5": [0.524, 21]},{"C5": [0.200, 5]}], [{"E6": [0.521, 43416]},{"E4": [0.520, 20673]},{"F4": [0.528, 17142]},{"F3": [0.525, 9636]},{"F5": [0.541, 6858]},{"G3": [0.547, 1734]},{"E3": [0.571, 634]},{"D3": [0.573, 302]},{"E2": [0.593, 220]},{"D4": [0.556, 71]},{"D2": [0.483, 30]},{"C2": [0.395, 19]},{"B2": [0.438, 8]}], [{"F7": [0.511, 12198]},{"F3": [0.513, 5657]},{"C4": [0.538, 1947]},{"C3": [0.553, 586]},{"D4": [0.631, 240]},{"D3": [0.636, 158]},{"E4": [0.684, 117]},{"F4": [0.553, 38]},{"E3": [0.667, 15]},{"E2": [0.500, 2]}], [{"F6": [0.496, 1675]},{"D5": [0.480, 788]},{"D7": [0.492, 263]},{"C7": [0.497, 183]},{"C8": [0.478, 93]},{"C6": [0.396, 67]},{"B8": [0.415, 41]},{"E7": [0.286, 21]},{"E6": [0.429, 7]}], [{"G7": [0.505, 806]},{"C4": [0.525, 325]},{"D7": [0.606, 109]},{"C7": [0.586, 58]},{"C6": [0.595, 42]},{"D6": [0.467, 15]},{"B7": [0.000, 1]}], [{"H8": [0.451, 575]},{"D4": [0.417, 399]},{"C6": [0.395, 105]},{"C5": [0.338, 37]},{"E6": [0.222, 9]}], [{"E8": [0.472, 531]},{"F3": [0.452, 320]},{"F5": [0.534, 118]},{"D3": [0.366, 41]},{"G3": [0.278, 18]},{"G4": [0.000, 5]}], [{"G8": [0.481, 465]},{"D4": [0.458, 191]},{"D6": [0.618, 34]},{"C6": [0.571, 7]}], [{"F8": [0.460, 364]},{"D3": [0.418, 208]},{"F3": [0.418, 55]},{"E5": [0.433, 30]},{"G5": [0.714, 7]}], [{"E7": [0.428, 159]},{"G6": [0.446, 56]},{"F5": [0.375, 16]},{"F6": [0.000, 2]}], [{"H9": [0.333, 3]}], [], [], [], [], [], ]}}

The break in the while-loop would leave a comma hanging from the previous iteration.

Commit adds comma before next array.

lemonsqueeze commented 5 years ago

Thanks for spotting this, looks good to me.