To access the Python shell, either type >
from the command line
or select Windows->Python Shell(IDLE...)
from the GUI.
board()
command(cmd)
evaluate()
evalcontext()
eq2mwc()
mwc2eq()
cubeinfo()
met()
positionid()
positionfromid()
positionkey()
positionfromkey()
positionbearoff()
positionfrombearoff()
navigate([next=
N,[game=
N]])
Without any arguments, go to first move of first match.
With next == N, move forward N game records.
With game == N, move forward/backward N games.
Navigate never wraps around.
On success, returns None
. If unable to complete the requsted
number of moves, returns a pair of (next-remaining,game-remaining)
.
match([analysis=1/0, boards=1/0, statistics=0/1, verbose=0/1])
> m = gnubg.match()
Takes the following optional keyword arguments:
analysis
boards
statistics
verbose
gnubg.match()
returns a dictionary containing the following
items:
match-info
games
stats (optional)
A dictionary containing the following items:
match-length
variation
Standard
,Nackgammon
, Hypergammon1
,
Hypergammon2
or Hypergammon3
.
rules (optional)
NoCube
, Crawford
and
Jacoby
.
X
O
rating
and
name
.
annotator (optional)
round (optional)
place (optional)
date (optional)
event (optional)
default-eval-context
evalcontext()
.
default-rollout-context
Example,
>>> m['match-info'] {'match-length': 25, 'rules': ('Crawford',), 'default-eval-context': {'plies': 2, 'deterministic': 1, 'reduced': 0, 'noise': 0.0, 'cubeful': 1}, 'annotator': 'GNU 0.14', 'O': {'rating': '0 (Exp 0)', 'name': 'Moshe Tissona'}, 'round': 'Final', 'place': 'Monte Carlo', 'variation': 'Standard', 'default-rollout-context': {'n-truncation': 11, 'initial-position': 0, 'trials': 0, 'stop-on-std': 0, 'variance-reduction': 1, 'late-eval': 0, 'truncated-rollouts': 0, 'truncate-bearoff2': 1, 'cubeful': 1, 'truncate-bearoffOS': 1, 'seed': 1177750272, 'quasi-random-dice': 1, 'minimum-games': 144}, 'date': (13, 7, 2003), 'X': {'rating': '0 (Exp 0)', 'name': 'Jon Royset'}, 'event': 'World Championship 2003'}
A dictionary containing the following items:
info
>>> m['games'][0]['info'] {'points-won': 1, 'score-X': 0, 'score-O': 0, 'winner': 'X', 'resigned': False}
If no winner is specified, winner
is None
.
>>> m['games'][2]['info'] {'score-X': 2, 'winner': None, 'score-O': 0}
game
stats (optional)
Analyse->Game statistics
from the
GUI.
Each action is a dictionary