Is there a program to build opening books based on engines?

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

Moderators: hgm, Rebel, chrisw

Uri Blass
Posts: 10269
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Is there a program to build opening books based on engin

Post by Uri Blass »

Ferdy wrote:
Uri Blass wrote:Thanks

I think that it is correct.
I think that skip all moves with relative score below -0.1 is not a good idea and if you want to have longer lines in the book you can reduce black move penalty to lower number than 0.1 pawns and closer to 0
The minimum relative score of -0.1 is settable in the program, so this is interesting to experiment. The black penalty is also settable. Next I will implement the stopping rule for line score. Make this settable too. Like if line score is below -0.50, don't expand.

The output of that run is this.

Code: Select all

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. c2c4 {rel_score: 0.00, line_score: -0.10} 2... e7e6 {rel_score: 0.00, line_score: -0.20} *

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. g1f3 {rel_score: -0.02, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. e2e3 {rel_score: -0.09, line_score: -0.19} 2... g8f6 {rel_score: 0.00, line_score: -0.29} *

[Result "*"]

1. g1f3 {rel_score: -0.02, line_score: -0.02} 1... d7d5 {rel_score: 0.00, line_score: -0.12} 2. d2d4 {rel_score: 0.00, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. e2e4 {rel_score: -0.02, line_score: -0.02} 1... e7e5 {rel_score: 0.00, line_score: -0.12} 2. g1f3 {rel_score: 0.00, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. e2e4 {rel_score: -0.02, line_score: -0.02} 1... e7e5 {rel_score: 0.00, line_score: -0.12} 2. d2d4 {rel_score: -0.10, line_score: -0.22} 2... e5d4 {rel_score: 0.00, line_score: -0.32} *
This is ready for pgn-extract to become like this.

Code: Select all

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. c4 { rel_score: 0.00, line_score: -0.10 } 2... e6 {
rel_score: 0.00, line_score: -0.20 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. Nf3 { rel_score: -0.02, line_score: -0.12 } 2... Nf6
{ rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. e3 { rel_score: -0.09, line_score: -0.19 } 2... Nf6
{ rel_score: 0.00, line_score: -0.29 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. Nf3 { rel_score: -0.02, line_score: -0.02 } 1... d5 { rel_score: 0.00,
line_score: -0.12 } 2. d4 { rel_score: 0.00, line_score: -0.12 } 2... Nf6 {
rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 { rel_score: -0.02, line_score: -0.02 } 1... e5 { rel_score: 0.00,
line_score: -0.12 } 2. Nf3 { rel_score: 0.00, line_score: -0.12 } 2... Nf6
{ rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 { rel_score: -0.02, line_score: -0.02 } 1... e5 { rel_score: 0.00,
line_score: -0.12 } 2. d4 { rel_score: -0.10, line_score: -0.22 } 2... exd4
{ rel_score: 0.00, line_score: -0.32 } *
Do you have other output preferences. Or do you have other thing to get implemented?

I will send you the python source code when I am done.

I think that the stopping rule basically should be dependent on time and there should be no limit for line score except the limit that is derived by time.

It can be something like
1)add to the book all lines with score>-0.01
if the time to build the book is not finished
2)add to the book all lines with score>-0.02
if the time to build the book is not finished
3)add to the book all lines with score>-0.03
and continue in this way.
if the time to build the book is not finished
24)add to the book all lines with score>-0.24

not that after building a book the user may later expand the book and if there was no time to step 24 but the program finished step 23 the program may continue later from step 24
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Is there a program to build opening books based on engin

Post by Ferdy »

Uri Blass wrote:
Ferdy wrote:
Uri Blass wrote:Thanks

I think that it is correct.
I think that skip all moves with relative score below -0.1 is not a good idea and if you want to have longer lines in the book you can reduce black move penalty to lower number than 0.1 pawns and closer to 0
The minimum relative score of -0.1 is settable in the program, so this is interesting to experiment. The black penalty is also settable. Next I will implement the stopping rule for line score. Make this settable too. Like if line score is below -0.50, don't expand.

The output of that run is this.

Code: Select all

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. c2c4 {rel_score: 0.00, line_score: -0.10} 2... e7e6 {rel_score: 0.00, line_score: -0.20} *

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. g1f3 {rel_score: -0.02, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. e2e3 {rel_score: -0.09, line_score: -0.19} 2... g8f6 {rel_score: 0.00, line_score: -0.29} *

[Result "*"]

1. g1f3 {rel_score: -0.02, line_score: -0.02} 1... d7d5 {rel_score: 0.00, line_score: -0.12} 2. d2d4 {rel_score: 0.00, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. e2e4 {rel_score: -0.02, line_score: -0.02} 1... e7e5 {rel_score: 0.00, line_score: -0.12} 2. g1f3 {rel_score: 0.00, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. e2e4 {rel_score: -0.02, line_score: -0.02} 1... e7e5 {rel_score: 0.00, line_score: -0.12} 2. d2d4 {rel_score: -0.10, line_score: -0.22} 2... e5d4 {rel_score: 0.00, line_score: -0.32} *
This is ready for pgn-extract to become like this.

Code: Select all

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. c4 { rel_score: 0.00, line_score: -0.10 } 2... e6 {
rel_score: 0.00, line_score: -0.20 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. Nf3 { rel_score: -0.02, line_score: -0.12 } 2... Nf6
{ rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. e3 { rel_score: -0.09, line_score: -0.19 } 2... Nf6
{ rel_score: 0.00, line_score: -0.29 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. Nf3 { rel_score: -0.02, line_score: -0.02 } 1... d5 { rel_score: 0.00,
line_score: -0.12 } 2. d4 { rel_score: 0.00, line_score: -0.12 } 2... Nf6 {
rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 { rel_score: -0.02, line_score: -0.02 } 1... e5 { rel_score: 0.00,
line_score: -0.12 } 2. Nf3 { rel_score: 0.00, line_score: -0.12 } 2... Nf6
{ rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 { rel_score: -0.02, line_score: -0.02 } 1... e5 { rel_score: 0.00,
line_score: -0.12 } 2. d4 { rel_score: -0.10, line_score: -0.22 } 2... exd4
{ rel_score: 0.00, line_score: -0.32 } *
Do you have other output preferences. Or do you have other thing to get implemented?

I will send you the python source code when I am done.

I think that the stopping rule basically should be dependent on time and there should be no limit for line score except the limit that is derived by time.

It can be something like
1)add to the book all lines with score>-0.01
if the time to build the book is not finished
2)add to the book all lines with score>-0.02
if the time to build the book is not finished
3)add to the book all lines with score>-0.03
and continue in this way.
if the time to build the book is not finished
24)add to the book all lines with score>-0.24

not that after building a book the user may later expand the book and if there was no time to step 24 but the program finished step 23 the program may continue later from step 24
The time factor currently in the prgoram is based on movetime per position. I think this controls the quality of the book moves.
If analysis is set to more than 1 pv, I multiply the movetime by 16. I will make this settable too.

Another option that controls expansion is the max ply. This is settable too. With max ply and movetime known you will be able to estimate the maximum time of building the book.
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: Is there a program to build opening books based on engin

Post by Ovyron »

Greg Strong wrote:
Ovyron wrote:
Greg Strong wrote:If you wish to discuss what is the best response to 1. e5, and I think that's a fine topic for conversation, but I would suggest starting a new thread would be more appropriate.
I'd agree if this thread was linear, but the reason we have to use a reply button specific to a post is that the forum software allows branches inside the threads, so they can have their own topics inside them. People using thread view can see these branches and not click them if they're not interested, while the main conversation of the thread continues on the main branch, this allows for several related topics to be discussed on a single thread.

The description of the subforum is "Discussion of anything and everything relating to chess playing software and machines", it's not like I was bringing some politics on here, religion or other crap, you made a comment about a chess move, and I made an inquiry about it. It's not like all threads have to create new threads about every little subject that appears on it, if it was that way we'd probably have 40 different topics coming from Lyudmil Tsvetkov's books threads, instead of 2, but those conversations can happen in the same thread.

It's not derailing, the train has many wagons and we can have different related conversations in each of them, while the main branch of the thread continues its way.
No. If the threading functionality was so great as you suggest, we could have only one topic in the General Topics section and discuss everything there. But instead we have a "New Topic" button for ... for the purpose of creating new topics! It keeps things organized. It is a courtesy to others to try to stay on topic.

I would have ignored this tangent but for the fact that you do this ALL THE TIME. Don't get me wrong - I don't think you are maliciously trying to derail the conversation and certainly don't think you are a "troll." What I think is that you have a very, very, VERY strong desire to post, and very little self-control. All the time. In every conversation. You must post. Something. It's like you just can't help yourself. This discussion was about using engines for automated generation of opening books. You have nothing to contribute to that conversation. So you waited for an opening, and when I mentioned the Sicilian, that opened a tiny window for you to post something - anything - and post you shall at any opportunity.
My comment about the possible best reply of black was related, and on-topic with your comment that mentioned it.

Your comment about my behavior on the forum is completely unrelated to this topic or computer chess in general, so you're being guilty of what you accuss me of. You found a window to attack me, and used it.
Your beliefs create your reality, so be careful what you wish for.
Uri Blass
Posts: 10269
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Is there a program to build opening books based on engin

Post by Uri Blass »

Ferdy wrote:
Uri Blass wrote:
Ferdy wrote:
Uri Blass wrote:Thanks

I think that it is correct.
I think that skip all moves with relative score below -0.1 is not a good idea and if you want to have longer lines in the book you can reduce black move penalty to lower number than 0.1 pawns and closer to 0
The minimum relative score of -0.1 is settable in the program, so this is interesting to experiment. The black penalty is also settable. Next I will implement the stopping rule for line score. Make this settable too. Like if line score is below -0.50, don't expand.

The output of that run is this.

Code: Select all

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. c2c4 {rel_score: 0.00, line_score: -0.10} 2... e7e6 {rel_score: 0.00, line_score: -0.20} *

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. g1f3 {rel_score: -0.02, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. e2e3 {rel_score: -0.09, line_score: -0.19} 2... g8f6 {rel_score: 0.00, line_score: -0.29} *

[Result "*"]

1. g1f3 {rel_score: -0.02, line_score: -0.02} 1... d7d5 {rel_score: 0.00, line_score: -0.12} 2. d2d4 {rel_score: 0.00, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. e2e4 {rel_score: -0.02, line_score: -0.02} 1... e7e5 {rel_score: 0.00, line_score: -0.12} 2. g1f3 {rel_score: 0.00, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. e2e4 {rel_score: -0.02, line_score: -0.02} 1... e7e5 {rel_score: 0.00, line_score: -0.12} 2. d2d4 {rel_score: -0.10, line_score: -0.22} 2... e5d4 {rel_score: 0.00, line_score: -0.32} *
This is ready for pgn-extract to become like this.

Code: Select all

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. c4 { rel_score: 0.00, line_score: -0.10 } 2... e6 {
rel_score: 0.00, line_score: -0.20 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. Nf3 { rel_score: -0.02, line_score: -0.12 } 2... Nf6
{ rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. e3 { rel_score: -0.09, line_score: -0.19 } 2... Nf6
{ rel_score: 0.00, line_score: -0.29 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. Nf3 { rel_score: -0.02, line_score: -0.02 } 1... d5 { rel_score: 0.00,
line_score: -0.12 } 2. d4 { rel_score: 0.00, line_score: -0.12 } 2... Nf6 {
rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 { rel_score: -0.02, line_score: -0.02 } 1... e5 { rel_score: 0.00,
line_score: -0.12 } 2. Nf3 { rel_score: 0.00, line_score: -0.12 } 2... Nf6
{ rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 { rel_score: -0.02, line_score: -0.02 } 1... e5 { rel_score: 0.00,
line_score: -0.12 } 2. d4 { rel_score: -0.10, line_score: -0.22 } 2... exd4
{ rel_score: 0.00, line_score: -0.32 } *
Do you have other output preferences. Or do you have other thing to get implemented?

I will send you the python source code when I am done.

I think that the stopping rule basically should be dependent on time and there should be no limit for line score except the limit that is derived by time.

It can be something like
1)add to the book all lines with score>-0.01
if the time to build the book is not finished
2)add to the book all lines with score>-0.02
if the time to build the book is not finished
3)add to the book all lines with score>-0.03
and continue in this way.
if the time to build the book is not finished
24)add to the book all lines with score>-0.24

not that after building a book the user may later expand the book and if there was no time to step 24 but the program finished step 23 the program may continue later from step 24
The time factor currently in the prgoram is based on movetime per position. I think this controls the quality of the book moves.
If analysis is set to more than 1 pv, I multiply the movetime by 16. I will make this settable too.

Another option that controls expansion is the max ply. This is settable too. With max ply and movetime known you will be able to estimate the maximum time of building the book.
The time is not dependent only on the movetime per position but also on the number of positions in book.

I prefer to have no max ply.
lines are practically not going to be too long because the score of long lines is lower than the score of short lines in case that there are no big mistakes.
jack512
Posts: 19
Joined: Sat Nov 14, 2015 4:29 pm

Re: Is there a program to build opening books based on engin

Post by jack512 »

Take a look the below paper. IMO it has some limitations and there are some questions for that paper but it may be a good starting point:

https://drive.google.com/file/d/0B2pvWW ... 0tem8/view
Here is a more recent version of this manuscript:
https://drive.google.com/open?id=1FBy-t ... 2CcGlaOKWA
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Is there a program to build opening books based on engin

Post by Ferdy »

jack512 wrote:
Take a look the below paper. IMO it has some limitations and there are some questions for that paper but it may be a good starting point:

https://drive.google.com/file/d/0B2pvWW ... 0tem8/view
Here is a more recent version of this manuscript:
https://drive.google.com/open?id=1FBy-t ... 2CcGlaOKWA
Thank you for this info.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Is there a program to build opening books based on engin

Post by Ferdy »

Uri Blass wrote:
Ferdy wrote:
Uri Blass wrote:
Ferdy wrote:
Uri Blass wrote:Thanks

I think that it is correct.
I think that skip all moves with relative score below -0.1 is not a good idea and if you want to have longer lines in the book you can reduce black move penalty to lower number than 0.1 pawns and closer to 0
The minimum relative score of -0.1 is settable in the program, so this is interesting to experiment. The black penalty is also settable. Next I will implement the stopping rule for line score. Make this settable too. Like if line score is below -0.50, don't expand.

The output of that run is this.

Code: Select all

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. c2c4 {rel_score: 0.00, line_score: -0.10} 2... e7e6 {rel_score: 0.00, line_score: -0.20} *

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. g1f3 {rel_score: -0.02, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. d2d4 {rel_score: 0.00, line_score: 0.00} 1... d7d5 {rel_score: 0.00, line_score: -0.10} 2. e2e3 {rel_score: -0.09, line_score: -0.19} 2... g8f6 {rel_score: 0.00, line_score: -0.29} *

[Result "*"]

1. g1f3 {rel_score: -0.02, line_score: -0.02} 1... d7d5 {rel_score: 0.00, line_score: -0.12} 2. d2d4 {rel_score: 0.00, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. e2e4 {rel_score: -0.02, line_score: -0.02} 1... e7e5 {rel_score: 0.00, line_score: -0.12} 2. g1f3 {rel_score: 0.00, line_score: -0.12} 2... g8f6 {rel_score: 0.00, line_score: -0.22} *

[Result "*"]

1. e2e4 {rel_score: -0.02, line_score: -0.02} 1... e7e5 {rel_score: 0.00, line_score: -0.12} 2. d2d4 {rel_score: -0.10, line_score: -0.22} 2... e5d4 {rel_score: 0.00, line_score: -0.32} *
This is ready for pgn-extract to become like this.

Code: Select all

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. c4 { rel_score: 0.00, line_score: -0.10 } 2... e6 {
rel_score: 0.00, line_score: -0.20 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. Nf3 { rel_score: -0.02, line_score: -0.12 } 2... Nf6
{ rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. d4 { rel_score: 0.00, line_score: 0.00 } 1... d5 { rel_score: 0.00,
line_score: -0.10 } 2. e3 { rel_score: -0.09, line_score: -0.19 } 2... Nf6
{ rel_score: 0.00, line_score: -0.29 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. Nf3 { rel_score: -0.02, line_score: -0.02 } 1... d5 { rel_score: 0.00,
line_score: -0.12 } 2. d4 { rel_score: 0.00, line_score: -0.12 } 2... Nf6 {
rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 { rel_score: -0.02, line_score: -0.02 } 1... e5 { rel_score: 0.00,
line_score: -0.12 } 2. Nf3 { rel_score: 0.00, line_score: -0.12 } 2... Nf6
{ rel_score: 0.00, line_score: -0.22 } *

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 { rel_score: -0.02, line_score: -0.02 } 1... e5 { rel_score: 0.00,
line_score: -0.12 } 2. d4 { rel_score: -0.10, line_score: -0.22 } 2... exd4
{ rel_score: 0.00, line_score: -0.32 } *
Do you have other output preferences. Or do you have other thing to get implemented?

I will send you the python source code when I am done.

I think that the stopping rule basically should be dependent on time and there should be no limit for line score except the limit that is derived by time.

It can be something like
1)add to the book all lines with score>-0.01
if the time to build the book is not finished
2)add to the book all lines with score>-0.02
if the time to build the book is not finished
3)add to the book all lines with score>-0.03
and continue in this way.
if the time to build the book is not finished
24)add to the book all lines with score>-0.24

not that after building a book the user may later expand the book and if there was no time to step 24 but the program finished step 23 the program may continue later from step 24
The time factor currently in the prgoram is based on movetime per position. I think this controls the quality of the book moves.
If analysis is set to more than 1 pv, I multiply the movetime by 16. I will make this settable too.

Another option that controls expansion is the max ply. This is settable too. With max ply and movetime known you will be able to estimate the maximum time of building the book.
The time is not dependent only on the movetime per position but also on the number of positions in book.

I prefer to have no max ply.
lines are practically not going to be too long because the score of long lines is lower than the score of short lines in case that there are no big mistakes.
The algo currently that I have is depth-first search. It will examine first the full given max ply, take backs and continue on the next best move of white.

Your approach is breadth-first search. I will think about it.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

booklet-writer

Post by Ferdy »

I don't have much time now to implement the breadth-first, so what we have is a depth-first algo.

The source is at https://github.com/fsmosca/booklet-writer

It would output a pgn file in append mode with option for white and black multipv. If you want to build a book for black with best 2 replies, you can use

Code: Select all

--bmultipv 2 --wmultipv 6
If bookside is white, the output is w_out.pgn otherwise b_out.pgn
glennsamuel32
Posts: 136
Joined: Sat Dec 04, 2010 5:31 pm
Location: 223

Re: booklet-writer

Post by glennsamuel32 »

Thanks Ferdinand...

Works just fine.

Let's say the book for black is made and I'd like to expand it in certain lines.

For example --

1.Nf3 Nf6 2.c4 e6 3.Nc3 d5 4.d4 Bb4 5.Bg5 h6 6.Bxf6 Qxf6 7.e3
O-O 8.Rc1 c6 9.Bd3 Nd7 10.O-O

1. e4 e5 2. f4 exf4 3. Nc3 Qh4+ 4. Ke2 Qd8 5. d4 Nf6 6. Bxf4
Bb4 7. Bg5 Bxc3 8. bxc3

Could we have the option of feeding it a pgn with multiple lines ?
The script would continue from the last move of the line.
And the pgn output will list the games from move 1 ?
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: booklet-writer

Post by Ferdy »

glennsamuel32 wrote:Thanks Ferdinand...

Works just fine.

Let's say the book for black is made and I'd like to expand it in certain lines.

For example --

1.Nf3 Nf6 2.c4 e6 3.Nc3 d5 4.d4 Bb4 5.Bg5 h6 6.Bxf6 Qxf6 7.e3
O-O 8.Rc1 c6 9.Bd3 Nd7 10.O-O

1. e4 e5 2. f4 exf4 3. Nc3 Qh4+ 4. Ke2 Qd8 5. d4 Nf6 6. Bxf4
Bb4 7. Bg5 Bxc3 8. bxc3

Could we have the option of feeding it a pgn with multiple lines ?
The script would continue from the last move of the line.
And the pgn output will list the games from move 1 ?
I will try it.