Computer generated Opening set
Posted: Fri Dec 27, 2013 10:41 am
The problem with all opening books and opening sets is that they are generally compiled from GM games
That's it! It's all we need (and a little bit of Linux shell, of course).
We start with a file book0 containing a single line (starting position):
We apply the algorithm and the resulting file book1 looks like this:
There are 20 positions in the 1-ply opening set, because the 20 legal moves of the opening position all lead to an acceptable position (12 ply search within acceptable bounds). This is basically the same as perft(1).
We now iterate again, applying the algorithm to book1 and the resulting file book2 has 374 lines:
Of course, 374 depends on the engine used. Some blunders have already been filtered, because perft(2)=400 (26 blunders filtered).
We iterate again, to obtain book3 with 7362 lines:
Now, for the first time, we have transpositions, so the book3 FENs are not unique. There are 5484 unique ones:
So we put the unique enumeration of the FENs in book3.u and iterate on book3.u to produce book4. Then we uniquely enumerate book4 into book4.u. And so on, ad nauseam.
I'm currently generating book4. Not finished yet. I'll put it for download once finished. I'm expecting around 100k unique starting positions from 2 moves only (4 plies).
- These include lots of blunders, and most books are not systematically comp filtered.
- Human games have very poor diversity, but instead go deep along main lines.
Code: Select all
read input stream line by line (each line is assumed to be a FEN):
for each FEN, generate legal moves from that position:
for each legal move:
play the move
if the result of a 12 ply search is within acceptable bounds +/-70cp:
print the resulting FEN into the output stream
undo the move
We start with a file book0 containing a single line (starting position):
Code: Select all
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
Code: Select all
rnbqkbnr/pppppppp/8/8/8/N7/PPPPPPPP/R1BQKBNR b KQkq - 1 1
rnbqkbnr/pppppppp/8/8/8/2N5/PPPPPPPP/R1BQKBNR b KQkq - 1 1
rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R b KQkq - 1 1
rnbqkbnr/pppppppp/8/8/8/7N/PPPPPPPP/RNBQKB1R b KQkq - 1 1
rnbqkbnr/pppppppp/8/8/8/P7/1PPPPPPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/8/1P6/P1PPPPPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/8/2P5/PP1PPPPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/8/3P4/PPP1PPPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/8/4P3/PPPP1PPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/8/5P2/PPPPP1PP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/8/6P1/PPPPPP1P/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/8/7P/PPPPPPP1/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/P7/8/1PPPPPPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/1P6/8/P1PPPPPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/2P5/8/PP1PPPPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/5P2/8/PPPPP1PP/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/6P1/8/PPPPPP1P/RNBQKBNR b KQkq - 0 1
rnbqkbnr/pppppppp/8/8/7P/8/PPPPPPP1/RNBQKBNR b KQkq - 0 1
We now iterate again, applying the algorithm to book1 and the resulting file book2 has 374 lines:
Code: Select all
$ wc -l ./book2
374 ./book2
We iterate again, to obtain book3 with 7362 lines:
Code: Select all
$ wc -l ./book3
7362 ./book3
Code: Select all
$ sort -u ./book3 |wc -l
5484
I'm currently generating book4. Not finished yet. I'll put it for download once finished. I'm expecting around 100k unique starting positions from 2 moves only (4 plies).