GNU Backgammon

Forum Archive : GNU Backgammon

 
Python scripting

From:   Řystein Johansen
Address:   oystein@gnubg.org
Date:   3 November 2004
Subject:   The Python way to do it.
Forum:   rec.games.backgammon

> Is there a way to batch import and/or analyze matches?

One way to do this is with the python script provided in the GNU
Backgammon distribution.

The 'sad' thing is that you need to install Python and the Python win32
extensions at your computer. If you can live with that, here's what to
do:

-  Download and install Python <http://www.python.org/>. You must have
   version 2.3.x with the latest builds of GNU Backgammon.
-  Download and install the Python for Win32 extensions from Mark
   Hammond. Be sure you get a build that's fit to python 2.3.x. (You can
   see that of the file name.) Direct link to the download page
   <http://sourceforge.net/project/showfiles.php?group_id=78018>.
-  Start GNU Backgammon
-  In the Windows menu og GNU Backgammon check the Command panel on.
-  Type in: load python scripts/batch_win.py
-  Select the files you want to analyse in the file selection box. You
   can select several files by holding down the CTRL key or the SHIFT
   key.
-  Press the Open button to start the analysis.

Good Luck,
-Řystein

PS: Python can of course be used to many other things as well. Python is
a really neat programming language which is really simple to learn. It's
also possible to do simple programming tasks in GNU Backgammon with
Python. Say you want to analyse a position at several scores, then you
can have python to loop through all the possible scores and analyse the
position. Or what about a python loop that loops over all possible match
equity tables? Doesn't that sound neat?

Řystein Johansen  writes:

> If I wanted to do some programming in python, do you know a good place
> on the web to start learning? Command reference, maybe a quick tutor
> or something?

The natural stating point is http://www.python.org.

Just browse around and see if you find something suitable. I like Guidos
van Rossum's "Python Tutorial".

For programming GNU Backgammon things you should look at the scripting
chapter in the thin manual
<http://www.gnu.org/software/gnubg/manual/html_node/Scripting.html>.
There is also two newly added methods, gnubg.findbestmove() and
gnubg.cfevaluate(). These are described here
<http://lists.gnu.org/archive/html/bug-gnubg/2004-10/msg00070.html>.

-Řystein
 
Did you find the information in this article useful?          

Do you have any comments you'd like to add?     

 

GNU Backgammon

Analyzing GamesGrid matches  (Roy Passfield, Dec 2001) 
Batch analysis tool  (Øystein Johansen, June 2004)  [GammOnLine forum]
Cache size  (Ned Cross+, Mar 2004)  [GammOnLine forum]
Compiling for Windows  (Øystein Johansen, Jan 2002) 
Edit mode removing checker from bar  (Scott Steiner+, May 2003) 
Entering an annotated match  (Albert Silver, Dec 2003)  [GammOnLine forum]
Error rates: Gnu vs. Snowie  (Raccoon, Mar 2006)  [GammOnLine forum]
Even-ply/odd-ply effect  (Raccoon, Nov 2004) 
Even-ply/odd-ply effect  (Tom Keith+, Oct 2003) 
Even-ply/odd-ply effect  (Scott Steiner+, Dec 2002) 
Filter settings  (Robert-Jan Veldhuizen, Nov 2004)  [GammOnLine forum]
Gnu 0.13 versus Jellyfish and Snowie  (Torsten Schoop, Aug 2003) 
Gnu 0.13 vs. Snowie 4  (Albert Silver, June 2003) 
Gnu 0.14 vs. Jellyfish  (Michael Howard+, July 2003) 
Gnu versus Snowie and Jellyfish  (Michael Depreli, Oct 2005) 
How luck factor is calculated  (Gregg Cattanach, Aug 2002) 
How rollouts work  (Gary Wong, July 1999) 
How to enter an illegal move  (Øystein Johansen, Aug 2003)  [GammOnLine forum]
Importing .gam files  (PAR+, Mar 2005) 
Importing PartyGammon matches  (rew+, July 2006) 
Improving your game using GnuBG  (D.U.G.+, Nov 2002) 
Installing on Windows  (maareyes, Oct 2001) 
Interpreting JSD's  (Adrian Wright+, Feb 2005)  [GammOnLine forum]
JSD's and confidence intervals  (Daniel Murphy+, Jan 2005) 
Logging rollouts  (Øystein Johansen, Oct 2004)  [GammOnLine forum]
Luck rate  (Kees van den Doel+, May 2002) 
MWC versus Equity (EMG)  (Ken+, Apr 2005)  [GammOnLine forum]
Manually entering first roll  (Andreas Graf+, Apr 2005) 
Match equity tables  (Raccoon, July 2005)  [GammOnLine forum]
Personal reflections  (Louis Nardy Pillards, Sept 2002) 
Playing two computers against each other  (Stanley E. Richards+, Mar 2008)  [GammOnLine forum]
Python scripting  (Øystein Johansen+, Nov 2004) 
Quasi-random dice in rollouts  (Ian Shaw, Mar 2004)  [GammOnLine forum]
Question marks in game list  (Jim Segrave, July 2005) 
Questions and answers  (Jim Segrave+, Jan 2003) 
Questions and answers  (Jørn Thyssen, Aug 2002) 
Restarting a rollout with different settings  (Jim Segrave, Apr 2005)  [GammOnLine forum]
Restarting a rollout with different settings  (Robert-Jan Veldhuizen, Apr 2004)  [GammOnLine forum]
Rollout settings  (geoff arnold+, Apr 2007) 
Rollout settings  (Stick+, Nov 2005)  [GammOnLine forum]
Rollout settings  (Robert-Jan Veldhuizen, Mar 2004)  [GammOnLine forum]
Rollout settings  (Ian Dunstan, Aug 2003)  [GammOnLine forum]
Rollout settings for the impatient  (Robert-Jan Veldhuizen, June 2004)  [GammOnLine forum]
Running rollouts in background  (Bruce+, Apr 2004)  [GammOnLine forum]
Saving rollout results from command-line interface  (Jeremy Bagai+, Apr 2006)  [GammOnLine forum]
Saving rollouts  (Mislav Radica+, May 2006)  [GammOnLine forum]
Setting GnuBG's playing strength  (JP White, Sept 2001) 
Setting skill level  (Jim Segrave, Apr 2004) 
Setting up and saving a rollout  (Albert Silver, Dec 2003)  [GammOnLine forum]
What's GNU?  (Gary Wong, Oct 2001) 
Which player is player 0?  (Neil Kazaross+, Oct 2004)  [GammOnLine forum]

[GammOnLine forum]  From GammOnLine       [Long message]  Long message       [Recommended reading]  Recommended reading       [Recent addition]  Recent addition
 

  Book Suggestions
Books
Cheating
Chouettes
Computer Dice
Cube Handling
Cube Handling in Races
Equipment
Etiquette
Extreme Gammon
Fun and frustration
GNU Backgammon
History
Jellyfish
Learning
Luck versus Skill
Magazines & E-zines
Match Archives
Match Equities
Match Play
Match Play at 2-away/2-away
Miscellaneous
Opening Rolls
Pip Counting
Play Sites
Probability and Statistics
Programming
Propositions
Puzzles
Ratings
Rollouts
Rules
Rulings
Snowie
Software
Source Code
Strategy--Backgames
Strategy--Bearing Off
Strategy--Checker play
Terminology
Theory
Tournaments
Uncategorized
Variations

 

Return to:  Backgammon Galore : Forum Archive Main Page