.PGN .CBF .CBH AND OTHER ALPHABET SOUP

by Steve Lopez

Anybody who has owned or used a computer for longer than, say, twenty minutes has had at least some marginal exposure to file names. Every file on your computer has a name, usually consisting of eleven characters. A file name has one to eight characters followed by a period (or "dot") and then three more characters. For example, the name of the file you're currently reading is "060197.htm". The eight characters before the dot give the file a unique name (in this case, I named the file for the date upon which it would appear on the Internet). The three characters after the dot tell us what kind of file it is; these three characters are commonly called the file extension.

Here are some common file extensions and what they mean:

By now you get the idea. There are numerous kinds of files and each kind usually has a specific extension to tell us (and our software) exactly what type of file it is.

One thing you generally can't do with files is change their type just by renaming the extensions. For example, a picture may be worth a thousand words, but you can't change a text file into a graphics file just by renaming it from MY_STORY.TXT to MY_STORY.JPG. It just plain doesn't work. If you do change the file name and try to make your graphics program load it, you'll just get an error message.

Likewise, you can't change a graphics file from .JPG graphics format to a graphics file in .BMP graphics format just by renaming the file. To do this, a conversion program is required to convert the picture from one file format to the other. Computers may be dumb, but you can't fake them out just by renaming a file. Or, to put it another way, you can stick a feather in your hat and call it macaroni, but just don't try pouring tomato sauce on it and eating it. (By the way, remember this "conversion" idea; it'll be important later).

Chess files come in a plethora of different formats and they're typically not interchangable. For example, you can tell a Bookup data file because it ends in .B8M. But don't try to read it in Chess Assistant; CA uses a completely different file format, ending in .BGB.

To convert from one chess file format to another generally used to require one of two things: a program designed to convert data from one format directly to another (for example, from NicBase to ChessBase), or conversion from one format to plain text first, then from text to the second format.

This opened up a whole new can of worms. Since a text file could contain dang near anything, there was no universal way to convert from text to another specific (or "proprietary" format). For example, let's just consider the example of game headers (the part containing the player names, tournament, etc.). One program might take a game, convert it to text, and give you a header like this:

White: Kasparov, G
Black: Karpov, A
New York, 1990

Another converter might take the same game and output the game to text so that the header looked like this:

Kasparov, G - Karpov, A
New York, 1990

And another might do something really weird, like:

1990, New York
G.Kasparov-A.Karpov

Notice that we're just looking at headers here. We haven't even got to the actual gamescore yet. A simple move like a White Knight capturing on e5 on the 14th move might turn up any of the following ways:

14.Nxe5
14. Nxe5
14.Ne5
14. Ne5
14.N:e5
14. N:e5
14.Nf3-e5
14. Nf3-e5
14.Nf3xe5
14. Nf3xe5

and on and on and on and on...

The problem here is that computers are stupid. They can only do what they're told to do by the set of instructions contained within a piece of software. A program that had no trouble converting a move written as 14.Nxe5 would choke on a move written as 14. Nxe5; the extra space after the period would gag it. And nobody could write (or really had any business trying to write) a piece of software that could handle all of these variations and permutations in both the headers and the gamescores. Conversion programs were very specific; the headers and moves had to be presented in a very rigid style. If there was any deviation from what the conversion program expected, the program choked. Throw in the fact that several gamescores with a file weren't standardized (for example, one game might place extra spaces after a move number, others wouldn't) and you were looking at a real problem. There was no way that a programmer could make the software anticipate all the weird junk that can find its way into textfiles. Simply put, conversion from text to proprietary formats was just about impossible.

To alleviate this problem, somebody came up with a standardized way to type chess games and game headers in text format. There would be a specific number of lines in the game headers and each line would always contain the same type of information. The moves would always be presented in a specific way. And specialized chess notation would be handled by a dollar sign, followed by a number. A typical game in this format looks like this:

[Event "?"]
[Site "IBM Challenge (06)"]
[Date "1997.??.??"]
[Round "?"]
[White "Deep Blue"]
[Black "Kasparov, G."]
[Result "1-0"]
[ECO "B17"]
[Annotator "Fritz 4.01"]

1. e4 {Calc. time=300s} 1... c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Nd7 5. Ng5 { out of book} 5... Ngf6 6. Bd3 e6 7. N1f3 h6 8. Nxe6 $17 (8. Ne4 $5 $10 { is noteworthy}) 8... Qe7 9. O-O fxe6 (9... fxe6 10. Re1 g5 $15) 10. Bg6+ Kd8 11. Bf4 $17 (11. Re1 $15) 11... b5 $15 (11... Qb4 $17) 12. a4 Bb7 (12... Nd5 13. Bg3 bxa4 $15) 13. Re1 Nd5 14. Bg3 Kc8 $16 (14... b4 $5 $10 { and Black could well hope to play on}) 15. axb5 $14 (15. axb5 cxb5 16. Qd3 $10) 15... cxb5 16. Qd3 Bc6 $14 (16... Nc7 $10) 17. Bf5 exf5 18. Rxe7 Bxe7 $2 $18 ( 18... Nxe7 {and Black can hope to survive} 19. c4 Be4 $16) 19. c4 1-0

Now you can see how everything is standardized. There is always a space after a move number. Commentary is enclosed in brackets. Chess symbols are designated with a dollar sign. For example, after Black's 14th move, the assessment is Black has a definite advantage, not Black's move is worth $16 (although it might have been had this been a game from my old barroom hustling days; if I'd had White in this position, I probably could have copped $16 easily).

This standardized notation has become the way to swap games on the Internet. That's because most chess programs will convert this standardized text format to their own proprietary formats. The name of this standardized format is PGN, which stands for Portable Game Notation.

I can hear one heckler in the back row saying, "Of course it's portable! You just put it on a floppy disk and carry it with you!" Uhhh...right. Think back to every movie about colonial exploration you ever saw. You know, the kind with Spencer Tracy leading the expedition to find the Northwest Passage/locate Dr. Livingston/climb Mt. Everest/loot King Solomon's Mines, etc. Remember how he never broke a sweat, because the only things he carried around were a map and compass? Remember the dozens of poor slobs around him, the Indians/Ubangis/Sherpas/Afghans/other indigenous people who were sweating and straining with huge packs on their backs, schlepping all of Spencer's weighty crap through the jungle/across the desert/up the mountain?

Those poor underpaid guys were called "bearers" or "porters". They "ported" all of the Bwana's junk around while he got all the glory. The "portable" in Portable Game Notation means that you can port/copy/transfer/schlep/other verb your chess games and data quite easily from one chess program to another (the big exception being porting from a Mac to a PC; that particular "King Solomon's Mine" will never be easily found, I'm afraid).

Most chess program users love to have their games in a variety of formats for use by different programs. PGN makes this easy. I just fire up ChessBase, transfer some games from .CBF format to .PGN format, launch Chess Mongrel 9000 and use its built-in conversion tool to change my .PGN file to a .DOG file. What could be easier? (Besides hiring some Sherpas/Afghans/etc. to do it for me?)

The point I'm driving at is that you can't just use Windows File Manager (or File Mangler, as I prefer to call it) to rename a file's extension and expect it to work. You need to convert ("port") the games from one format to another, a process which isn't much harder then renaming the files.

ChessBase makes this process particularly easy. Good thing, too, as ChessBase now recognizes files in three formats:

How does one convert from one format to another? Let's look at a couple of examples.

You've just downloaded a .PGN file of the games of the Canadian Cadet Championships (CCC.PGN) from the Internet to your computer. If all you want to do is play through a few of the games, you can start ChessBase, click on "Open" in the Database menu, find the drive and directory of where your .PGN file is located, double-click on it (CCC.PGN), and get a game list of all the games in the file. You can then play through them at your leisure.

But let's say that you want to convert the data to .CBF format for use with your ChessBase program. In that case, you'd click "Open" in the Database menu and repeat the steps given in the last paragraph. This time, though, close the games list and you'll see a new (temporary) icon for your .PGN file has been added to the Databases window.

Next, click on "New" in the Database menu. Select the drive and directory where you'd like to keep your new .CBF file. Now here comes the important step: in the File Name box, type in the name of your new file, making sure that the three letters after the dot correspond to the type of database you want to create. Two types of files can be created this way in CBWin: .PGN files and .CBF files. ChessBase 6.0 adds a third kind: .CBH (for the new ChessBase format).

So for the sake of our example, you would type in something ending in .CBF (let's say CCC.CBF). Click the OK button and you'll see a new icon appear in the Databases window; it's an icon for the new empty database you've just created. You can click on the "Information" button (the "i" inside the blue dot at the bottom of the Databases window) to change the icon's title and graphic as it appears in the Databases window.

Then to do the actual conversion, left-click on the icon for your .PGN database and hold down the mouse button. You'll see the mouse cursor on the screen change from a simple arrow to an arrow pointing to a stack of papers. While holding down on the mouse button, move the cursor over on top of the icon for your new .CBF database. Then release the mouse button. ChessBase will now convert the games from .PGN format to .CBF format and copy them into the new database. Easy, huh? (By the way, this process is called "drag and drop").

How about changing a file from "old" Chessbase format to "new" ChessBase format? Simple. Just click "New" to start a new database (as described above), but this time end the file name with .CBH. Drag and drop from your old .CBF database over to the new .CBH database. Piece of cake.

You can copy/transfer/convert games freely from format to format, using all three formats, to your heart's content. The key to the process is this:

When creating a new database, make sure the file extension (the three letters after the dot) is the correct one for the type of file you want to create.

That's all there is to it. Just remember that merely changing the last three letters of an existing file name doesn't change a sow's ear into a silk purse. You have to use a program to convert the data.

One last thought before I go. A few paragraphs back, I was talking about how ding-danged difficult it is to convert Macintosh files to files that an IBM-compatible PC can use. It made me flash back to the movie Independence Day when Jeff Goldblum hooks his Apple Powerbook laptop computer into the alien mothership's computer to blow up the ship and thwart the invasion.

Think about that for a moment.

He uses the only computer whose architecture is totally incompatible with anything made on Earth to interface with a computer made by aliens (whose thought processes are presumably totally different from our own, and whose computers are logically equally alien) and achieves this interface in a matter of a few seconds???

I got the video for Christmas and I'm still laughing about this scene five months later. Hopefully this will keep you laughing until next Sunday, when we get together for another Electronic T-Notes. See you then!

I'm very interested in reading your opinions of this (or any other) issue of T-Notes, as well as my book Battle Royale. I invite you to post comments to our ChessBase Users Group or else you can e-mail me directly.