Programming Chess Openings

Chess programming

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.

Programming Chess Openings

The program uses an opening library stored on disk. The opening book is a text file containing a list of positions ( in FEN notation) along with the number of white wins, black wins and draws achieved from each position in the past (either from Rival's experience if opening book learning is enabled, or from the games from which the opening book was created).

When asked to make a move, the program plays out each of the moves avaiable and compares the resulting position with each of the FEN positions in the library. If there is a match, the program plays the move based on the opening parameters in the computer play options.

The benefit to chess programs of using opening libraries is open to question. Many opening sequences lead to positions in which one side is down in material but the position is such that this loss can be made up within several moves. This is a situation that chess programs find hard to understand. Unless the recapture of material is within sight (i.e. within the search depth) on the program's next move, the program is likely to make a move that allows the opposing side to maintain the material advantage.

An example of this is shown in this example from a game played with Rival in its early development on a 486-33Mhz machine. Rival was playing black and the position shown below was reached following the move sequence 1. E2-E4 ..E7-E5 2. C1-F3 ..C8-F6 3. F3*E5 ..D7-D6 4. E5-F3 ..F6*E4 5. D1-E2.

Rival had no response to this position in its opening library and played 5. …D6-D5?? White's response of 6. D2-D3 won the knight which could not escape without leaving the black king in check. When Rival made its fifth move it almost certainly believed that the loss of the knight could be avoided by responding with 6. …F8-B4+.

Figure 5. Petroff Defense - Classical Variation. Position after 5. D1-E2. This position occurred in the games Spassky-Kasparav, Linares 1981 and Turin 1982, (Kasparov & Keene (1989))

If black had searched deeper it would have first noticed the loss of the knight and would then have realised that the loss could be prevented with 5 …D8-E7. However, the use of its opening library lead it to a position in which it was uncomfortable. Rival would have made the same mistake if it had been playing the black pieces in this situation although the move 5 …D8-E7 has since been added to the opening library.

Rival uses an opening library primarily to save time when using tournament time controls.