Extending the
Opening Move Database
The default opening move database can easily be
extended by any user. This is because although it's stored in compressed
tree
form for the actual program, the tree is created by parsing a user-friendly
text file. You can examine the eco.pgn file that comes
with the program.
The format for each opening entry is fairly straightforward. Here is a sample:
[Site "A00"]
[White "Amar gambit"]
1. Nh3 d5 2. g3 e5 3. f4 Bxh3 4. Bxh3 exf4
The first 2 (or more) lines must be enclosed in square brackets, and simply
contain information about the opening.
The "site" followed by a number is the official chess federation classification
of the opening, A00 in the above case.
The bracketed lines must be followed by a blank line.
Finally, the actual moves comprising the opening are listed in order. One
"move" is considered a move by both
players, hence the cardinal numbers 1,2,3 etc. appear in between every two
listed moves. The cardinal numbers
must have a period and a space after them. The moves must be recorded in
so-called "algebraic" format. You can
read about it at this site: algebraic chess
notation.
An opening database can then easily be created
using the ECOReader file of the program. The syntax is as follows:
java EcoReader filename
filename should be the name of the text file with the opening moves.
The program will take a few minutes to run for large databases. It will display
its progress in the process.
Subsequently, a new file of the same name as filename will
be created, but with the extention .db.pack.
So for example, the original eco.pgn text file is called eco.pgn.db.pack
in the compressed tree format.
To use the database, you need to execute the AIChess program with filename
as an argument as follows:
java AIChess filename
Back to main page