bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnubg] Help with python method gnubg.match()


From: David Levy
Subject: [Bug-gnubg] Help with python method gnubg.match()
Date: Sun, 28 May 2006 08:53:25 -0700

I have been exploring the python interface exposed by gnubg and found much
help in scripts posted online.

For example, I am able to load a match, get the dictionary returned by
m=gnubg.match() and navigate through games and actions. In particular, I am
able to look at the analysis (rollout or evaluation) of cube decisions and
checker play -- my major goal. 

[Aside: The only suggestion I would make would be to add a more detailed
rollout context to the analysis records. The current rollout context shows
number of trials, but not the full context including truncation points,
plies, etc.] 

I am, however, having difficulty using gnubg.match() when I create the match
using various 'set' commands with gnubg.command('xxxxxx'). 

Example 1: Evaluation/Rollout of checker play

With the following commands I can get evaluations and rollouts of all
candidate checker plays for a position and roll (some details omitted):

gnubg.command('set matchid cAkKAAAAAAAA')   #money play
gnubg.command('set board jM/BATDYZvABMA')   #position of interest
gnubg.command('set dice 64')                #roll of interest
gnubg.command('set cube center')
gnubg.command('set cube value 1')
gnubg.command('hint')                       #displays evaluation results to
stdout
gnubg.command('rollout=1')                  #rollout first move
...                                         #more rollouts
gnubg.command('hint')                       #display rollout results to
stdout
m=gnubg.match()                             #see "Problem" discussion below

Example 2: Evaluation of cube decision

I can give the following commands in python to see an evaluation of a cube
decision (some details omitted):

gnubg.command('set matchid cAkKAAAAAAAA')   #money play
gnubg.command('set board jM/BATDYZvABMA')   #position of interest
gnubg.command('set cube value 1')
gnubg.command('set cube center')
gnubg.command('set turn playerX')           #player to act on cube
gnubg.command('hint')                       #display evaluation results to
stdout
m=gnubg.match()                             #see "Problem" discussion below

Problem: 

I was hoping that I could issue the same sequence of commands and then read
the dictionary returned by gnubg.match() to see the same evaluation or
rollout results. I do see all of my set commands as actions. For example. I
do see the position I have set. But gnubg does not seem to want to play the
match from the indicated position. I've tried many permutations of setting
the players to be human or gnubg, setting automatic roll on or off, adding
the command 'analyze match,' asking the computer to 'play,' etc. But if what
I'm trying to do is possible, I haven't found the right sequence of
commands. 

So:

Is there some sequence of set commands I can issue so that I can see what I
want in the dictionary returned by gnubg.match()?

Or must I continue to redirect stdout to a file and (ugh) parse the output
of 'hint'?

Thanks,

David Levy







reply via email to

[Prev in Thread] Current Thread [Next in Thread]