Author: Andrew Williams
Date: 15:21:17 04/26/02
Go up one level in this thread
Hi Uri, I posted this ages ago. I thought I'd lost it, but Will's idea reminded me of the CCC search engine. It says nothing about book learning, but Bob Hyatt published a really good paper in ICCA about that a couple of years ago. This description is now out of date for PM, but it's how I started out: Creating the book ================= PostModernist's opening book is made up of games from Dann Corbit's ftp site. I process the pgn files and create what I call a "binary" book, which consists of records with the following information: * Hash key (same as the one I use for my hash table) * WhiteWins (ie how many times has this position occurred in games which were eventually won by White). * BlackWins (see above) * Draws (see above) I convert the pgn file(s) using the following process: 1 Read in a game. 2 Keep track of the result (white won, black won or draw). 3 Starting from the beginning of the game I do this: 3a Generate the hash key for this position. 3b Create a new book record for this position. (or if the position is already in the book, I just update the existing book record. 3c Depending the result of the game, I increment the appropriate field in the record. 3d Read the next move in the current game and go back to 3a. 4 When I've completely processed one game, I read in the next game and go back to step 1. Once this process is complete, I have an opening book which consists of a set of positions that have occurred in the games from which I created the book. For each position, I know how many times White won, how many times Black won and how many times the game was drawn. The positions are indexed by the 64-bit hash key. Using the book ============== Suppose PM is playing White. It does this: 1 Generate all the moves from the starting position. 2 For each move do this: 2a Make the move on the board. 2b Generate the hash key for the resulting position. 2c Look in the opening book for the position. 2d If the position is present in the book, create a "score" for the position based on the WhiteWins, BlackWins and Draws fields. At the moment, I use WhiteWins+Draws as the score (assuming PM is playing White of course). 2e Keep a record of the move and score. 2f Unmake the move. 2g Get the next available move (from those generated in 1) and go to 2a. 3 Once these steps are done, I have a list that looks like this: Book move: b3 score: 104 Book move: c4 score: 2180 Book move: d3 score: 26 Book move: d4 score: 11191 Book move: e4 score: 14800 Book move: f4 score: 115 Book move: g3 score: 235 Book move: Nh3 score: 2 Book move: Nf3 score: 3105 I then use a random number to select amongst these options In step 2d, you can be quite creative about how to score the positions. eg assuming PM is playing White, I exclude any position where WhiteWins+Draws < 1.5*BlackWins. For many reasons, using these frequencies is not a foolproof way to select moves in the opening. Therefore, some programs (most?) also include a SearchScore field in their book records, which reflects the score for the program if the position is actually searched (as opposed to selected by frequency). This raises two problems: (a) When do you fill in this field? (In the description above, you would NEVER search the position if you've got frequency information in the book). (b) How can you compare frequency scores with search scores? Bob Hyatt wrote an article about book learning in a recent issue of ICCAJ which answers both these questions. Hope this helps. Andrew
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.