GNU Backgammon

Forum Archive : GNU Backgammon

Importing .gam files

From:   PAR
Date:   7 March 2005
Subject:   Importing .gam files to GNU

Is there a way of analysing .gam files in GNU ? I have tried several
different paths but nothing is working or do i need to get a new

Thanks, PAR

Gregg Cattanach  writes:

.gam files should import the same way as Jellyfish match files (.mat) or
Snowie standard text files (.txt), because they really are the same
thing, except they just contain a single game.

Jim Segrave  writes:

I'm working to sort the problem out.

.mat files have a line at the beginning stating how long the match is,
.gam files do not have this line. .mat files have the player names in
the form:

 name-1: score-1  name-2: score-2

.gam files do not have associated scores.

The .mat import function searches for these two lines and will not
accept a file without them, so .gam files won't be imported. I want to
change the parser to accept these as well.

In the meantime, you could use a text editor (not a Word Processor) to
put an initial line on the file:

   0 point match
for a money game
   5 point match for a game from a match

Then on the line with the player's names, add the current scores,
preceded by a colon ( : ) For example:

Original line:

   Fred                       Zoe

Change to:

   Fred : 0                   Zoe : 0

Now you can import the file as a .mat file

Jim Segrave           (

rew  writes:

Tried this tip.  Edited with notepad.  It didn't work.
Any real tips?  Thx in advance.

Ian Shaw  writes:

Here is a procedure someone kindly sent to me. I've used it successfully.

1- Find an existing MAT file that GNU handled successfully. A match of 7 or
more points is preferable.

2- Feed this MAT file, not the GNU output, into your favorite text editor.
Don't use MS-Word or any other word processor. If all you have for text
editing is Notepad, it's clunky but it will work. Rename it with Save As.

3- Change the match length on the top line to 61. Too much larger, and GNU
instantly crashes. Too much smaller, and you start seeing odd cube
"errors", such as doubles that GNU says are correct at 17 to 11 that
would be wrong for money.  (You can set the match length to 0, but you'll
have to remember to turn Jacoby off if you're importing GammonEmpire/Play65
games. -- Ian)

4- Open the first GAM file you wish to process in a separate window. Shade
the area from immediately before the final period to the beginning of the
line right below the players and their scores. I've found trying to import
the player names line causes problems, so I stopped trying to save time by
doing this. Ctrl-C.

5- Go back to the MAT window and shade the same area of the first game.
Ctrl-V. You can then (carefully!) change the player names by shading and
typing over. Don't mess with the spacing, this is always a bad idea with
MAT files! Be sure you have the player names in the right order. If the
ending says "Wins X points and the match", delete "and the match". Save.

6- Repeat this procedure with the next GAM file. You can now wait to
change the player names until all the files are embedded in the MAT, since
you have already done the first one to show you whos who. It's then easy
to change them all at once when youre finished, using Copy and Paste. You
can change the players' scores to suit the results of the preceding
embedded GAM files, and you'll probably prefer to do so, but this is
unnecessary to make GNU run the MAT.

7- If you run out of games in the original MAT before you run out of GAM
files you want to embed, choose a short game and copy/paste it several
times in the middle of the MAT file. I find it works best to avoid using
Game 1, but I do use one where Ive already changed the names and deleted
"and the match". If the spacings look wrong, go back to your last saved
version and try again. Don't exceed about 16-18 games per pseudo-MAT file,
because GNU and especially Snowie are likely to crash if you load too many
games in one shot. If I want to run a longer session, I run it in sections.
This isn't all bad, since it provides information regarding how well my
opponent and I played as the session progressed.

8- If you have too many games in the MAT for the number of GAM files,
delete the last games from the MAT by starting your shading at the end of
your last embedded GAM file, right before the period, and ending the
shading right before the MAT file's final period. It's best never even to
click the mouse after that final period!

9- Save, then run with GNU or Snowie.

This may seem like a lot of trouble, but eventually you'll get the
procedure down, and I think you'll find the resulting analyses helpful and
accurate. You will find it easier to do the second and subsequent ones,
since once you have one pseudo-MAT that works, you can use it for a
template for the others.


Black Swan

Doug Gitlin  writes:

Here's a pretty simple working solution. Basically, what was missing from
Jim Segrave's initial solution was a line that says " Game #".

So, you need to edit the .gam file to include three header lines:

" X point match" (0 for money session)
" Game #" (MUST have this leading space)
" player1 : (score) player2 : (score)"

What's handy about this method is that it allows you to combine all of the
games from one session into one file. Just cut and paste all of the
different game records into one file; include the three header lines
before each game; adjust the game # and scores for each game; and save as
.gam or .mat.


Jukka Pajuniemi  writes:

Hello there!

1. If you're playing single games on GammonEmpire or Play65
2. If you want to use GNU to analyze them
3. If your operating system is made by Microsoft

... you may find this little and simple software made by myself useful.
It copies .gam files to .txt files, which can be imported to GNU

download and try it in:

Hope someone finds this useful, at least I do :-)

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
Computer Dice
Cube Handling
Cube Handling in Races
Extreme Gammon
Fun and frustration
GNU Backgammon
Luck versus Skill
Magazines & E-zines
Match Archives
Match Equities
Match Play
Match Play at 2-away/2-away
Opening Rolls
Pip Counting
Play Sites
Probability and Statistics
Source Code
Strategy--Bearing Off
Strategy--Checker play


Return to:  Backgammon Galore : Forum Archive Main Page