[ View Thread ] [ Post Response ] [ Return to Index ] [ Read Prev Msg ] [ Read Next Msg ]

BGonline.org Forums

Getting luck values from GNUbg CLI?

Posted By: Philippe Michel
Date: Thursday, 15 January 2026, at 9:19 p.m.

In Response To: Getting luck values from GNUbg CLI? (Jeremy Bagai)


If you want to get these values after the fact, from an analyzed match the easiest way is probably to use the python interpreter embedded in the CLI (you enter it with the ">" command or you can use gnubg's "-p" flag to run a python script).

You can load all the analysis and statistics in a python object and pick what interests you.

For instance the following example prints all the luck data.

 

gnubg.command("load match some-analyzed-match.sgf")

match = gnubg.match(analysis=1, statistics=1)
games = match['games']

for game in games:
gg = game['game']
for move in gg:
if move['action'] == "move":
print("move {:s} {:+g}".format(move['player'], move['analysis']['luck-value']))

print("")
print("game {:s} {:+g}".format("O", game['stats']['O']['dice']['luck']))
print("game {:s} {:+g}".format("X", game['stats']['X']['dice']['luck']))
print("")

print("match {:s} {:+g}".format("O", match['stats']['O']['dice']['luck']))
print("match {:s} {:+g}".format("X", match['stats']['X']['dice']['luck']))


"help(gnubg.match)" shows what else is available. This is a fairly complex structure but the above example should give an idea on how to obtain other data than the 'luck-value' field from analysis and 'luck' from statistics.




Messages In This Thread

 

Post Response

Your Name:
Your E-Mail Address:
Subject:
Message:

If necessary, enter your password below:

Password:

 

 

[ View Thread ] [ Post Response ] [ Return to Index ] [ Read Prev Msg ] [ Read Next Msg ]

BGonline.org Forums is maintained by Stick with WebBBS 5.12.