Sunday, 5 July 2009

Free as in Chess! Part I or how to make Chess Databases

Free as in Chess (part I!) or How to make Chess Databases



This post is about creating a strong, dependable, open and free Chess software suite. Chess can get pretty expensive for dedicated players as they need a strong engine to analyze their games and database software to store their games, add their own comments, create opening reports, check the opening repertoire of their opponents, solve complex endgames, analyze their opening novelties and cross check their analyses with recent top level games.

My aim is to demonstrate from the simple user’s perspective that there is no need to spend a single penny on proprietary software. All the software here is free and there exist downloadable binaries, no need for compilation. Also all software is cross platform, which means you can use it no matter if you like working on Linux, Mac or Windows.

Occasional players, who just want to play a game against a computer now and then, are fine using GNU chess and need to read no further :), the rest of the text is about obtaining impressive free chess software and how to use it. In this part, will cover how to create a database of chess games. In the next parts I will cover how to use the databases, create opening reports, use strong free engines that rank ~2900 Elo to annotate your games and follow the opening developments. In the following parts I will also cover how to make an opening repertoire, practice it and play training matches against the computer, play online chess and use free software for correspondence games. All that using only free software.

My real wish is that someone who runs a chess club or a chess federation reads this and uses the material in order to boost the performance of his club/federation. Imagine how good could it be if all youngsters could get a *free* software suite that has nothing to be jealous of from commercial programs like Chessbase.


The database program we are going to use is SCID (Shane’s Chess Information Database), which can be downloaded from here for windows and linux users or if you are a mac (woot!) user, click here !, download it and install it.

SCID comes, at least in the mac version, bundled with the extremely strong Toga II, engine, which is ranked 4th in the 2008 world championship, drawing with the world computer champion Rybka and has an Elo rating of 2868. Toga II is 100% on par with the best proprietary engines out there, Rybka excluded. If 2868 is not enough, then add Rybka, not open-source but freeware and is rated 3111, grab it from here, I strongly recommend in favor of Toga II as it is free as in freedom, not free as in beer. In the following parts I will cover more free engines, how to tweak them and how to incorporate them into SCID.

In order to create a Database using free software, first we need game collections which the software will manipulate. Some very nice databases are available for download, like the Million Database (1.7 million games!), high quality databases of selected games by Norm Pollock, New In Chess Yearbooks and This Week in Chess Issues.

Other databases worth looking into are ChessOK, ICCF archives, RusBase.

To download multiple .pgn files (e.g. from TWIC) fast use Firefox and DownThemAll!.

Before continuing, if you want to customize your chessboard, go to options->Chessboard.

ChessBoardOptions

After downloading these databases, open up SCID. We are going to make a SCID database for the Million game DB and the TWIC issues, the other databases can be constructed in a similar manner. At the end we are going to generate an opening report for Fischer’s defense in King’s Gambit accepted to provide a taste of what is to follow in parts II, III, IV and V !

In SCID, go to Windows->Database switcher.

DatabaseSwitcher

This is probably the most important SCID window and it is likely that you’ll want it open all the time you are using SCID. It allows you to switch databases, copy games from one database to another and copy games to the clipboard where you will be doing all your searches, reports etc.

Now it is time to create a new SCID database for the Million games pgn file. Go to File->New as shown in the picture,

NewDatabase

and name this database MillionDB.

SaveAsMillionDB

Now go to File->Open

FileOpen

and select the Million database (using a pgn selection) as seen in the pic,

SelectMillionDB

and you should get the following loading window

MillionDBloading

now, in the database switcher, drag (while left clicing) the pgn opened to the Million DB

CopyPGNtoMillionDB

voila!

Let’s see how to handle the TWIC database. First uncompress the .zip files, they should give .pgn files. As simple shell command does the tric, cat *.pgn > alltwic.pgn. Windows don’t have a unix shell installed by default but it is quite easy to install one, just grab cygwin.
Now similarly to the Million DB, create an new SCID database called TWIC, load alltwic.pgn
and drag and drop the loaded pgn file to TWIC database.

Now to provide a taste of what SCID can do we are going to see it create an opening report on the Fischer defence for King’s Gambit Accepted using the TWIC database. First drag and drop the TWIC database (holding the left click mouse button!) to [clipbase], which is where all the user processing should take place. Then click on the [clipbase] icon (selectes clipbase as the working database) and after that go to Windows->Tree Window

TreeWindow,

The tree window should now appear to the right,

clicke4

In order to reach the Fischer defence click on the e4 option,

Clicke5

then click on the e5 option and so on until the Fischer defence Tabiya is reached

FischerDefenceTabiya


Now we are ready to create an opening report! Go to Tools->Opening report

ClickOpeningReport

and you should see the Generating report bar

GenerateOpeningReport

voila! the report should now be right there

TheReport

One SCID feature I am particularly fond of is the ability to generate LaTeX reports, like the following

InPdf

InPdfVariations

To see the latex output of the opening report, you need a tex installation, for macs the one I use is TeXShop.


Now we are going to add player pictures & ratings to SCID so that our interface looks nice & has an up-to-date player information. These can be downloaded from here but today (5 Jul ‘09) this link contains an updated version of the ratings file. Please note, as the SCID website says, “You will only need ratings.ssp instead of spelling.ssp if you want to use the Add Elo ratings maintenance command in Scid” and regarding the photos “Scid can show a photo whenever a game by a player with a photograph is loaded. To install the photos, download photos.zip and extract its files to your Scid user options directory (~/.scid in Unix; the same directory as scid.exe in Windows) and run Scid. The Zip file contains two player photo files: gm.spf has photos for nearly 100 grandmasters and other famous players, and historic.spf contains more than 30 historic (pre-1930s) players.”.

To update the Elo ratings in all your databases, select the database you want from the database switcher window, click options->Select spellcheck file and select the file you downloaded

Spellcheckfile

don't forget to do what this little popup says

SpellcheckSaveOptions

and then go to the Windows->Maintenance Window

Maintenance

and click update Elo ratings.

UpdateElo.


Now you have updated the Elo ratings of your databse.


Alot more to come in the following parts: how to use the databases you created, create opening reports, use strong free engines to annotate your games, how to make an opening repertoire using SCID, practice it and play training matches against the computer, play online chess and & correspondence games. All that using only free software! no need to get one of those totally overpriced proprietary licenses

10 comments:

Roman said...

That's cool that you can do all those things with Skid; I like the ability to generate pdf from opening reports. For me from all the features of a chess DB package, the most important is the usability of the process analyzing my own games. If the board is too small and I can't resize it, or invoking the chess engine takes two clicks instead of one - I'd move to the package that lets me do those things more easily.

Does Skid have an ability to add plug-ins, or can it be scripted in a convenient way?
I've been tempted to write my own chess DB-style library in .NET because all the incarnations of Chess Assistant and Chessbase/Light/Fritz constrain me to what's exposed in UI.

bfree said...

Personally I find SCID easy to use, the board is quite big by default, much bigger than Fritz's board. In my copy of SCID (mac Leopard) the Options->Chessboard->size is grey atm but I never had a size issue, in fact this is the first time I looked this up.

Invoking an engine and doing analysis is a 1-click process, I will write more on analyzing games with SCID in the following parts of "free as in chess". Personally, I use Toga II (one can add more UCI & Winboard engines) and sometimes Deep Shredder which I had purchased before I learned about SCID (kinda regretted this, Deep Shredder mac doesn't even have an auto-annotate feature and it is quite pricey, while SCID does this for free).

I am not sure what you mean by plugins, if you mean create your own content like endgame exercises, tactics problems etc, yes you can. If you mean add features to SCID through plugins I don't know but I will look it up during the weekend.

At this point I should mention that SCID mailing list,

scid-users@lists.sourceforge.net

is excellent and imho is much more helpful than the support which some commercial products offer. SCID developers are actively watching the mailing list so this is probably the best place to ask about coding extensions for SCID.

Israel Chauca F. said...

@Roman: Scid's interface is written in Tcl, so it's quite easy to modify, there is one plug-in developed for SchemingMind.com, but it's the only one I know.

@bfree: Nice work! This tutorials are a great way to help new users. About the board size menu, if you are using the Dock Windows mode, the board will re-size to fit the window automagically, that's why that menu is grayed out, in Classic mode the board size is fixed using the menu and it shouldn't be greyed out.

Anonymous said...

At last some step by step instructions - fantastic - thanks, really useful indeed - I'll look forward to the following parts.

Roman said...

Thanks for the explanation about plug-ins - yeah, by plug-ins I meant "add features to SCID".

Anonymous said...

fantastic! thanks for putting together

Anonymous said...

That was great! And very well done. How long do we have to wait before the next one - I'm checking your blog every day or so.

Thanks for doing it.

Anonymous said...

This was very well presented and I'm almost convinced to use SCID. However, I'd like to know if it is possible to sort the games by moves or by either color? For example, in Chessbase, I can sort all games by the moves and get a list of games in order by variations or different moves. Secondly, I can also sort the games by white or black so I could get a list of games by a specific player. Can this be accomplished in SCID?

bfree said...

@ anonymous 29 July, sorry for the late reply, I was on vacations! I am a little caught up with work but after a milestone is achieved I will upload part II :).

@ anonymous 21 Aug, you can sort games by white/black and you can do a search to find the games of a specific player. I am not sure what you mean sort by moves, if you mean to be able to create an opening report, where all moves played in a certain position are indexed, you can, if you mean to have the database sorted by move (e.g. the first panel being 1.e4, 1.d4, 1.c4 etc etc and then for 1.e4 to have 1...c5, 1...e5 etc etc), this is done automatically in tree mode!

Anonymous said...

Waiting the part II
Good work !!!

Post a Comment