Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Converting XG match files to mat or txt and M.Petch's scripts

612 views
Skip to first unread message

michae...@gmail.com

unread,
Feb 21, 2015, 5:36:34 PM2/21/15
to
I was trying to find a utility that would convert XG match files to mat or txt.
http://www.extremegammon.com/xgformat.aspx
Have downloaded M. Petch's python scrips from here
http://vcs.capp-sysware.com/gitweb/?p=backgammon/xgdatatools.git

and run
extractxgdata.py
It created 3 bin files (all unreadable/uncompressable) and a jpg one.
the largest of the 3 bin was FILENAME_gamefile.bin
So far so good that's the structure of the xg file.

I thought of re-running extractxgdata.py and directing all output to a text file. I got a huge text file containing everything but still far away from any simple text or mat file.

First roll 'DiceRolled': '61', shows up on page 3 (out of 1481!!)
Instead of moves we have position before and position after
'Position': (0, -2, 0, 0, 0, 0, 5, 0, 3, 0, 0, 0, -5, 5, 0, 0, 0, -3, 0, -5, 0, 0, 0, 0, 2, 0),

I am wondering whether within M.Petch's scripts there is anything to transform this gamefile.bin or the text output of everything to a mat file.
Or if there is any other utility around that would do that.

michae...@gmail.com

unread,
Feb 21, 2015, 5:53:11 PM2/21/15
to
Correction it has the moves a few pages down in fact for the 6/1 they are on page 9
'Moves': (12, 6, 7, 6, -1, -1, -1, -1),


Michael Petch

unread,
Feb 21, 2015, 6:11:58 PM2/21/15
to
On 2015-02-21 3:36 PM, michae...@gmail.com wrote:
> I was trying to find a utility that would convert XG match files to mat or txt.
> http://www.extremegammon.com/xgformat.aspx
> Have downloaded M. Petch's python scrips from here
> http://vcs.capp-sysware.com/gitweb/?p=backgammon/xgdatatools.git
>
> and run
> extractxgdata.py

I didn't advertise it as a mat file utility. Its sole purpose was to
provide a mechanism for other people to use the code to build their own
tools and more importantly to make sure the information provided by
Xavier could be utilized to build such a library. The extract utility
was simply designed to output all the data in a textual format for debug
purposes. The Java version I published is truer to the idea of an actual
basic library but again I only provide code samples. The Python version
was never polished off to be a proper library although someone managed
to integrate it into their own application. The Java version is now used
by a number of people.

As for the Python version one person wrote an AWK script that actually
takes the text output of the extractxgdata tool and converts it into a
MAT file. Although this is inefficient apparently it works. Not sure if
it works well on Windows or *nix.

I have no intention of really going beyond the basic libraries. If other
people have an interest in expanding on the basics I am more than happy
to integrate their code into the library (ie MAT file output, converting
to and from XGID, computing PR etc).

I can contact the individual who wrote the AWK script for Python to see
if he'd be willing to make it available.

michae...@gmail.com

unread,
Feb 21, 2015, 6:27:00 PM2/21/15
to
On Sunday, February 22, 2015 at 1:11:58 AM UTC+2, Michael Petch wrote:
>

> I can contact the individual who wrote the AWK script for Python to see
> if he'd be willing to make it available.

OK thanks, that would be nice for all of us GNUbg users. Unfortunately the majority of matches are today published in xg format..

Is there any plan to include import of XG matches in GNUBG future releases?

Michael Petch

unread,
Feb 21, 2015, 6:43:52 PM2/21/15
to
On 2015-02-21 4:26 PM, michae...@gmail.com wrote:
>
> Is there any plan to include import of XG matches in GNUBG future releases?
>

When I have time which I don't. Wouldn't be later in the year. As I
pointed out the Python code still needs to be properly completed. My
intention is to use the Python code within GNUbg (Since GNUbg already
has Python support) and add it as an import feature.

If I have an afternoon some time I could create a crude MAT file
exporter (in Java sing my library). Crude would be that it wouldn't
support an XG file with illegal moves. A bit more work would be needed
to support illegal moves to output it the way XG does. If you ever
output a MAT file from an XG file that has illegal moves you'll observe
the nonstandard convention Xavier uses in his MAT files.

Michael Petch

unread,
Feb 21, 2015, 6:56:21 PM2/21/15
to
On 2015-02-21 4:43 PM, Michael Petch wrote:
> Wouldn't be later in the year.

Should have been

"Would be later in the year at best" .

michae...@gmail.com

unread,
Feb 24, 2015, 6:28:41 AM2/24/15
to
I wrote a vba code for Excel that does the first step in creating a mat or txt file by extracting the data needed from the python text file output. Next step would be tide up everything and make the mat file.
I uploaded the code for anyone who would be interested to write something in another programming language.
Specifically the part that says "count" should be useful. Notice that if the cube is passed then the line before would be 'DiceRolled': '77',

code is here, and works for older versions of Excel too.
http://www.filedropper.com/vbaexcelcodea

norm...@gmail.com

unread,
Mar 18, 2015, 10:55:52 PM3/18/15
to
I would also appreciate having the AWK script made available, or better yet having the import XG ability added to GNUBG.

michae...@gmail.com

unread,
Mar 19, 2015, 7:18:08 AM3/19/15
to
I already wrote the complete code that converts it, but you need Excel to run it.Also you need to have Python installed to run Petch's scripts. I already converted a few XG games. If you are interested I will upload the Excel file somewhere.

norm...@gmail.com

unread,
Mar 20, 2015, 11:59:25 AM3/20/15
to
Yes, please do post it.

michae...@gmail.com

unread,
Mar 20, 2015, 3:15:40 PM3/20/15
to

lindmi...@gmail.com

unread,
May 26, 2017, 8:31:34 AM5/26/17
to
Could you by any chance upload it again :) ?

Michael

unread,
May 26, 2017, 8:52:20 AM5/26/17
to
Sure!. You may download anything you want from my drive.
https://drive.google.com/drive/folders/0B7L6em2ChhMOZmpxYmtrTE5aUlU

lindmi...@gmail.com

unread,
May 26, 2017, 2:46:35 PM5/26/17
to
Thanks, you just saved me a lot of time!

ctsi...@gmail.com

unread,
Feb 22, 2018, 4:58:00 PM2/22/18
to
I am interested in writing a conversion tool from xg to mat. I see that you have solved 90% of the job by creating this java library to export text information of xg files. Do you happen to know where to find a definition of the mat format?

Michael

unread,
Feb 23, 2018, 11:46:09 AM2/23/18
to
It's just a text file.
You can export one from XG and see what it contains.
The minimum requirement is to have a starting line saying e.g:
7 point match (Notice the empty space-this is to accommodate 2 digits)
and then continue with
Game 1
PlayerA : 0 PlayerB : 0
1) 15: 24/23 13/8 54: 13/9 13/8

From memory the rolls of Player B are written at position 35 but I personally changed it to 40 and it works fine.

bgbl...@googlemail.com

unread,
Feb 26, 2018, 4:20:08 PM2/26/18
to
Am Donnerstag, 22. Februar 2018 22:58:00 UTC+1 schrieb Christos Tsirkas:
> I am interested in writing a conversion tool from xg to mat. I see that you have solved 90% of the job by creating this java library to export text information of xg files. Do you happen to know where to find a definition of the mat format?

If you are willing to wait a bit BGBlitz next release will do that trick in the free edition. (This part is ready... others not. If you can tolerate possible rough edges you may ask for a snapshot. You should tell me your operating system in that case)

ciao
Frank

sol...@gmail.com

unread,
Feb 10, 2020, 9:38:58 AM2/10/20
to
Can someone post this repository here or email it to me. The web's public link is broken.

Thanks

Philippe Michel

unread,
Feb 10, 2020, 6:17:14 PM2/10/20
to
On 2020-02-10, sol...@gmail.com <sol...@gmail.com> wrote:

> Can someone post this repository here or email it to me. The web's
> public link is broken.

I don't have it as a repository, but I saved a snapshot when it was
still available and uploaded it as :
http://philippe.michel7.free.fr/gnubg/xgdatatools-82d2d37.tar.gz
0 new messages