by Steve Lopez

What is an opening key? Don't feel badly if you've ever asked that question; ten years ago when I got my first copy of ChessBase 4 I struggled with this one too.

Have you ever look at those Winning with the ... opening books and seen an index of variations in the back of the book? In essence, that's what an opening key is: an index of openings to help you find the games of a particular variation.

Before we begin building a key, we'll need to understand how keys are structured. The game of chess involves a tree of possible moves: unless you're in check with one only legal way out, everytime it's your turn to move you'll find multiple possible moves in that position. I'm not saying that they'll all be good moves, but there are almost always multiple possibilities. As a simple example, after the moves 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Bxc6 (the Ruy Lopez Exchange Variation), Black has several possible moves. In practice over the years, only two stand out: 4...bxc6 and 4...dxc6 (and you could argue that only the latter is good, but that's not the purpose of the example). So we have a very small tree of possibilities at this point, with just two branches.

Opening keys are basically indexes that follow this "tree" of moves. If you created a very simple key on the Ruy Exchange, your key's first screen could look like this:

1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Bxc6

When you double-click in this line, a new screen would appear which looks like this:


And when you double-clicked on either of these two entries, you'd get a list of games in which that variation was played (so, if you were to click on 4...dxc6, you'd get a long list of games in which that move was made). In theory, this would be fine. But in practice, this doesn't go far enough -- if you wanted to go deeper into the tree to find all the games in which White played a particular fifth move, you'd have to try to pick them out manually (and individually) by looking for them in the list. So you'll need to create further subkeys -- keys that display subvariations of the previous variation.

To illustrate this, we'll look at an existing key: the master ChessBase key that comes with Big Database or Mega Database. If you double-click on the icon for one of those databases (we'll use Mega for the example), you'll see a game list for that database. Click on the "Openings" tab at the top of this display. The screen will change to show the following entry:

A -- 1.---
B -- 1.e4 ---
C -- 1.e4 e6 / 1.e4 e5
D -- 1.d4 d5 / 1.d4 Nf6 2.c4 g6 (3.Nc3 Bg7)
E -- 1.d4 Nf6 2.c4 e6 / 1.d4 Nf6 2.c4 g6 3.Nc3 Bg7

...each of which is followed by a particular move order. These five entries correspond to the five volumes of the Encyclopedia of Chess Openings (ECO). As a brief summary, Volume C covers the French Defense and all double King pawn openings. Volume B covers all 1.e4 openings in which Black replies with something other than 1.e6 or 1.e5. Volume D contains all of the double Queen pawn openings and all openings in which 3.Nc7 Bg7 doesn't follow the opening moves 1.d4 Nf6 2.c4 g6 (that's what the parentheses mean in the list above: that those moves are not played -- so, in other words, it's the 1.d4 Nf6 2.c4 openings in which 2...g6 is played, but 3.Nc3 Bg7 doesn't follow). Volume E has the openings in which either 2...e6 or 2...g6 3.Nc3 Bg7 follow 1.d4 Nf6 2.c4. And, finally, Volume A contains everything that doesn't fall into the categories of the other four volumes (stuff like the English and the various flank openings).

Let's say that you're looking for Ruy Exchange games. You know that the opening moves are 1.e4 e5, so you'd double-click on the "C" line to see further subkeys, that is, the places where the game tree branches after 1.e4 e5:

This shows the ways in which the game can branch out after 1.e4 e5. For example, the first two categories are the French Defense (and the specific category depends on what White plays after 1...e5). The other eight categories are the 1.e4 e5 openings. If we're looking for the Ruy Exchange, we'd want C6 -- this shows that White plays 3.Bb5 but that the next moves aren't 3...a6 4.Ba4 etc. (remember that White plays 4.Bxc6, not 4.Ba4). So we'd double-click on the C6 line:

And we now see deeper subvariations. Looking at the list, we can see that we want either C68 (if Black doesn't repond with 4...dxc6) or C69 (if he does play 4...dxc6). By the way, C68 and C69 are referred to as the ECO code of these openings. It's an internationally-used alphanumeric system that doesn't rely on language to name openings -- they're "named" by this code instead. That way, a guy from Europe isn't talking about the Volga Gambit and a guy from the States isn't saying "Benko Gambit" and neither guy knows what the heck the other is talking about. They both use "A57", "A58", or "A59" (depending on the variation) and both guys are on the same proverbial page.

So let's say that you want all of the 4...dxc6 games. You'd double-click on that line (C69) and see:

And double-clicking on any of these variations takes you to a list of further subvariations, until you finally reach a point at which you see a list of games displayed; these games will be ones in which the last variation you clicked on was played.

What ECO is, at its heart, is a hierarchy of moves. You go down the hierachy a step at a time until you find the information you want. It's just like those variation indexes you see in chess opening books (with subvariations listed indented below the previous variation), but instead of page numbers you get a list of the games themselves (and you just double-click on a game from the list to get a board window that lets you replay that game). And, while I'm thinking about it, if you double-click on the wrong variation in an opening key and want to return to the previous screen, just double-click on the line containing two dots up at the top of the list. This takes you back one screen to the previous level.

So how does an opening key handle transpositions (two different move orders that reach the same board position)? We'll likely get into this in a bit more detail later, but all you need to know right now is that an opening key doesn't operate via move orders -- it operates via positions. Every entry (i.e. line) in an opening key has a board position associated with it. When ChessBase classifies games (that is, sorts them into the proper keys) it plays through the games backwards (from the game's end back toward the beginning) until it hits a position that it recognizes from the opening key. It then classifies that game into that particular key. It would be as though someone handed you a stack of manila file folders, each of which had a chess position printed on the front. They then hand you a stack of gamescores from the World Open and tell you to sort the games into the proper folders. You'd then play through the first game until you saw a position you know you have a folder for, and then stuff that gamescore into that folder. That's what ChessBase is doing, but instead of stuffing scoresheets into manila folders, it's classifying games into opening keys. So transpositions are handled automatically: the order of moves displayed in the key isn't the determining factor, it's the position reached instead.

Next week, we'll create an empty starter key and begin adding positions to it. Until then, have fun!

You can e-mail me with your comments, suggestions, and analysis for Electronic T-Notes.