by Steve Lopez

Last week we created a new database and copied games into it. Now we'll examine how to merge those games into an opening tree.

A note on nomenclature: there was a recent thread in the chess newsgroups on the difference between an opening book and opening tree. As far as Fritz5 is concerned, there is no difference. An opening book for Fritz in .ctg format is also a statistical game tree; it can be used as a means of giving Fritz opening knowledge and as a means of gaining statistical information for you the user. The terms will be used interchangably throughout this article.


The first step in the process is to create a new (empty) opening tree. This is pretty simple: just click on the Book button and select "New tree". If you're an octopus, you can use the keyboard shortcut instead: CRTL-ALT-SHIFT-F11.

The Windows file selector will appear to let you pick a folder in which to store this tree. Once you've selected a folder, you'll need to name your tree. Notice that the program defaults to "newbook.ctg". You'll want to change this name to something more relevant. A good rule of thumb is to give it the same name as the database you're planning on importing into the book.

Brief aside: I occasionally get a phone call from someone who is upset because Fritz plays the same opening repeatedly. Typically, this person has accidentally created an empty opening book (by clicking on "New tree" without understanding the function) and then played a game with Fritz. Those moves are now stored in this new opening book. The upshot is that Fritz will then play the same opening repeatedly, because that's all Fritz knows to play (it's the only line in the opening book).

Once you've given your new book a name, click "Save". You'll see the file selector vanish, to be replaced by a new empty tree on the right side of your screen.


A slow way to add moves to the tree is to do it by hand. Just make moves on the board and the moves will be added to the opening tree. You can use the cursor keys on your keyboard to move back and forth (and up and down) through the tree and add the variations you want. This has the advantage of allowing you to create a book with just the lines you want in it. The disadvantage of this approach is that it's time-consuming.


The fast way to create an opening tree is to import the games from an entire database.

Some caveats: an opening tree tends to be very large -- much larger, in fact, than the database from which it was created. This is because every position in the database must be linked to every possible previous position and following position (based, of course, on the games in the database). This allows the tree to take advantage of transpositional possibilities but does require quite a bit of storage space for the pointers. It's not unusual for a database on a single opening to take up over 100 Mb of hard drive space if it's created from as few as 15,000 to 20,000 games (depending on the number of traspositional possibilities.

Also, if you're going to create trees based on the games of specific players, be sure to create two separate trees: one for the player as White and one for the player as Black. Otherwise you have no way to differentiate between the moves the player made and the moves made by his opponents.

Importing a database into a tree is pretty easy. Just click the Book button and select "Import games" from the menu (or use the keyboard shortcut CTRL-SHIFT-F11). You'll see a file selector appear that lets you choose the database to be imported. Click once on the database name to highlight it, then click "Open". You'll then see a window that looks like this:

This allows you to fine-tune the data that's being imported and merged into a tree.

"Games" is simply the game numbers you want to import. The defaults are "1" through the last game in the database (in the example above, there are 284 total games in the database). Typically, you'll leave this alone. However, if you later add games to the database and want to just import them into the tree, this is a handy tool. Let's suppose I add twenty games to this database a week later. If I decide to also import them into this tree, I can just change the values to "285" and "304" to import only the new games I've added.

"Length" is explained pretty well in the manual. Choosing "ECO-relative" plus a number allows the program some leeway: it will make the main line variations longer than the oddball side variations. If you pick "Absolute length" and a number, it will make all the variations the length you chose, regardless of whether the variation is a main line or side line.

Remember that the higher you set the number, the larger (and more space-consuming) the tree becomes. What number should you choose? I can't give you a hard and fast answer, but I personally don't see a reason to set this higher than 40 or lower than 20.

"Include variations" is important if some of the games from your database contain commentary in the form of sub-variations. Selecting this box includes these variations in the tree (but does not alter the statistical information, which is still derived solely from the moves actually played).

When you're finished with these settings, click "OK". You'll see a progress bar appear, keeping you posted as to how close Fritz has come to completing this merging process. It's normal for the program to pause a few times as it creates the tree (it's organizing the moves).

When the process is complete, you'll see a menu of moves where the empty tree had been and a small window saying "x new positions" (this tells you how many positions total are in the new tree). Click OK, and you're finished. The tree is loaded and ready to be used by you and Fritz.

Don't forget that you can easily switch between opening trees by clicking on the Book button, selecting "Load book", clicking the "Load" button and then using the file selector to switch to a different tree.

So now, my friend, you can go forth and create as many opening books as your disk space will allow. Until next week, have fun!

You can e-mail me with your comments, suggestions, and analysis for Electronic T-Notes. If you love gambits, stop by the Chess Kamikaze Home Page and the Yahoo Chess Kamikazes Club.