Answers.Body: <blockquote>
    <p>In an Alpha Beta search in that utilizes a Negamax framework, how does one collect principal variations to use in move ordering</p>
  </blockquote>
  
  <p>Every strong modern chess engine which uses alpha-beta search uses a transposition table to store the PV move for ordering. If you are writing a chess engine, you should this high-performance, now ubiquitous technique.</p>
  
  <blockquote>
    <p>and how does one use them, without using a transposition table?</p>
  </blockquote>
  
  <p>There are various approaches to storing the principal variation which are commonly used <em>alongside</em> a transposition table. The most popular of these is a triangular PV table. <a href="https://www.chessprogramming.org/Triangular_PV-Table" rel="nofollow noreferrer">The Chess Programming Wiki has a page on this</a>, which includes code examples as you requested.</p>
  
  <blockquote>
    <p>Additionally, would it be different in a principal variation search</p>
  </blockquote>
  
  <p>No. Move ordering can be implemented in the same way for both pure alpha-beta and for PVS. The only difference is the way in which the ordered moves are searched.</p>
  
  <blockquote>
    <p>and do we collect and store important moves for quiescence search too?</p>
  </blockquote>
  
  <p>No. Standard techniques used to order captures are sufficient in quiescence search (namely, MVV/LVA and Static Exchange Evaluation). The move stored in the transposition table may not be a capture, so it is unlikely to be useful for quiescence. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-06T22:47:58.463Z
Answers.LastActivityDate: 2019-07-06T22:47:58.463Z
Answers.UserDisplayName: konsolas
Body: <p>In an Alpha Beta search in that utilizes a Negamax framework, how does one collect principal variations to use in move ordering, and how does one use them, without using a transposition table? </p>
  
  <p>Additionally, would it be different in a principal variation search, and do we collect and store important moves for quiescence search too? Please provide a code example.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-18T00:13:06.623Z
Comments.Text: I don't have time to provide a code example now. Refer to https://chessprogramming.wikispaces.com/Principal+variation for details.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-18T00:15:36.420Z
Comments.Text: I only use TT for PVs, it's easy and efficient. Stockfish does that, why would you not use it? Anyway, I've seen people use triangular-PV, Harm Geert Muller uses it a lot. Google him and the topic and you'll see it. I don't have much experience in that.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-18T00:18:49.740Z
Comments.Text: PVS doesn't change the PV collection. It's a technique for doing more work on the PV nodes.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-18T00:19:45.200Z
Comments.Text: Of course, you'll need to store important nodes in QS. You'll need to update hashing. I update the score and bound for a move in QS.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-18T00:20:25.830Z
Comments.Text: jonathan, I'd guess that you've seen sources similar to the site referenced in the first comment. What exactly have you found lacking in whatever sources you've read before? Spelling that out a bit might help you get answers as specifically tailored to your needs as possible.
Comments.UserDisplayName: ETD
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-18T00:23:14.123Z
Comments.Text: @johnanthan, in chess programming, "node" is more precise than "move". We don't say "collect moves for PV", we say "collect PV nodes".
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-18T00:24:54.680Z
Comments.Text: @Jonanthan, move ordering is implicitly done by searching a PV node before anything else.
Comments.UserDisplayName: SmallChess
Tags: <engines><programming>
Title: Collecting principal variations during search and using them in ordering?
ThreadText: # Collecting principal variations during search and using them in ordering?
  
  (Asked by: username_0 on 2015-03-17)
  
  In an Alpha Beta search in that utilizes a Negamax framework, how does one collect principal variations to use in move ordering, and how does one use them, without using a transposition table?
  
  Additionally, would it be different in a principal variation search, and do we collect and store important moves for quiescence search too? Please provide a code example.
  
  **Tags:** engines, programming
  
  > **Comments:**
  > **username_1**: I don't have time to provide a code example now. Refer to https://chessprogramming.wikispaces.com/Principal+variation for details.  
  > **username_1**: I only use TT for PVs, it's easy and efficient. Stockfish does that, why would you not use it? Anyway, I've seen people use triangular-PV, Harm Geert Muller uses it a lot. Google him and the topic and you'll see it. I don't have much experience in that.  
  > **username_1**: PVS doesn't change the PV collection. It's a technique for doing more work on the PV nodes.  
  > **username_1**: Of course, you'll need to store important nodes in QS. You'll need to update hashing. I update the score and bound for a move in QS.  
  > **username_2**: jonathan, I'd guess that you've seen sources similar to the site referenced in the first comment. What exactly have you found lacking in whatever sources you've read before? Spelling that out a bit might help you get answers as specifically tailored to your needs as possible.  
  > **username_1**: @johnanthan, in chess programming, "node" is more precise than "move". We don't say "collect moves for PV", we say "collect PV nodes".  
  > **username_1**: @Jonanthan, move ordering is implicitly done by searching a PV node before anything else.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2019-07-06. Score: 1
  
  > In an Alpha Beta search in that utilizes a Negamax framework, how does one collect principal variations to use in move ordering
  
  Every strong modern chess engine which uses alpha-beta search uses a transposition table to store the PV move for ordering. If you are writing a chess engine, you should this high-performance, now ubiquitous technique.
  
  > and how does one use them, without using a transposition table?
  
  There are various approaches to storing the principal variation which are commonly used *alongside* a transposition table. The most popular of these is a triangular PV table. [The Chess Programming Wiki has a page on this](https://www.chessprogramming.org/Triangular_PV-Table), which includes code examples as you requested.
  
  > Additionally, would it be different in a principal variation search
  
  No. Move ordering can be implemented in the same way for both pure alpha-beta and for PVS. The only difference is the way in which the ordered moves are searched.
  
  > and do we collect and store important moves for quiescence search too?
  
  No. Standard techniques used to order captures are sufficient in quiescence search (namely, MVV/LVA and Static Exchange Evaluation). The move stored in the transposition table may not be a capture, so it is unlikely to be useful for quiescence.
  
  
  ---
  
  