title: Quiescence search - handling Exact/Alpha/Beta flag for Transposition Table
body: <p>I'm adding quiescence search to my chess engine using alpha-beta prunning with transposition tables called inside MTD(f) algorithm. 
  In my main search, after reaching depth=0 (leaf node) I call Quiescence search that is implemented as simple alpha beta prunning without transposition table (because tests showed that searching only captures works faster without TT)</p>
  
  <p>I noticed something that is not covered in pseudo codes on this topic: When I'm at depth=0 (leaf) in main search and I call quiescence search function to obtain node evaluation, I think I should obtain type of evaluation too: exact, alpha or beta:</p>
  
  <pre><code>... beginning of main alpha-beta search, checking node in TT
  if (depth == 0)
  {
      // calling quiescence search with current alpha beta
      int qresult = QuiescenceAlphaBetaSearch(node, alpha, beta);
      saveInTT(node, qresult.Type, qresult.Value);
  } 
  else
  {
      ... run alpha beta search of node.children
  }
  </code></pre>
  
  <p>In typical examples leaf-node evaluation is stored in TT always as "exact" value, but when node evaluation is based on alpha beta search through captures and this search starts with alpha-beta boundaries that are not (-inf,+inf), I think the result of QuiescenceAlphaBetaSearch will not be always exact value and if it's stored in TT it should be marked with flag returned from quiescence search, am I correct?</p>
  
  <p>I'm not really sure if passing current alpha and beta from main search to Quiescence search is mathematically correct, so I would appreciate confirmation on this topic too.</p>