no edit summary
'''Note #1''': Notice the call to quiesce(). This performs a [[Quiescence Search|quiescence search]], which makes the alpha-beta search much more stable.
'''Note #2''': This function only returns the score for the position, not the [[Best Move|best move]]. Normally, a different (but very similar) function is used for searching the [[Root|root node]]. The SearchRoot function calls the alphaBeta function and returns both a score and a best move. Also, most search functions collect the [[
principal variation]] not only for display purposes, but for a good guess as the leftmost path of the next iteration inside an [[Iterative Deepening|iterative deepening]] framework.