I'm interested in creating an chess endgame solving engine.

The endgames in chess are usually solved using the endgame table-bases generated by retrograde algorithm.

I have found that Artificial Intelligence and Genetic Algorithms have been applied to the chess programming.

However, before starting the implementation I wanted to find out whether the chess endgames can be played without the endgame tablebases?

If yes, then what are the pros and cons of these alternatives to endgame tables?

Are there any other algorithms known for this problem?

  • 3
    Genetic algorithms aren't the best approach. Brute force with pruning - that's how the strongest chess engines work. Genetic algorithm or neural networks etc. are good for finding solutions that are "good enough", but chess requires 100% accuracy. If you overlook one good countermove, your great move is useless. – Konrad Morawski Dec 30 '13 at 13:01

Without any precalculated tables, you can just build a standard chess playing engine (not specifically for endgames). Look, for example, here for a starting point. To optimize such an engine for endgames, you can try to automatically adapt your evaluation function whenever you identify a "known endgame" situation for which you have a specific evaluation strategy ready.

Pros: you will need typically much less storage than for a table-based solution. End game tables for 5,6 or 7 pieces will AFAIK need several Giga- or Terrabytes (rough guess of mine), for more pieces a table based approach won't be feasible any more.

Cons: Your AI will be far from perfect (as opposed to an endgame table, which allows the engine to play perfect). End game situations suffer typically from the "horizon problem". See this Wikipedia article about what was achieved over the last years by using table based retrograde analysis. You cannot expect to get such results from a standard engine.

  • 1
    It should be noted that endgame tablebases available today only cover a very small percentage of all endgames. The biggest tablebases are for 7 pieces on the board (not per player!). Even though there is no clear definition of where the endgame starts, most authors would agree that it starts considerably earlier. In other words, it is only late stages of endgame (endgames' endgames, so to speak :) ) that are solved. – Konrad Morawski Dec 30 '13 at 12:55

Tableabase is not necessary for endgames.

Typically, this is done by designing two evaluation functions, one for middle game and one for endgame. For example, we'd prefer to move the king closer to the centre in the endgame.

Let's take a look at the Stockfish code:

In https://github.com/official-stockfish/Stockfish/blob/master/src/evaluate.cpp

#define S(mg, eg) make_score(mg, eg)

Stockfish defines it's scoring for both middle game and endgame.

Chess engine is fine for most endgames unless there are serious issues with search horizon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.