Ubuntu Linux and Chess -- using scid for analysis

Mar 24, 2012, 2:36 AM |

I did say in one of my earlier posts that I was a better software engineer than I am a chess player, and I think a few points here will illustrate that.  I'm going to talk about one of the programs I installed earlier, scid, and how to use it to analyse a game.

I will start by using my file manager to make a folder in my home folder into which I can save my chess games.  This is so that I can keep my files organised.  I will then load a game that I have recently finished playing on chess.com and see what I did right and what I did wrong.  I think I played a pretty good game, but stockfish seems to think I could have done better.

PGN files

When you see a chess game listed on chess.com, and sometimes you will see this on other sites or in emails, you will often see PGN files.  These are special files that contain the entire description of a game in a format that a computer can easily read (that's called parsing, for those of you who are more familiar with software).  Actually a PGN file is pretty easy for a human to read too, it just contains the game information as well as some moves in algebraic notation.

If you play chess on chess.com you can list your games and for each game you will see a "Get PGN" link.  That's visible for all of your finished games as well as your games in progress.  So, firstly I go to the list of online games I have finished playing, click "view" next to the game I want to see, and then click "Get PGN".  My browser (firefox) then asks me if I want to save the file, I say yes, and save it into the "chess" folder I made earlier.  Somtimes firefox will not ask you where to save it, it will just put files in your Downloads folder and you can move them from there (there is a way to configure firefox to ask you about where to save files, but this is a blog about chess not about firefox!).

Now I have a game saved into my chess folder and I can even upload it into this blog post, like this:




(that was a separate bit of blog magic, but if you've been here a while you will have figured out how to put PGN files into your blog).


The next thing I did was to start scid.  On my system it's on the menu in Games->Board (you might have to look in Debian->Games->Board depending on how your menus are set up), or I can just use a terminal, go into the chess folder where my game is stored, and type "scid" -- sometimes us Linux people just prefer to use the command line, it's faster!

Then, in scid, I used the File->Open menu to find my PGN file and load it into scid.  By default, scid will show you all of the files it can find that it knows about, and it knows about PGN files so if you've saved one from chess.com it should be there.  Now the game is loaded into scid and I can step through the moves one at a time by using the arrow buttons at the top of the game board.

Next I choose Tools->Analysis Engine and pick my engine from the list.  If you're like me you will have 10 engines listed there, I like to have them all loaded and scid will allow you to save all of their details (unlike xboard which only supports 2 engines).  My choice is stockfish and so I click that and then click OK.

stockfish immediately starts analysing the current position, as you will see in the Analysis: stockfish tab.  That's not what we want it to do though, so we will move on.

First, click on the notation tab.  That's where our engine will put its analysis output, but at the moment it just shows the game moves.  Here they are:

Now switch back to the Analysis tab.  At the bottom of the Analysis tab, there is a button that looks like a notepad and pen.  Click that button, it's the Annotate button.

The window that appears allows you to set various options, including the time given to the engine to analyse moves.  You can change this for deep analysis.  You can also ask the engine to annotate all moves if you want to see stockfish's detailed score for every move you make.  The output of that is fairly verbose so for the time being I will just ask it to annotate blunders (surely I didn't make too many of those in a game I won in 12 moves, but let's see!).

Click OK in that dialog and the analysis will start.  I left the settings as the default, 5 seconds per move and only annotating blunders, and here's what I got in the Notation tab:

... and so on.  Well I thought at the time that 6 ... Qh5 was a cunning plan to lure him into a trap, but stockfish thinks 6 ... Qf2 was much better.  So I will take that away and have a bit of a study over it and see how I can improve things next time.  Fortunately for me my opponent's next move, 7. Nc3 was also a mistake and I went on to win from there.  Stockfish also thinks that my castling at move 8 was a mistake, well to play more aggressively I could have gone with 8. ... Nxe5+ but I was winning at that point and I guess I play a bit more conservatively when I have the lead -- try to preserve that lead and not lose it!

You can use this method to analyse all of your past games.  Perhaps you will learn something, it's just like having a computerised chess coach.

Note that I didn't have an opening book set up for this analysis.  I will talk about setting up opening books and endgame tablebases in another post.