FinalGen is a chess endgame tablebase generator for Windows.
FinalGen is absolutely free. You can distribute the freeware version of this software providing that no additional fee is charged.


- FinalGen generates tablebases for chess endgames with up to one piece per side, and any number of pawns.

- The Search for draw option allows speeding up the process. When enabled, this option will search only for drawn results, but can run up to 10 times faster.

- The analysis area allows displaying variations.

- You can pause and resume the process at any time.

- FinalGen displays statistic information such as the estimated time remaining, the required hard disk space and the number of positions calculated.

- Available interface languages: English, French, Spanish, Russian, German, Italian.

FinalGen graphical user interface

Endgame tablebases

An endgame tablebase is a computerized database that contains precalculated exhaustive analysis of a chess endgame position. The tablebase contains the game-theoretical value (win, loss, or draw) of each possible move in each possible position, and how many moves it would take to achieve that result with perfect play.

Nalimov tablebases have solved chess for every position with six or fewer pieces (including the two kings). The whole set of tables requires 1153 GB of hard disk space. Some seven-piece positions have been produced as well.

Chess programs

Most of the time, modern chess programs play endgames well, but in some situations they exhibit a glaring weakness, as we will see later.

Most engines can consult tablebases as a kind of oracle to decide whether to exchange down into an endgame covered by the tablebase. A chess engine can for example avoid exchanging down to losing positions (even if they are very deep) or win by converting into an absolutely won endgame.

The tablebases of all endgames with up to six pieces are available for free download. Unfortunately, Nalimov tablebases require more than one terabyte of storage space.

What advantage has FinalGen over chess programs and Nalimov tableblases?

Unlike Nalimov tablebases, FinalGen is able to solve chess positions with 7 or more pieces. All examples presented here include more than 6 pieces on the chessboard (including the kings). Unlike chess programs, FinalGen produces the game-theoretical value (win, loss, or draw) rather than a mere evaluation.

Eiko Bleicher has designed a commercial program called Freezer, which allows users to build new tablebases from existing Nalimov tablebases with a priori information. The program can produce a tablebase for seven-piece positions with blocked pawns. FinalGen generates tablebases without any kind of a priori information.

Example 1: when computers are wrong

Number of pieces: 7. Execution time: 35 minutes.

The machine we used to generate these examples was a standard AMD Athlon 3500+ system with Windows XP installed and an external disk drive.

We also allowed Fritz 11 to analyse this position. Fritz 11, running on a single core gets you more than 1 million positions per second. 35 minutes later, the result was:
d4 -2.47
Nd4 -0.79
Ne7 -0.79
Ke6 -0.79
Nh4 -0.71
Ng7 -0.71
Kd8 0.00
Kc8 0.00
Ke8 0.00
Ke7 0.00
Ng3 +11.88
Nh6 +12.85
Ne3 +15.20
Nd6 +15.71

As you can see, Fritz considers d4 to be a winning move, whereas FinalGen found only a draw for this move.
The reason is that Black captures the white pawn in the most direct way by playing d4, but black pawns become weak and the black knight is tied down to the defence of the d-pawn.

A possible continuation will proceed:
1... d4 2. Kb4 Ne3 3. Be5 d3 4. Bc3 Nf1 5. Kb3 Ke6 6. Bg7 Kd5 7. Kc3 d2 8. Kc2 Kxc5 9. Bc3 Kd5 10. Bf6 (White must not take the pawn) Ng3 11. Ba1 (White has not played the most accurate moves, allowing Black to improve the placement of its knight, but this is not enough for winning) Ne4 12. Kd1 Kc4 13. Kc2 c5 14. Bg7 Kb4 15. Ba1 c4 16. Bh8 Kc5 17. Bg7 Kd5 18. Bh8 Ke6 19. Ba1 Kf5 20. Kd1 Kf4 21. Ke2 and Black cannot win.

It is interesting to notice that Fritz has evaluated some winning moves to be only 0.79 pawns better for Black, which is not definitive. Also notice that Fritz considers all king moves to be a draw.

What are the disadvantages of FinalGen?

Generating tablebases for positions with 8 or more pieces can be a long, time consuming process.
The time required to generate tablebases depends strongly on the number of pieces and the characteristics of the position. For 7-piece positions, the process can take between 30 minutes and 3 hours (with an AMD Athlon 3500+ processor).

FinalGen reaches its maximum efficiency when solving pawn endings. For instance, one hour can be required to solve a position with two kings and 6 or 7 pawns.

Notice that the amount of calculated positions for each endgame with more than 6 pieces grows to astronomical numbers (billions of positions for 7 pieces endgames).
However, when the process is finished, the analysis of all variations can be obtained almost instantaneously. FinalGen stores the evaluations of all positions that can be reached from the initial one by making legal chess moves.

A major limitation of FinalGen is that it can only manage endgames with up to one minor or major piece per side, and any number of pawns. Consequently, endgames in which there are 3 knights and king versus a king cannot be solved.

FinalGen has been designed to analyse practical chess endings. Normally you would never end up with 3 knights since you would make your promoted pawn a queen. This kind of endgame is probably of interest only to chess problem hobbyists.
Instead, it is more likely that you play an endgame with a rook and two pawns versus a rook and two pawns. In this situation you can use FinalGen to generate the tablebases for the position. The process will take some hours for an 8-piece position (or dozens of hours depending on the characteristics of the position).

Example 2

Number of pieces: 10. Execution time: 1 hour and 42 minutes.

One of the most famous positions solved with the method of corresponding squares is this endgame study composed by N. Grigoriev.

If squares x and y are corresponding squares, it means that if one player moves to x then the other player must move to y in order to hold his position. In some cases they indicate which square the defending king must move to in order to keep the opposing king away. In other cases, a maneuver by one king puts the other player in a situation where he cannot move to the corresponding square, thus the first king is able to penetrate the position. The theory of corresponding squares is more general than opposition, and is more useful in cluttered positions.

FinalGen is particularly efficient for solving this kind of position. The tablebases for this 10-pieces position were generated in 1 hour and 42 minutes.

We also let Fritz 11 do an infinite analysis on this position. After letting the program run for over 1 hour and 40 minutes, Fritz gave the following evaluations:
Kd1 +2.76
Kd2 +1.99
Kb2 +1.84
Kc2 +1.84
Kb1 +1.84
axb5 +1.61
a5 0.00

As you can see, Fritz considers that:
- Kd1 is the best move (which is true).
- Kd1, Kd2, Kb2, Kc2, Kb1 and axb5+ are all winning moves, which is false. Only Kd1 can force a win. The other moves result only in a draw.

In this ending, c5, d5, and g6 are key squares. If the white king can reach any of them, White wins.
If the white king moves to e4, then the black king must move to d6 in order to prevent White from occupying the key square d5. Remark: Moving to c6 allows the white king to reach g6.
With separated key squares, the shortest path connecting them is significant. If the white king moves to d4, then the black king must move to c6, and so on. The corresponding squares are: d4-c6, e4-d6, d3-c7, e3-d7, f3-e7, d2-c8, e2-d8 and f2-e8.

Thus the general formula is as follows: the white king has the opposition when he occupies, on a right hand adjacent file to the file occupied by the black king, a square of opposite colour to that occupied by the latter.

If the white king manages to reach the g6 key square, then Black can react in two ways:

1. Attacking the white pawns on the queenside. In that case, both sides will have single passed pawns racing to promote to a queen. Before occupying g6 White must ensure that he/she will win the resulting queen ending.

2. Moving toward the kingside and occupying e4 when the white king reaches g6. White can avoid zugzwang by playing a5.

Now we know the main characteristics of the position. White wins in two steps:
Step 1: taking the opposition.
1. Kd1 Kd7 2. Ke1 Ke7 3. Kd2 Kd8 4. Ke2 Ke8 5. Kd3 Kd7 6. Ke3 Kd6 7. Ke4 Kc6

Step 2: winning the race to promotion.
8. Kf3 Kd5 9. Kg3! (9. Kg4? Ke4=) Kd4 10. Kh4 Kc3 (10... Ke4 11. Kg4 Ke3 12. Kh5 Kxf4 13. Kg6 Ke5 14. a5 +-) 11. axb5 axb5 12. Kh5 Kxb4 13. Kg6 Kxb3 14. Kxf6 Kc3 15. Ke5 b4 16. f6 b3 17. f7 b2 18. f8=Q b1=Q 19. Qc5+ Kd2 20. Qf2+ Kc3 21. Qd4+ exchanges queens and wins.

The evaluation of a position

Unlike chess programs, FinalGen produces the game-theoretical value (win, loss, or draw) rather than a mere evaluation. The tablebases are generated by retrograde analysis, working backwards from checkmated positions.

Nalimov tables give the number of moves to the end of a game with best play. It is easy to play perfectly by looking up such a table.
In most cases, FinalGen gives a way to win too, but not necessarily the shortest one. For example, Finalgen might predict Win in 12 moves in a case where Nalimov tablebases indicate Win in 10 moves.

There is no notion of perfect play for a game which ends in a tie. Such a game is merely considered equivalent to a game which goes on forever because neither player can force a victory.

Not all positions can be solved by FinalGen. Sometimes, White or Black can force the promotion of a pawn, transposing into a different endgame that FinalGen cannot solve. In that case, the text Unsolved will be displayed. These unsolvable positions represent about 5% of all positions that can be generated.

Other times, after a pawn gets promoted, the position transposes into an endgame that FinalGen can solve. In such situations, the displayed result can be White wins or Black wins without specifying a number of moves. These positions are stored as bitbases which give the game-theoretical value of positions without the number of moves until promotion or mate.

When available, the evaluation of a position can be one of the following:
- "White wins. Mate." The black king is checkmated.
- "White mates in X." White checkmates in X moves.
- "White wins in X." A white pawn can promote in X moves, and White can force a win.
- "White wins." White wins, the number of moves is not known.
- "White wins or Draw." White can win or draw.
- "Draw."
- "Black wins or Draw", "Black wins", "Black wins in X", "Black mates in X", "Black wins. Mate". Analogous to the previous ones from black side.

Example 3

Number of pieces: 8. Execution time: 10 minutes with Search for draw option activated.

This is a study by A. Nimzowitsch. It is often used to illustrate the technique to win in a knight vs bishop endgame with blocked pawns. The "winning" plan is typically to expel the black king from light squares by delivering checks with the knight, thus allowing the white king to penetrate the position.

However, after generating the tablebases, we can see that the position is a draw with perfect play.

Let us take a look at the main line proposed by the author:
1. Nh4+ Kf6 2. Kh5 Bc7 3. Nf3 Ba5 4. Nh2 Bc3 5. Ng4+ Ke6 6. Kg6 Bd4 7. Nf6 Be3 8. Nh7 Bd4 9. Ng5+ Kd6 10. Kf5 Bc3 11. Nf7+ Kc6 12. Ke6 Bb2 13. Nxe5+ Kc7 14. Ng6 Kd8 15. Kf7 1-0.

After some moves (1. Nh4+ Kf6 2. Kh5 Bc7 3. Nf3 Ba5 4. Nh2) FinalGen still considers the result to be a draw. The move 4... Bc3 is the blunder that cost the game. Black should have continued with 4... Bd2 (or Bd8) 5. Ng4+ Kf7 6. Nxe5+ Kf6 7. Nd3 Ke6 8. Kg4 Be3 9. Kf3 Bg1 10. Kf4 Bh2+ 11. Kf3 Bg1 12. e5 Kf5 13. Kg3 Bd4 ½-½.

© 2012-2015 FinalGen. All rights reserved.

Publicidad: Mi pequeño museo