Help Create Tiny Opening Book for GNUchess (to vary play)

Discussion of chess software programming and technical issues.

Moderator: Ras

Dann Corbit
Posts: 12790
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by Dann Corbit »

Dann Corbit wrote:
chessdev wrote:target size is under 20kb. all we really need is variety. maybe cutting off the book at 5 or 8 or 10 moves would work. even cutting off at 5 moves would yield thousands of possible games. :) smaller the better as it has to load in the browser.
It is very hard to make one an exact size, so I will create a series of books.
This one is 176,885 bytes:
http://cap.connx.com/chess-engines/new- ... ok.dat.bz2
Now that I have looked carefully at the code, you will have to change the source code if we are going to use a smaller book file.

GnuChess just allocates a fixed number of entries for the book (e.g. 2^20th in Gnuchess 5.07 and in the Java version of GnuChess:

Code: Select all

/*
 * We now allocate memory for the book dynamically,
 * according to the size field in the header of the binary
 * book. However, during book building the following value
 * is used.
 */

    static final int MAX_DIGEST_BITS = 20;

    static int digest_bits;

    static int DIGEST_SIZE() { return (1 << digest_bits);}

    static int DIGEST_MASK() { return (DIGEST_SIZE() - 1);}
So a smaller book size simply will not work without changes to the source also.
Dann Corbit
Posts: 12790
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by Dann Corbit »

Dann Corbit wrote:
Dann Corbit wrote:
chessdev wrote:target size is under 20kb. all we really need is variety. maybe cutting off the book at 5 or 8 or 10 moves would work. even cutting off at 5 moves would yield thousands of possible games. :) smaller the better as it has to load in the browser.
It is very hard to make one an exact size, so I will create a series of books.
This one is 176,885 bytes:
http://cap.connx.com/chess-engines/new- ... ok.dat.bz2
Now that I have looked carefully at the code, you will have to change the source code if we are going to use a smaller book file.

GnuChess just allocates a fixed number of entries for the book (e.g. 2^20th in Gnuchess 5.07 and in the Java version of GnuChess:

Code: Select all

/*
 * We now allocate memory for the book dynamically,
 * according to the size field in the header of the binary
 * book. However, during book building the following value
 * is used.
 */

    static final int MAX_DIGEST_BITS = 20;

    static int digest_bits;

    static int DIGEST_SIZE() { return (1 << digest_bits);}

    static int DIGEST_MASK() { return (DIGEST_SIZE() - 1);}
So a smaller book size simply will not work without changes to the source also.
I think I figured out how to make it work. Here is a very small book of 4.5K:
http://cap.connx.com/chess-engines/new- ... ks.dat.bz2
Dann Corbit
Posts: 12790
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by Dann Corbit »

Dann Corbit wrote:
Dann Corbit wrote:
Dann Corbit wrote:
chessdev wrote:target size is under 20kb. all we really need is variety. maybe cutting off the book at 5 or 8 or 10 moves would work. even cutting off at 5 moves would yield thousands of possible games. :) smaller the better as it has to load in the browser.
It is very hard to make one an exact size, so I will create a series of books.
This one is 176,885 bytes:
http://cap.connx.com/chess-engines/new- ... ok.dat.bz2
Now that I have looked carefully at the code, you will have to change the source code if we are going to use a smaller book file.

GnuChess just allocates a fixed number of entries for the book (e.g. 2^20th in Gnuchess 5.07 and in the Java version of GnuChess:

Code: Select all

/*
 * We now allocate memory for the book dynamically,
 * according to the size field in the header of the binary
 * book. However, during book building the following value
 * is used.
 */

    static final int MAX_DIGEST_BITS = 20;

    static int digest_bits;

    static int DIGEST_SIZE() { return (1 << digest_bits);}

    static int DIGEST_MASK() { return (DIGEST_SIZE() - 1);}
So a smaller book size simply will not work without changes to the source also.
I think I figured out how to make it work. Here is a very small book of 4.5K:
http://cap.connx.com/chess-engines/new- ... ks.dat.bz2
26K book:
http://cap.connx.com/chess-engines/new- ... kt.dat.bz2
Dann Corbit
Posts: 12790
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by Dann Corbit »

Dann Corbit wrote:
Dann Corbit wrote:
Dann Corbit wrote:
Dann Corbit wrote:
chessdev wrote:target size is under 20kb. all we really need is variety. maybe cutting off the book at 5 or 8 or 10 moves would work. even cutting off at 5 moves would yield thousands of possible games. :) smaller the better as it has to load in the browser.
It is very hard to make one an exact size, so I will create a series of books.
This one is 176,885 bytes:
http://cap.connx.com/chess-engines/new- ... ok.dat.bz2
Now that I have looked carefully at the code, you will have to change the source code if we are going to use a smaller book file.

GnuChess just allocates a fixed number of entries for the book (e.g. 2^20th in Gnuchess 5.07 and in the Java version of GnuChess:

Code: Select all

/*
 * We now allocate memory for the book dynamically,
 * according to the size field in the header of the binary
 * book. However, during book building the following value
 * is used.
 */

    static final int MAX_DIGEST_BITS = 20;

    static int digest_bits;

    static int DIGEST_SIZE() { return (1 << digest_bits);}

    static int DIGEST_MASK() { return (DIGEST_SIZE() - 1);}
So a smaller book size simply will not work without changes to the source also.
I think I figured out how to make it work. Here is a very small book of 4.5K:
http://cap.connx.com/chess-engines/new- ... ks.dat.bz2
26K book:
http://cap.connx.com/chess-engines/new- ... kt.dat.bz2
48K book:
http://cap.connx.com/chess-engines/new- ... km.dat.bz2
gladius
Posts: 568
Joined: Tue Dec 12, 2006 10:10 am
Full name: Gary Linscott

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by gladius »

Hi Dann,

Would it be possible to get the PGN for the small (26k) book? I'd love to use that for ajax chess online if that would be okay.

Thanks,
Gary
Dann Corbit
Posts: 12790
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by Dann Corbit »

gladius wrote:Hi Dann,

Would it be possible to get the PGN for the small (26k) book? I'd love to use that for ajax chess online if that would be okay.

Thanks,
Gary
I deleted everything because I thought I was done.
I no longer have the PGN.
Dann Corbit
Posts: 12790
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by Dann Corbit »

gladius wrote:Hi Dann,

Would it be possible to get the PGN for the small (26k) book? I'd love to use that for ajax chess online if that would be okay.

Thanks,
Gary
This is the base file (I filtered it various ways to make the books):
http://cap.connx.com/chess-engines/new- ... ks.pgn.bz2

Feel free to use it any way you like.
chessdev
Posts: 31
Joined: Mon Apr 26, 2010 2:47 am

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by chessdev »

thank you dan. i THINK i understand how this works. you take a .pgn and then do some kind of "makebook" command and specify how many ply to include and how many moves it must have in order to be counted.

unfortunately the file you sent was too large at 178kb. i'm trying to get 10% of that! :)

i was wondering if you could help me do the makebook with a pgn file i've uploaded here: http://chesscompodcasts.com/eco.zip

that just has short pgns in it for most openings. i would love it if you could cut it off at 10 ply, and try it with ONE and TWO move requirements (meaning that a move is only included in the "book" if it is played twice. that way i can see what each book size would come out as.

i REALLY appreciate your help. instead of payment in money, how about payment in free membership at chess.com? :)

erik
chessdev
Posts: 31
Joined: Mon Apr 26, 2010 2:47 am

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by chessdev »

ah, i just saw this post - thank you!!! i will try this one.

message me on chess.com if you'd like a free membership :)

http://www.chess.com/members/view/erik

thanks!!
Dann Corbit
Posts: 12790
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Help Create Tiny Opening Book for GNUchess (to vary play

Post by Dann Corbit »