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, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
hgm
Posts: 23613
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

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

Post by hgm » Sat Feb 24, 2018 8:43 pm

Fabian Fichter wrote:I would like to extend it to be able to generate PGNs, which should make it easier to convert them to other opening book formats, but that would require a variant-agnostic SAN converter. Reporting coordinate notation would be easier to add, but I do not know whether that is as useful as PGN output.
Agnostic SAN conversion is not possible: you have to know the game rules to see whether a move is ambiguous or not.

XBoard would understand coordinate notation, however, and when saving the game it would use SAN. So when you present it a file with games in coordinate notation, use it as starting lines for a match between 'resign engines', and auto-save the games, you would have them in PGN format.

Uri Blass
Posts: 8554
Joined: Wed Mar 08, 2006 11:37 pm
Location: Tel-Aviv Israel

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

Post by Uri Blass » Sat Feb 24, 2018 8:49 pm

Ovyron wrote:
Greg Strong wrote:The Sicilian Defense is a great response to 1. e4 - possibly the best - but most engine won't find it (I think.)
The Sicilian is probably best if you think black is best getting a draw against white. If you want to keep black's winning chances 1...e5 seems like a better option.
I do not think that symmetric opening is the way to win with black.

I believe chess is a draw but if you want to win then it may be better to use non symmetric openings.

I think statistics show that the percentage of games black won with 1...c5 is bigger than with 1...e5 at least with human-human games.

User avatar
Ovyron
Posts: 2495
Joined: Tue Jul 03, 2007 2:30 am

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

Post by Ovyron » Sat Feb 24, 2018 9:28 pm

Uri Blass wrote:I think statistics show that the percentage of games black won with 1...c5 is bigger than with 1...e5 at least with human-human games.
I'm assuming white wants to win as well, if white wants a draw 1...c5 might be best again as well.

But I think the best is the Ruy Lopez, where symmetry goes out the window after W.Bb5.

And, anyway, how's the draw percentage for the Petroff? That's very symmetric, but one mover later it's not.

I think black can break the symmetry later anyway, it doesn't need to be done with the Sicilian push on the first move, but indeed, I'm not talking about human-human games...
Great spirits have always encountered violent opposition from mediocre minds.

Fabian Fichter
Posts: 24
Joined: Mon Dec 12, 2016 1:14 pm
Contact:

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

Post by Fabian Fichter » Sat Feb 24, 2018 11:38 pm

hgm wrote:
Fabian Fichter wrote:I would like to extend it to be able to generate PGNs, which should make it easier to convert them to other opening book formats, but that would require a variant-agnostic SAN converter. Reporting coordinate notation would be easier to add, but I do not know whether that is as useful as PGN output.
Agnostic SAN conversion is not possible: you have to know the game rules to see whether a move is ambiguous or not.

XBoard would understand coordinate notation, however, and when saving the game it would use SAN. So when you present it a file with games in coordinate notation, use it as starting lines for a match between 'resign engines', and auto-save the games, you would have them in PGN format.
Thanks for the info. I quickly tried it out and it seems to work fine, so that could be used as a workaround without having to implement SAN for variants in Stockfish.

User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 5:57 pm
Location: Washington, DC

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

Post by Greg Strong » Sun Feb 25, 2018 12:00 am

Ovyron wrote:
Greg Strong wrote:The Sicilian Defense is a great response to 1. e4 - possibly the best - but most engine won't find it (I think.)
The Sicilian is probably best if you think black is best getting a draw against white. If you want to keep black's winning chances 1...e5 seems like a better option.
I said possibly the best, but you still felt that that left enough of an opening for you to try to derail the conversation. This thread is NOT about which response to 1. e5 is best. It is about whether computers can build opening books. 1. ... c5 is simple an example of an important move that computers aren't going to find.

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.

User avatar
Ovyron
Posts: 2495
Joined: Tue Jul 03, 2007 2:30 am

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

Post by Ovyron » Sun Feb 25, 2018 12:42 am

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.
Great spirits have always encountered violent opposition from mediocre minds.

User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 5:57 pm
Location: Washington, DC

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

Post by Greg Strong » Sun Feb 25, 2018 1:33 am

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.

Ferdy
Posts: 4074
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

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

Post by Ferdy » Mon Feb 26, 2018 3:57 pm

Uri Blass wrote:It is possible to build a book based on fixed depth analysis(or fixed time analysis) or other ideas that may be better.

Maybe get an estimate for probability for every line based on the evaluations and continue next with the best probability is better than what I did in this example but calculating probability for every move manually if we assume that the probability is proportional to some function of the evaluation function is something that I cannot demonstrate easily and is suitable more for computers and I made manually the example to demonstrate what I mean.

I give an example by fixed depth that is not the best.

Here is one idea that is not the best to build a book for 1+1 time control game but is probably better than the empty book because black put moves in the book for black at bigger depths than the depth that it practically reach at 1+1 and stockfish does not get depth 30 in the opening in 1+1 time control.

The variables here are
1)20(depth analysis for white that is important only to choose the positions to add moves for black so quality of moves is relatively less important)
2)30(depth analysis for black and moves that I add for book of black are analyzed at depth 30
3)0.1 number that encourage the program to prefer short lines in the book relative to long lines(I prefer to analyze more options and not to go forward in the analysis as long as there are alternatives that are less than 0.1 pawn weaker than the best move).

To build a book for black
I start by analyzing the opening position at depth 20
I get the following analysis:


[D]rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Stockfish_18022413_x64_modern:

20/31 00:40 111,989k 2,762k -0.69 1.f3 e5 2.e3 d5 3.d4 exd4 4.exd4 Bd6 5.Nc3 c6 6.g3 Ne7 7.Bg2 h5 8.f4 Bg4 9.Nge2 h4 10.h3 Bxe2 11.Qxe2 hxg3 12.Bd2
20/31 00:40 111,989k 2,762k -0.61 1.g4 d5 2.Bg2 Bxg4 3.c4 Nf6 4.h3 Bd7 5.cxd5 c6 6.dxc6 Bxc6 7.Nf3 e6 8.Nc3 Nbd7 9.d3 Bb4 10.0-0 0-0 11.Bd2 Kh8 12.Kh1
20/31 00:40 111,989k 2,762k -0.44 1.Nh3 e5 2.c3 d5 3.d4 Nc6 4.dxe5 Nxe5 5.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6
20/24 00:40 111,989k 2,762k +0.37 1.e3 e6 2.d4 Nf6 3.c4 d5 4.Nc3 Be7 5.Nf3 0-0 6.Be2 dxc4 7.0-0 a6 8.Bxc4 b5 9.Bd3 Bb7 10.e4 c5 11.dxc5 Bxc5
20/28 00:40 111,989k 2,762k +0.39 1.d4 d5 2.Nf3 e6 3.c4 Nf6 4.Nc3 Be7 5.Bg5 Nc6 6.e3 h6 7.Bxf6 Bxf6 8.cxd5 exd5 9.Qb3 Ne7 10.e4 dxe4 11.Nxe4 Nc6
20/35 00:40 111,989k 2,762k +0.40 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.0-0 Nxe4 5.d4 a6 6.Bxc6 dxc6 7.Re1 Nf6 8.Nxe5 Be6 9.c4 Bd6 10.Bf4 0-0 11.Qd3 Nd7 12.Nc3 Re8 13.h3 Nxe5 14.Bxe5 h6 15.Bxd6 Qxd6 16.Rad1



It means I have the following scores relative to best move
1.e4 0
1.d4 -0.01
1.e3 -0.03
1.Nf3 -0.04
1.c4 -0.08
1.Nc3 -0.17
1.b3 -0.3
1.d3 -0.3
1.h3 -0.33
1.c3 -0.35
1.a3 -0.37
1.g3 -0.40
...

I analyze after the best move 1.e4 and
I get at depth 30 the move 1...e6 and I do not use multi-pv because I want the book for black to have one option for black at every node and many options for white to be ready for many options the opponents can play.

Now the score of 1.e4 e6 is -0.1 because I have the rule that I substract 0.1 for every move of black from the score so at this point I do not analyze what happens after 1.e4 e6 but analyze what happens after 1.d4 that has a better score of -0.01 and the order of analysis is
1)opening position score multi-pv all options 0
2)best move 1.e4 0(best move at depth 30 is 1...e6 so add it to the book)
3)1.d4 -0.01(best move at depth 30 is 1...Nf6 so add it to the book)
4)1.e3 -0.03(best move at depth 30 is 1...e6 so add it to the book)
5)1.Nf3 -0.04(best move at depth 30 is 1...e6 so add it to the book)
6)1.c4 -0.08(best move at depth 30 is 1...e5 so add it to the book)
7)1.e4 e6 -0.1(all options depth 20)
2.Nc3 was the best move for white at depth 20 and here is part of the analysis with multi-pv=30


20/27 01:04 176,711k 2,735k +0.37 2.Nf3 d5 3.exd5 exd5 4.d4 Nf6 5.Bd3 Bd6 6.Qe2+ Be7 7.0-0 0-0 8.Be3 Nc6 9.c3 Re8 10.Qc2 Bd6 11.Nbd2 Bd7 12.h3 h6 13.Rae1 a6 14.Kh1 Be6 15.Nb3
20/37 01:04 176,711k 2,735k +0.39 2.d4 d5 3.Nc3 Nf6 4.Bg5 Be7 5.e5 Ne4 6.Nxe4 dxe4 7.Be3 c5 8.dxc5 Qc7 9.Qd4 Bd7 10.0-0-0 0-0 11.Qxe4 Bc6 12.Qd4 Nd7 13.Nf3 Bxc5
20/31 01:04 176,711k 2,735k +0.47 2.Nc3 d5 3.d4 Nf6 4.Bg5 Be7 5.e5 Ne4 6.Nxe4 dxe4 7.Bxe7 Qxe7 8.c3 Nd7 9.Ne2 b6 10.Ng3 Bb7 11.Bb5 0-0 12.0-0 c5 13.Re1 Rfd8 14.Nxe4 Nxe5 15.Nxc5 bxc5 16.Rxe5 cxd4

It means
1.e4 e6 2.Nc3 get a score of -0.1
1.e4 e6 2.d4 get a score of -0.18
1.e4 e6 2.Nf3 get a score of -0.2 and other lines after 1.e4 e6 get a worse score


steps to continue are
8)analyze 1.e4 e6 2.Nc3 that has -0.1 score(0 for mistakes of white and -0.1 for number of moves black already played) and find a move for black because this line has the best score

9)analyze all options for white after 1.d4 Nf6 that has -0.11 score (-0.01 for mistakes of white and -0.1 for number of moves black already played)

10)1.d4 Nf6 2.c4 is the best move for white so analyze this line that has score of -0.11 to add a move for black for the book.
Tried to create a program based on your description. Check if it is right. It searches up to 4 plies deep, no matter how low is the line score, but relative score of move is limited to a minimum of -0.10.

Code: Select all

:: Settings ::
Book for               : Black
black move penalty     : -0.10
minimum relative score : -0.10
Max ply                : 4
movetime (ms)          : 1000
engine                 : Stockfish 9
hash (mb)              : 128
threads                : 1
current pos:
[d]rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Code: Select all

Search at multipv = 4, movetime = 16s
1. d2d4 {scorecp: 39, depth: 22, rel_score: 0.00, penalty: 0.00}
1. g1f3 {scorecp: 37, depth: 22, rel_score: -0.02, penalty: 0.00}
1. e2e4 {scorecp: 37, depth: 22, rel_score: -0.02, penalty: 0.00}
1. e2e3 {scorecp: 27, depth: 22, rel_score: -0.12, penalty: 0.00}

move to search next: 1. d2d4 {0.00}
current pos:
[d]rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1

Code: Select all

Search at multipv = 1, movetime = 1s
1... d7d5 {scorecp: -15, depth: 19, rel_score: 0.00, penalty: -0.10}

move to search next: 1... d7d5 {0.00}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/3P4/8/PPP1PPPP/RNBQKBNR w KQkq - 0 2

Code: Select all

Search at multipv = 4, movetime = 16s
2. c2c4 {scorecp: 44, depth: 21, rel_score: 0.00, penalty: 0.00}
2. g1f3 {scorecp: 42, depth: 21, rel_score: -0.02, penalty: 0.00}
2. e2e3 {scorecp: 35, depth: 21, rel_score: -0.09, penalty: 0.00}
2. c1f4 {scorecp: 26, depth: 21, rel_score: -0.18, penalty: 0.00}

move to search next: 2. c2c4 {0.00}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/2PP4/8/PP2PPPP/RNBQKBNR b KQkq - 0 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... e7e6 {scorecp: -2, depth: 19, rel_score: 0.00, penalty: -0.10}

move to search next: 2... e7e6 {0.00}


 --->>> book line: 1
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} 

move to search next: 2. g1f3 {-0.02}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/3P4/5N2/PPP1PPPP/RNBQKB1R b KQkq - 1 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... g8f6 {scorecp: 2, depth: 17, rel_score: 0.00, penalty: -0.10}

move to search next: 2... g8f6 {0.00}


 --->>> book line: 2
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} 

move to search next: 2. e2e3 {-0.09}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/3P4/4P3/PPP2PPP/RNBQKBNR b KQkq - 0 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... g8f6 {scorecp: 3, depth: 19, rel_score: 0.00, penalty: -0.10}

move to search next: 2... g8f6 {0.00}


 --->>> book line: 3
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} 

skip move: 2. c1f4, rel_score -0.18 is below -0.10

move to search next: 1. g1f3 {-0.02}
current pos:
[d]rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R b KQkq - 1 1

Code: Select all

Search at multipv = 1, movetime = 1s
1... d7d5 {scorecp: -4, depth: 19, rel_score: 0.00, penalty: -0.10}

move to search next: 1... d7d5 {0.00}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/8/5N2/PPPPPPPP/RNBQKB1R w KQkq - 0 2

Code: Select all

Search at multipv = 4, movetime = 16s
2. d2d4 {scorecp: 55, depth: 22, rel_score: 0.00, penalty: 0.00}
2. c2c4 {scorecp: 45, depth: 22, rel_score: -0.10, penalty: 0.00}
2. e2e3 {scorecp: 30, depth: 22, rel_score: -0.25, penalty: 0.00}
2. h2h3 {scorecp: 30, depth: 22, rel_score: -0.25, penalty: 0.00}

move to search next: 2. d2d4 {0.00}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/3P4/5N2/PPP1PPPP/RNBQKB1R b KQkq - 0 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... g8f6 {scorecp: 2, depth: 17, rel_score: 0.00, penalty: -0.10}

move to search next: 2... g8f6 {0.00}


 --->>> book line: 4
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} 

skip move: 2. c2c4, rel_score -0.10 is below -0.10

skip move: 2. e2e3, rel_score -0.25 is below -0.10

skip move: 2. h2h3, rel_score -0.25 is below -0.10

move to search next: 1. e2e4 {-0.02}
current pos:
[d]rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1

Code: Select all

Search at multipv = 1, movetime = 1s
1... e7e5 {scorecp: -12, depth: 18, rel_score: 0.00, penalty: -0.10}

move to search next: 1... e7e5 {0.00}
current pos:
[d]rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2

Code: Select all

Search at multipv = 4, movetime = 16s
2. g1f3 {scorecp: 35, depth: 21, rel_score: 0.00, penalty: 0.00}
2. d2d4 {scorecp: 25, depth: 21, rel_score: -0.10, penalty: 0.00}
2. b1c3 {scorecp: 24, depth: 21, rel_score: -0.11, penalty: 0.00}
2. f1e2 {scorecp: 20, depth: 21, rel_score: -0.15, penalty: 0.00}

move to search next: 2. g1f3 {0.00}
current pos:
[d]rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... g8f6 {scorecp: -31, depth: 16, rel_score: 0.00, penalty: -0.10}

move to search next: 2... g8f6 {0.00}


 --->>> book line: 5
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} 

move to search next: 2. d2d4 {-0.10}
current pos:
[d]rnbqkbnr/pppp1ppp/8/4p3/3PP3/8/PPP2PPP/RNBQKBNR b KQkq - 0 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... e5d4 {scorecp: 21, depth: 17, rel_score: 0.00, penalty: -0.10}

move to search next: 2... e5d4 {0.00}


 --->>> book line: 6
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} 

skip move: 2. b1c3, rel_score -0.11 is below -0.10

skip move: 2. f1e2, rel_score -0.15 is below -0.10

skip move: 1. e2e3, rel_score -0.12 is below -0.10

Uri Blass
Posts: 8554
Joined: Wed Mar 08, 2006 11:37 pm
Location: Tel-Aviv Israel

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

Post by Uri Blass » Mon Feb 26, 2018 5:08 pm

Ferdy wrote:
Uri Blass wrote:It is possible to build a book based on fixed depth analysis(or fixed time analysis) or other ideas that may be better.

Maybe get an estimate for probability for every line based on the evaluations and continue next with the best probability is better than what I did in this example but calculating probability for every move manually if we assume that the probability is proportional to some function of the evaluation function is something that I cannot demonstrate easily and is suitable more for computers and I made manually the example to demonstrate what I mean.

I give an example by fixed depth that is not the best.

Here is one idea that is not the best to build a book for 1+1 time control game but is probably better than the empty book because black put moves in the book for black at bigger depths than the depth that it practically reach at 1+1 and stockfish does not get depth 30 in the opening in 1+1 time control.

The variables here are
1)20(depth analysis for white that is important only to choose the positions to add moves for black so quality of moves is relatively less important)
2)30(depth analysis for black and moves that I add for book of black are analyzed at depth 30
3)0.1 number that encourage the program to prefer short lines in the book relative to long lines(I prefer to analyze more options and not to go forward in the analysis as long as there are alternatives that are less than 0.1 pawn weaker than the best move).

To build a book for black
I start by analyzing the opening position at depth 20
I get the following analysis:


[D]rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Stockfish_18022413_x64_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6.cxd3 Bd6 7.Nge2 Nc6 8.a3 0-0 9.0-0 a6 10.h3 h6 11.Bxd6 Qxd6
20/28 00:40 111,989k 2,762k +0.32 1.c4 e5 2.e3 Nf6 3.Nc3 Nc6 4.d4 Bb4 5.Nf3 exd4 6.exd4 d5 7.Bd3 dxc4 8.Bxc4 Qe7+ 9.Be3 Ng4 10.Qe2 Nxe3 11.fxe3 0-0 12.0-0 Re8 13.Rae1
20/25 00:40 111,989k 2,762k +0.36 1.Nf3 d5 2.d4 e6 3.c4 Nf6 4.Nc3 Be7 5.e3 0-0 6.a3 Nbd7 7.cxd5 exd5 8.Bd3 c5 9.0-0 c4 10.Bc2 Nb6 11.Bd2 Be6
20/24 00:40 111,989k 2,762k +0.37 1.e3 e6 2.d4 Nf6 3.c4 d5 4.Nc3 Be7 5.Nf3 0-0 6.Be2 dxc4 7.0-0 a6 8.Bxc4 b5 9.Bd3 Bb7 10.e4 c5 11.dxc5 Bxc5
20/28 00:40 111,989k 2,762k +0.39 1.d4 d5 2.Nf3 e6 3.c4 Nf6 4.Nc3 Be7 5.Bg5 Nc6 6.e3 h6 7.Bxf6 Bxf6 8.cxd5 exd5 9.Qb3 Ne7 10.e4 dxe4 11.Nxe4 Nc6
20/35 00:40 111,989k 2,762k +0.40 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.0-0 Nxe4 5.d4 a6 6.Bxc6 dxc6 7.Re1 Nf6 8.Nxe5 Be6 9.c4 Bd6 10.Bf4 0-0 11.Qd3 Nd7 12.Nc3 Re8 13.h3 Nxe5 14.Bxe5 h6 15.Bxd6 Qxd6 16.Rad1



It means I have the following scores relative to best move
1.e4 0
1.d4 -0.01
1.e3 -0.03
1.Nf3 -0.04
1.c4 -0.08
1.Nc3 -0.17
1.b3 -0.3
1.d3 -0.3
1.h3 -0.33
1.c3 -0.35
1.a3 -0.37
1.g3 -0.40
...

I analyze after the best move 1.e4 and
I get at depth 30 the move 1...e6 and I do not use multi-pv because I want the book for black to have one option for black at every node and many options for white to be ready for many options the opponents can play.

Now the score of 1.e4 e6 is -0.1 because I have the rule that I substract 0.1 for every move of black from the score so at this point I do not analyze what happens after 1.e4 e6 but analyze what happens after 1.d4 that has a better score of -0.01 and the order of analysis is
1)opening position score multi-pv all options 0
2)best move 1.e4 0(best move at depth 30 is 1...e6 so add it to the book)
3)1.d4 -0.01(best move at depth 30 is 1...Nf6 so add it to the book)
4)1.e3 -0.03(best move at depth 30 is 1...e6 so add it to the book)
5)1.Nf3 -0.04(best move at depth 30 is 1...e6 so add it to the book)
6)1.c4 -0.08(best move at depth 30 is 1...e5 so add it to the book)
7)1.e4 e6 -0.1(all options depth 20)
2.Nc3 was the best move for white at depth 20 and here is part of the analysis with multi-pv=30


20/27 01:04 176,711k 2,735k +0.37 2.Nf3 d5 3.exd5 exd5 4.d4 Nf6 5.Bd3 Bd6 6.Qe2+ Be7 7.0-0 0-0 8.Be3 Nc6 9.c3 Re8 10.Qc2 Bd6 11.Nbd2 Bd7 12.h3 h6 13.Rae1 a6 14.Kh1 Be6 15.Nb3
20/37 01:04 176,711k 2,735k +0.39 2.d4 d5 3.Nc3 Nf6 4.Bg5 Be7 5.e5 Ne4 6.Nxe4 dxe4 7.Be3 c5 8.dxc5 Qc7 9.Qd4 Bd7 10.0-0-0 0-0 11.Qxe4 Bc6 12.Qd4 Nd7 13.Nf3 Bxc5
20/31 01:04 176,711k 2,735k +0.47 2.Nc3 d5 3.d4 Nf6 4.Bg5 Be7 5.e5 Ne4 6.Nxe4 dxe4 7.Bxe7 Qxe7 8.c3 Nd7 9.Ne2 b6 10.Ng3 Bb7 11.Bb5 0-0 12.0-0 c5 13.Re1 Rfd8 14.Nxe4 Nxe5 15.Nxc5 bxc5 16.Rxe5 cxd4

It means
1.e4 e6 2.Nc3 get a score of -0.1
1.e4 e6 2.d4 get a score of -0.18
1.e4 e6 2.Nf3 get a score of -0.2 and other lines after 1.e4 e6 get a worse score


steps to continue are
8)analyze 1.e4 e6 2.Nc3 that has -0.1 score(0 for mistakes of white and -0.1 for number of moves black already played) and find a move for black because this line has the best score

9)analyze all options for white after 1.d4 Nf6 that has -0.11 score (-0.01 for mistakes of white and -0.1 for number of moves black already played)

10)1.d4 Nf6 2.c4 is the best move for white so analyze this line that has score of -0.11 to add a move for black for the book.
Tried to create a program based on your description. Check if it is right. It searches up to 4 plies deep, no matter how low is the line score, but relative score of move is limited to a minimum of -0.10.

Code: Select all

:: Settings ::
Book for               : Black
black move penalty     : -0.10
minimum relative score : -0.10
Max ply                : 4
movetime (ms)          : 1000
engine                 : Stockfish 9
hash (mb)              : 128
threads                : 1
current pos:
[d]rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Code: Select all

Search at multipv = 4, movetime = 16s
1. d2d4 {scorecp: 39, depth: 22, rel_score: 0.00, penalty: 0.00}
1. g1f3 {scorecp: 37, depth: 22, rel_score: -0.02, penalty: 0.00}
1. e2e4 {scorecp: 37, depth: 22, rel_score: -0.02, penalty: 0.00}
1. e2e3 {scorecp: 27, depth: 22, rel_score: -0.12, penalty: 0.00}

move to search next: 1. d2d4 {0.00}
current pos:
[d]rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1

Code: Select all

Search at multipv = 1, movetime = 1s
1... d7d5 {scorecp: -15, depth: 19, rel_score: 0.00, penalty: -0.10}

move to search next: 1... d7d5 {0.00}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/3P4/8/PPP1PPPP/RNBQKBNR w KQkq - 0 2

Code: Select all

Search at multipv = 4, movetime = 16s
2. c2c4 {scorecp: 44, depth: 21, rel_score: 0.00, penalty: 0.00}
2. g1f3 {scorecp: 42, depth: 21, rel_score: -0.02, penalty: 0.00}
2. e2e3 {scorecp: 35, depth: 21, rel_score: -0.09, penalty: 0.00}
2. c1f4 {scorecp: 26, depth: 21, rel_score: -0.18, penalty: 0.00}

move to search next: 2. c2c4 {0.00}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/2PP4/8/PP2PPPP/RNBQKBNR b KQkq - 0 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... e7e6 {scorecp: -2, depth: 19, rel_score: 0.00, penalty: -0.10}

move to search next: 2... e7e6 {0.00}


 --->>> book line: 1
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} 

move to search next: 2. g1f3 {-0.02}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/3P4/5N2/PPP1PPPP/RNBQKB1R b KQkq - 1 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... g8f6 {scorecp: 2, depth: 17, rel_score: 0.00, penalty: -0.10}

move to search next: 2... g8f6 {0.00}


 --->>> book line: 2
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} 

move to search next: 2. e2e3 {-0.09}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/3P4/4P3/PPP2PPP/RNBQKBNR b KQkq - 0 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... g8f6 {scorecp: 3, depth: 19, rel_score: 0.00, penalty: -0.10}

move to search next: 2... g8f6 {0.00}


 --->>> book line: 3
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} 

skip move: 2. c1f4, rel_score -0.18 is below -0.10

move to search next: 1. g1f3 {-0.02}
current pos:
[d]rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R b KQkq - 1 1

Code: Select all

Search at multipv = 1, movetime = 1s
1... d7d5 {scorecp: -4, depth: 19, rel_score: 0.00, penalty: -0.10}

move to search next: 1... d7d5 {0.00}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/8/5N2/PPPPPPPP/RNBQKB1R w KQkq - 0 2

Code: Select all

Search at multipv = 4, movetime = 16s
2. d2d4 {scorecp: 55, depth: 22, rel_score: 0.00, penalty: 0.00}
2. c2c4 {scorecp: 45, depth: 22, rel_score: -0.10, penalty: 0.00}
2. e2e3 {scorecp: 30, depth: 22, rel_score: -0.25, penalty: 0.00}
2. h2h3 {scorecp: 30, depth: 22, rel_score: -0.25, penalty: 0.00}

move to search next: 2. d2d4 {0.00}
current pos:
[d]rnbqkbnr/ppp1pppp/8/3p4/3P4/5N2/PPP1PPPP/RNBQKB1R b KQkq - 0 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... g8f6 {scorecp: 2, depth: 17, rel_score: 0.00, penalty: -0.10}

move to search next: 2... g8f6 {0.00}


 --->>> book line: 4
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} 

skip move: 2. c2c4, rel_score -0.10 is below -0.10

skip move: 2. e2e3, rel_score -0.25 is below -0.10

skip move: 2. h2h3, rel_score -0.25 is below -0.10

move to search next: 1. e2e4 {-0.02}
current pos:
[d]rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1

Code: Select all

Search at multipv = 1, movetime = 1s
1... e7e5 {scorecp: -12, depth: 18, rel_score: 0.00, penalty: -0.10}

move to search next: 1... e7e5 {0.00}
current pos:
[d]rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2

Code: Select all

Search at multipv = 4, movetime = 16s
2. g1f3 {scorecp: 35, depth: 21, rel_score: 0.00, penalty: 0.00}
2. d2d4 {scorecp: 25, depth: 21, rel_score: -0.10, penalty: 0.00}
2. b1c3 {scorecp: 24, depth: 21, rel_score: -0.11, penalty: 0.00}
2. f1e2 {scorecp: 20, depth: 21, rel_score: -0.15, penalty: 0.00}

move to search next: 2. g1f3 {0.00}
current pos:
[d]rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... g8f6 {scorecp: -31, depth: 16, rel_score: 0.00, penalty: -0.10}

move to search next: 2... g8f6 {0.00}


 --->>> book line: 5
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} 

move to search next: 2. d2d4 {-0.10}
current pos:
[d]rnbqkbnr/pppp1ppp/8/4p3/3PP3/8/PPP2PPP/RNBQKBNR b KQkq - 0 2

Code: Select all

Search at multipv = 1, movetime = 1s
2... e5d4 {scorecp: 21, depth: 17, rel_score: 0.00, penalty: -0.10}

move to search next: 2... e5d4 {0.00}


 --->>> book line: 6
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} 

skip move: 2. b1c3, rel_score -0.11 is below -0.10

skip move: 2. f1e2, rel_score -0.15 is below -0.10

skip move: 1. e2e3, rel_score -0.12 is below -0.10
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

Ferdy
Posts: 4074
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

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

Post by Ferdy » Mon Feb 26, 2018 5:49 pm

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.

Post Reply