Book format for the new engine

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
Master Om
Posts: 449
Joined: Wed Nov 24, 2010 10:57 am
Location: INDIA

Re: Book format for the new engine

Post by Master Om »

Dragan wrote:I am writing a new chess engine. Hope to have something by the end of the year.
My questions is about the book format. Is there any standard book format that I should be implementing or every engine has its own?
Is there any benefit either way?
I would love if you write a pgn book.
Like Crazy Bishop does. Just use a pgn base as book. We can add all moves with ! !! !? and ?? and it will select what to play. The advantage will be easy to edit and can be used in any GUI. We can have manual games and merge it to have a main line and variations. U need a good parsing program.
Always Expect the Unexpected
User avatar
velmarin
Posts: 1600
Joined: Mon Feb 21, 2011 9:48 am

Re: Book format for the new engine

Post by velmarin »

I have quite this file with the computer.

I think I can help, here's the link, even at the end is translated into Spanish.
http://www.mediafire.com/?ip37imzmk85k756


I recall that Scid GUI can be set polyglot books, it takes work but it does well.
This is a small part:

Code: Select all

polyglot make-book -pgn games.pgn -bin mynewbook.bin -max-ply 200

Here is what Denis posted on Reborn forum on bin book creations:

The first are short books from large number of games (say at 100, 200, 300 etc), you can add some syntax on maximum ply (~ 8 to 10 plies ) and minimum games:
Los primeros son pequeños libros de gran número de juegos (por ejemplo en 100, 200, 300, etc), puede añadir un poco de sintaxis en capas máximo (~ 8-10 capas) y juegos como mínimo: 
polyglot make-book -min-game 1 -uniform -only-white -pgn games.pgn -bin w1.bin -max-ply 8 -min-game 100
polyglot make-book -min-game 1 -uniform -only-black -pgn games.pgn -bin b1.bin -max-ply 8 -min-game 100
(You can remove the syntax -uniform if you like!)

The second books are made from games leading to the most desired results: wins by White, wins (and draws if you like) by Black, both against not too weak opponents. Extracting the games is easy through the 'HeaderSearch' function in SCID (by Pascal George).
Los libros de segunda se hacen de los juegos que conducen a los resultados más deseados: gana por White, ha sufrido (y señala si se quiere) de Negro, tanto contra los opositores no demasiado débil. Extracción de los juegos es fácil a través de la función 'HeaderSearch en SCID (por Pascal George). 
polyglot make-book -pgn White.pgn -bin w2.bin -max-ply 80 -min-game 1 -only-white
polyglot make-book -pgn Black.pgn -bin b2.bin -max-ply 80 -min-game 1 -only-black

This constitutes a large part of the book so be sure to edit/handtune the games perfectly using SCID or any pgn utility available. Adjust the number of plies say at 40-80 (experiment!). It maybe necessary not to use -only-white or -only-black if you want to use the drawn lines - another option to think of. In the first place, you are using pure win games for black and white separately.
Esto constituye una gran parte del libro, así que asegúrese de editar / handtune los juegos perfectamente con SCID o cualquier utilidad pgn disponibles. Ajuste el número de capas de decir en 40-80 (experiment!). Es tal vez no sea necesario utilizar sólo en blanco o sólo negro-si usted desea utilizar las líneas dibujadas - otra opción que pensar. En primer lugar, está utilizando los juegos de pura ganancia para blanco y negro por separado. 
The third books are for covering your tracks in case your opponent diverges early from the paths that are known and built into your "2nd" books.
Los libros de terceros para cubrir sus pistas en el caso de que su oponente se aparta a principios de los senderos que se conocen y se construye en su "segunda" libros. 
Por estas tomamos la base de datos completa (games.pgn), mismo número de capas como "segundo" los libros, la puntuación de min-~ 52% para el blanco (mín-La puntuación de ~ 40% de Negro), min-juego 1. Ajuste y experimentar también en estos parámetros. 
For these we take the whole database (games.pgn), same number of plies as "2nd" books, min-score ~52% for white (min-score ~40% for Black), min-game 1. Adjust and experiment too on these parameters.

polyglot make-book -pgn games.pgn -bin w3.bin -max-ply 80 -min-game 1 -min-score 52 -only-white
polyglot make-book -pgn games.pgn -bin b3.bin -max-ply 80 -min-game 1 -min-score 40 -only-black

Merge your 'bin' files:

Start with 'white':
polyglot merge-book -in1 w1.bin -in2 w2.bin -out w12.bin
polyglot merge-book -in1 w12.bin -in2 w3.bin -out w123.bin

Then 'black':
polyglot merge-book -in1 b1.bin -in2 b2.bin -out b12.bin
polyglot merge-book -in1 b12.bin -in2 b3.bin -out b123.bin

Finally, build your customized polyglot book:
polyglot merge-book -in1 w123.bin -in2 b123.bin -out book.bin

I feel that is mixed is Spanish, but understood.
Greetings, Chema.