Sunday, October 25, 2009

My own chessanalysisprogram

Finally I found the time and energy to write my own chess analysis program. That is to say, I wrote the first step. I wanted to do that for about seven years. The problem with chess programs as Fritz etc. is that they don't give you a good insight in how they arrive at a certain move. When I tried to get insight lately in what aspect of piece activity causes the most problems for the opponent I missed that dearly.

The idea is as follows. The program reads a PGN file and shows it. For every aspect I want to investigate I write a specific algorithm that will show the development of that aspect during the game. For instance, I want to know how much every piece is standing in the way of other pieces. Or how many squares manoeuvring room each side has. The questions will change overtime when insight grows. The sky is the limit.

The parser for PGN games is now completed and it works like a charm. To be continued.


  1. You have beaten me to the punch! :) Writing some sort of chess engine was been a thought for me as well. Usually because of laziness it never was started.

    Well, good luck on it, and keep us updated.

  2. very interesting initiative.

    Are you going to do it open-source?
    Putting snippets and explanations should be very interesting, and people's comments can help improving the program and, of course, the comprensiom of the chess.

    In what language are you going to do that? I don't know how much people know programming around here, but a high level programming language as python (my preferred one) can make an algorith easily readable for everybody.

    In such programa, I supose there will be some different approaches to evaluate a positions without watching further moves, as how much squares is dominating each player, undefended pieces, etc.

    Keep us updated! :)

  3. I'm programming in eDeveloper. No open source. But there will be plenty to talk about. Commonly the pawn is used as a unit of measurement. That is an arbitrary choice. I'm going to investigate if I can use a more realistic unit based on the relationship between space and tempo's.

  4. Now that you mention the Pawn is an arbitrary unit, I've wondered from time-to-time whether "up a Pawn" is the most precise gauge of material.

    In order words, using the ratio of pieces remaining could be more accurate. If White plays a gambit and goes down a Pawn, ratio of remaining material might be 36/37. The Pawn may or may not be very important.

    But an endgame where White only has 2 Pawns to Black's 3, the ratio 2/3 accurately portrays White's dire need to equalize.

    Of course, this ratio idea could be useless, and at least needs refinement. For example, the 2/3 endgame example is the same fraction as a 20/30 midgame ratio (where White is down a Queen, and can safely resign.)

  5. LEP,
    the value of material is dynamic. A rook in the corner in some games wouldn't be missed when it would stand next to the board. In that specific case it's value is (close to) zero.You must measure what a piece is actually doing. How much possibilities does it take away from the opponent. That changes during the game.

  6. Hi,

    i did write my PGN-Parser in Java ( not quite complete). I plan to make some positional analysis with the aid of rybka and / or other engines via UCI.
    Analysing the places of the pieces by statistics of several automatic games, compare the value of comparable pieces by "excange" them artificialy ... many posibilitys but lot of work to.

    I dont think a program with "elo"<2000 can give you valuable hints. Just counting possible moves might be not enough. These moves have to be "important" to. And an engine with elo>2000 is not that easy to write.

    The source of Toga II is open.

    I still would like to have a chesstempo-like puzzle program wich teaches/correct me my own errors:
    Analyse games, find errors of user, present as puzzle, let user judge position +- +/- ... and ask for best possible move, give feedback, decide when to pesent this position as puzzle again.

  7. Uwe,
    I dont think a program with "elo"<2000 can give you valuable hints. Just counting possible moves might be not enough. These moves have to be "important" to. And an engine with elo>2000 is not that easy to write.

    It's not the machine that does the work but the thinking about the subject.

  8. Very cool

    I like using ELO instead of pawns as unit of measure. E.g., being down a queen you can expect to lose to someone with ELO 600 lower than you. A pawn is worth about 40 ELO. I think Soltis does this based on work of Kauffman (reevaluating the pieces or some such article).

  9. Yes, there are a lot of factors to evaluate the worth of a piece!

    Interestingly, there's an article in the current Chess Life which mentions briefly how programs might assign a value to gambit, mobility, or tempos.

  10. Might be interesting for you:

    cyclone xTreme user configurable parameters:
    PieceActivityWeightOpening 256
    PieceActivityWeightEndgame 256
    KnightUnit 4
    BishopUnit 6
    RookUnit 7
    QueenUnit 13
    MobMove 1
    MobAttack 1
    MobDefense 0
    KnightMobOpening 4
    KnightMobEndgame 4
    BishopMobOpening 5
    BishopMobEndgame 5
    RookMobOpening 2
    RookMobEndgame 4
    QueenMobOpening 2
    QueenMobEndgame 4
    KingMobOpening 0
    KingMobEndgame 0

    Source here

    Elo "2974"