Back to the JellyFish HomePage

The JellyFish Position File Format

Introduction

Compared to most other games, backgammon is more about skill and less about luck. For those who want to improve their backgammon skills or analyze matches, JellyFish is a great program - although it’s almost impossible to beat the program in the long haul. In the game, you’ll get comments when making unwise moves, suggestions of the best legal moves after every roll and the opportunity to save position for later analysis.

The code below is pseudo-code for reading a JellyFish position file, "position.pos"

The writing routine will be the opposite.

For example, to read the level, the example shows:

       ar >> w;       level = (int) w;

To write to file, use:

       ar << (WORD) level;

and so on.

JellyFish is written in C++ using Microsoft Foundation Classes (MFC). The classes CFile and CArchive are MFC classes, WORD is a Windows SDK data type.

What you'll have to do to be able to read from or write to a file, is first to create and open a CFile object.

The Open command needs to parameters: The file name and a flag specifying whether to read or to write.

After that, you also create and open a CArchive object.

Now you need four parameters for the Open command: A pointer to the CFile object, a flag specifying whether to read (load) or to write (store), an integer specifying the size of the internal file buffer, and a pointer to the same buffer.

In the end, after reading all data, the CFile and the CArchive objects must be closed.

 Back to the JellyFish HomePage


Copyright # 1998- 2002 JellyFish AS. All rights reserved.