Backgammon analysis software GNU Backgammon has the ability to execute Python scripts. I knew that for a long time, but I couldn't get it because I didn't know Python. Recently, I learned a little about how to use Python at work, so let's try something!
I used Ubuntu 14.04 LTS. I had a version of gnubg 1.02, but this version returned only an empty dict when I called gnubg.match ()
, which I'll discuss later. So I built 1.05 from source (http://www.gnubg.org/index.php?itemid=100&catid=10).
$ gnubg
GNU Backgammon 1.05.002 Jul 2 2016
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 by Gary Wong.
Copyright (C) 2016 by Gary Wong and the AUTHORS; for details type `show version'.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show warranty'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show copying' for details.
(No game)
import gnubg
I want to start like this, but I can't. The way you work with gnubg in Python is a bit different.
With gnubg running, type >
at the command prompt. Then you can use IPython.
(No game) >
/usr/local/lib/python2.7/dist-packages/IPython/config.py:13: ShimWarning: The `IPython.config` package has been deprecated. You should import from traitlets.config instead.
"You should import from traitlets.config instead.", ShimWarning)
IPython 4.2.1, Python 2.7.6 (default, Jun 22 2015, 18:01:27)
[GCC 4.8.2]
In <1> >
I've seen a lot in my environment, but I don't care for the time being. You can refer to the help with the following command.
In <1> > help(gnubg)
Let's import the match of PlayOK.
In <2> > gnubg.command('import mat 87027157.txt')
GNU Backgammon Position ID: AAAAunEAAAAAAA
Match ID : 8AqgAFAAAAAE
+13-14-15-16-17-18------19-20-21-22-23-24-+ O: mkisono
| | | |OOO 5 points
| | | | OOO
| | | | OOO
| | | | OOO
| | | | OOO
v| |BAR| |5 point match(Cube: 1)
| | | | X
| | | | X
| | | X X | X
| | | X X X | X
| | | X X X X |XX 0 points
+12-11-10--9--8--7-------6--5--4--3--2--1-+ X: cwm7296g
In <3> > gnubg.command('analyse match')
In <4> > gnubg.command('show statistics match')
Player mkisono cwm7296g
Checker play statistics
Move total 49 47
Non-forced move 44 36
Unmarked move 45 34
Suspicious move 1 5
Bad move 2 2
Very bad move 1 6
Error total EMG (MWC) -0.555 ( -8.234%) -2.515 (-34.975%)
Error rate mEMG (MWC) -12.6 ( -0.187%) -69.9 ( -0.972%)
Checkerplay Rating Intermediate Awful!
Luck statistics
Very lucky roll 0 1
Lucky roll 3 4
Ordinary roll 46 38
Unlucky roll 0 3
Very unlucky roll 0 1
Luck total EMG (MWC) +0.571 ( +9.871%) -0.972 (-12.880%)
Luck rate mEMG (MWC) +11.7 ( +0.201%) -20.7 ( -0.274%)
Luck rating None None
Cube stats
Cube action total 2 30
Barely or real cube action 2 1
Double 1 0
Take 0 1
Path 0 0
Missed doubles below CP (EMG (MWC)) 0 0
Missed doubles above CP (EMG (MWC)) 0 0
Wrong doubles below DP (EMG (MWC)) 1 (-0.042 ( -0.323%)) 0
Wrong doubles above TG (EMG (MWC)) 0 0
Wrong take(EMG (MWC)) 0 0
Wrong path(EMG (MWC)) 0 0
Error total EMG (MWC) -0.042 ( -0.323%) -0.000 ( -0.000%)
Error rate mEMG (MWC) -20.9 ( -0.162%) -0.0 ( -0.000%)
Cube action rating Casual player Supernatural
Comprehensive statistics
Error total EMG (MWC) -0.597 ( -8.557%) -2.515 (-34.975%)
Error rate mEMG (MWC) -13.0 ( -0.186%) -68.0 ( -0.945%)
Snowie error rate -6.2 ( +0.000%) -26.2 ( +0.000%)
Comprehensive evaluation Intermediate Awful!
Actual result+50.00% -50.00%
Luck adjusted result +27.25% -27.25%
Luck based FIBS rating diff. +474.84
Error based abs. FIBS rating 1858.7 1078.7
Rating deductions due to checker play errors 175.4 971.3
Rating deductions due to cube error 15.9 0.0
It was a match with a lot of errors ...
Enter the gnubg.match ()
command and it will return the match data. What should I do with this data?
You're ready to play with gnubg in Python. I'm just studying Python, so it's a hobby and a real benefit, and it's never been so much fun! !!
Referenced page
Recommended Posts