My goal was to create an opening book of games not played by grandmaster but my "amateurs" (<2000 Elo). It's not relevant whether this is useful or not—what happens when you try to do it is relevant. My filter criteria were:
1 Elo 1200-1999 for both players
2. Slow games (i.e. not blitz and rapid)
3. Games with result only (1:0, 1/2:1/2, 0:1)
4. At least 7 moves (to filter out fragments)
5. Start position as move 1 (to filter out fragments whose first move is actually move 35 or something in a game)
Points 4 and especially 5 took me some time to realize and is necessary because there's a lot of garbage in the database.
This leaves 1,126,331 games with an average Elo of 1713. I've exported them to PGN and got a 1.11GB file. Of course, polyglot won't take it:
Code: Select all
./polyglot make-book -pgn ~/mega-2021-amateurs.pgn -bin ~/mega-2021-amateurs.bin -max-ply 24
PolyGlot 1.4.70b by Fabien Letouzey.
inserting games ...
tellusererror POLYGLOT: lexical error at line 1, column 0, game 1
Code: Select all
hexdump -C -n 50 mega-2021-amateurs.pgn
00000000 ef bb bf 5b 45 76 65 6e 74 20 22 42 72 69 74 69 |...[Event "Briti|
00000010 73 68 20 55 6e 69 76 65 72 73 69 74 69 65 73 2d |sh Universities-|
00000020 63 68 54 20 50 72 65 6c 69 6d 20 42 22 5d 0d 0a |chT Prelim B"]..|
00000030 5b 53 |[S|
00000032
Code: Select all
dd bs=3 skip=1 if=mega-2021-amateurs.pgn of=mega-2021-amateurs-nobom.pgn
Code: Select all
tail -c +4 mega-2021-amateurs.pgn > mega-2021-amateurs-nobom.pgn
Code: Select all
./polyglot make-book -pgn ~/mega-2021-amateurs-nobom.pgn -bin ~/amateurs-2021.bin -max-ply 24
PolyGlot 1.4.70b by Fabien Letouzey.
inserting games ...
allocating 1.25MB ...
allocating 2.5MB ...
allocating 5MB ...
allocating 10MB ...
10000 games ...
allocating 20MB ...
20000 games ...
30000 games ...
allocating 40MB ...
40000 games ...
tellusererror POLYGLOT: book_insert(): illegal move "Z0" at line 1237737, column 47,game 41420
Code: Select all
./pgn-extract --fixresulttags --nobadresults --novars --output ~/mega-2021-amateurs-fixed.pgn -llog.txt -s ~/mega-2021-amateurs-nobom.pgn
Code: Select all
polyglot info-book -bin mega-2021-amateurs.bin
PolyGlot 1.4.70b by Fabien Letouzey.
Lines for white : 246580
Lines for black : 249507
Positions on lines for white : 199806
Positions on lines for black : 199305
Isolated positions : 12680