Answers.Body: <p>A better book gives better lines and moves for an engine. For example, if you were to construct a book based on beginner games (no more than 1200) on lichess, it would not perform well. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-04T08:56:24.663Z
Answers.Text: Can you give more details? Like, what exactly does an opening book do for the engine?
Answers.UserDisplayName: Allure
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-04T07:05:11.893Z
Answers.LastActivityDate: 2019-03-04T07:05:11.893Z
Answers.UserDisplayName: SmallChess
Answers.Body: <p>Your understanding is more or less correct, an opening book is a large collection of positions and what are the "book moves" in that position. I don't know if engines typically choose at random if there are multiple moves in the book for a given position or if they do something more complicated, but that doesn't matter much for your question.</p>
  
  <blockquote>
    <p>How can an opening book "beat" another?</p>
  </blockquote>
  
  <p>It can contain better moves, and more of them, and they could even be better tailored to the specific opponent!</p>
  
  <p>To figure out which is better, you let <em>the same engine</em> play against itself, with one side using one opening book and the other side the other. If you take care to have each book play white as often as black, you can see in the end which book had a higher score against the other book.</p>
  
  <p>For instance, an opening book could contain a line somewhere that actually is not as good as the author thought at the time of putting it together, and the other book chooses to go for that position as the other side and it leads to a win for the engine.</p>
  
  <p>Or one book is "done" after 15 moves after which the engine is on its own, but the other book still has several moves coming up after it on which the engine spent far more time on while creating the book than it could during the actual game.</p>
  
  <p>Or the author of the opening book for engine A knows that engine B is worse at playing certain positions from the French, and he chooses to put moves into the book that causes A to go for those positions whenever it has the chance.</p>
  
  <p>Or an opening book author spends days analyzing a certain position in an opening, and finally figures out that there is a way to force a good position for white there, and he adds it to the opening book. Engines with books that still allow that position to come up will have a bad time there.</p>
  
  <p>And so on, opening books are in the end created by humans (with heavy use of engines) and the same arms race is going on there as between top human players.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-04T18:56:18.787Z
Answers.Text: Does this mean that an opening book tailored for one engine might not work well for another (because different engines have different strengths and weaknesses)? Further, does this mean that if the opening book has a weakness (say, its understanding of the King's Indian isn't very good) that becomes an exploitable weakness?
Answers.UserDisplayName: Allure
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-04T19:00:37.123Z
Answers.Text: @Allure: in principle yes, but such differences between engines are usually very small and this is only a subject for experts. That might change now that a completely different type of engine exists (Alpha Zero / Leela Zero) that uses neural networks instead of alfa/beta search, in the TCEC final Stockfish vs Leela there were some openings where one engine clearly had the advantage over the other.
Answers.UserDisplayName: RemcoGerlich
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-04T19:03:40.600Z
Answers.Text: Thanks for clarification. One more thing, does an engine using an opening book not have to think at all? That is, the main advantage of opening books is that they conserve time (since presumably if the engine is left to analyze itself it will also find the moves recommended by the opening book)?
Answers.UserDisplayName: Allure
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-04T19:05:54.507Z
Answers.Text: That's one advantage, but the moves it will find itself in five minutes won't be equal to the ones found by the collective work of the whole chess world over decades, of course.
Answers.UserDisplayName: RemcoGerlich
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-06T11:12:28.983Z
Answers.Text: Do you know if opening books make engines deterministic? For example, the opening book dictate that the engine will always open with 1.e4? If not, how does it choose which move to make?
Answers.UserDisplayName: Allure
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-06T11:33:30.477Z
Answers.Text: @Allure: I think most opening books use some variation of random, probably with weights (1.g3 not as often as 1.e4). But it depends on the goal of the book, are they meant to provide maximum variety for human opponents, or to get the best result in an engine v engine match, or something in between.
Answers.UserDisplayName: RemcoGerlich
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-04T14:08:09.420Z
Answers.LastActivityDate: 2019-03-04T14:13:10.737Z
Answers.LastEditDate: 2019-03-04T14:13:10.737Z
Answers.UserDisplayName: RemcoGerlich
Body: <p>I thought opening books were just big compilations of opening moves that engines have access to, and they choose at random which move to play from the list of moves that the opening book says is good. However if this is correct, I don't see how videos like <a href="https://www.youtube.com/watch?v=cyeryLXQH48" rel="noreferrer">this</a> make sense. How can an opening book "beat" another?</p>
  
  <p>Am I understanding opening books wrong? What are they exactly, and how do they make an engine stronger (if they actually make the engine stronger)?</p>
  
Tags: <opening><engines>
Title: How do opening books in engine chess work?
ThreadText: # How do opening books in engine chess work?
  
  (Asked by: username_0 on 2019-03-04)
  
  I thought opening books were just big compilations of opening moves that engines have access to, and they choose at random which move to play from the list of moves that the opening book says is good. However if this is correct, I don't see how videos like [this](https://www.youtube.com/watch?v=cyeryLXQH48) make sense. How can an opening book "beat" another?
  
  Am I understanding opening books wrong? What are they exactly, and how do they make an engine stronger (if they actually make the engine stronger)?
  
  **Tags:** opening, engines
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-03-04. Score: 4 | Accepted answer
  
  Your understanding is more or less correct, an opening book is a large collection of positions and what are the "book moves" in that position. I don't know if engines typically choose at random if there are multiple moves in the book for a given position or if they do something more complicated, but that doesn't matter much for your question.
  
  > How can an opening book "beat" another?
  
  It can contain better moves, and more of them, and they could even be better tailored to the specific opponent!
  
  To figure out which is better, you let *the same engine* play against itself, with one side using one opening book and the other side the other. If you take care to have each book play white as often as black, you can see in the end which book had a higher score against the other book.
  
  For instance, an opening book could contain a line somewhere that actually is not as good as the author thought at the time of putting it together, and the other book chooses to go for that position as the other side and it leads to a win for the engine.
  
  Or one book is "done" after 15 moves after which the engine is on its own, but the other book still has several moves coming up after it on which the engine spent far more time on while creating the book than it could during the actual game.
  
  Or the author of the opening book for engine A knows that engine B is worse at playing certain positions from the French, and he chooses to put moves into the book that causes A to go for those positions whenever it has the chance.
  
  Or an opening book author spends days analyzing a certain position in an opening, and finally figures out that there is a way to force a good position for white there, and he adds it to the opening book. Engines with books that still allow that position to come up will have a bad time there.
  
  And so on, opening books are in the end created by humans (with heavy use of engines) and the same arms race is going on there as between top human players.
  
  > **Comments:**
  > **username_0**: Does this mean that an opening book tailored for one engine might not work well for another (because different engines have different strengths and weaknesses)? Further, does this mean that if the opening book has a weakness (say, its understanding of the King's Indian isn't very good) that becomes an exploitable weakness?  
  > **username_2**: @username_0: in principle yes, but such differences between engines are usually very small and this is only a subject for experts. That might change now that a completely different type of engine exists (Alpha Zero / Leela Zero) that uses neural networks instead of alfa/beta search, in the TCEC final Stockfish vs Leela there were some openings where one engine clearly had the advantage over the other.  
  > **username_0**: Thanks for clarification. One more thing, does an engine using an opening book not have to think at all? That is, the main advantage of opening books is that they conserve time (since presumably if the engine is left to analyze itself it will also find the moves recommended by the opening book)?  
  > **username_2**: That's one advantage, but the moves it will find itself in five minutes won't be equal to the ones found by the collective work of the whole chess world over decades, of course.  
  > **username_0**: Do you know if opening books make engines deterministic? For example, the opening book dictate that the engine will always open with 1.e4? If not, how does it choose which move to make?  
  > **username_2**: @username_0: I think most opening books use some variation of random, probably with weights (1.g3 not as often as 1.e4). But it depends on the goal of the book, are they meant to provide maximum variety for human opponents, or to get the best result in an engine v engine match, or something in between.  
  
  ---
  
  ### Answer by username_1 on 2019-03-04. Score: -2
  
  A better book gives better lines and moves for an engine. For example, if you were to construct a book based on beginner games (no more than 1200) on lichess, it would not perform well.
  
  > **Comments:**
  > **username_0**: Can you give more details? Like, what exactly does an opening book do for the engine?  
  
  ---
  
  