Answers.Body: <p>I think your confusion stems from forgetting that minimax and alphabeta is almost exclusively implemented as a depth first search.</p>
  <p>As a result, the node valued 5 would not be pruned, simply because we will explore it before ever getting to the node valued 10.</p>
  <p>If the tree structure was such that the children of the green node were flipped, then we would encounter the 10 node first. In this case, the 5 node would indeed be pruned.</p>
  <p>This illustrates a key aspect of alpha beta pruning, how the order we explore nodes is very important.</p>
  <p>If this is confusing, I suggest looking into depth first search and the order of when nodes are explored.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-09T15:28:22.950Z
Answers.Text: Thanks, I just realized this after posting and thinking for 10 more minutes. I understand DFS, and the 10 node would not have been discovered yet.
Answers.UserDisplayName: maxutil
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-09T15:29:43.933Z
Answers.Text: @maxutil no problem. I added some more info as well. If this answers your question please mark it with the green check.
Answers.UserDisplayName: chessprogrammer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-09T15:25:15.253Z
Answers.LastActivityDate: 2022-12-09T15:28:37.867Z
Answers.LastEditDate: 2022-12-09T15:28:37.867Z
Answers.UserDisplayName: chessprogrammer
Body: <p>I'm trying to understand if the node with value 5 would be pruned if doing left-to-right alpha-beta pruning in a minimax game. I can see two interpretations:</p>
  <ol>
  <li><p>Initialize <span class="math-container">$\alpha = -\infty$</span> and <span class="math-container">$\beta = \infty$</span>. When you reach the leaf node of 15, <span class="math-container">$\alpha$</span> gets updated to 15. The algorithm stops if <span class="math-container">$\alpha \geq \beta$</span>, and it is not. So, the node with value 5 is searched.</p>
  </li>
  <li><p>The leaf node 15 is searched from the perspective of the MAX player (colored blue). Since the parent node of MAX is MIN (colored green), it is trying to minimize the value, there is no need to search the right child of the MAX player. That node would be chosen if it is &gt;15. But MIN already has a 10 available to it, and the 5 node can be pruned.</p>
  </li>
  </ol>
  <p><a href="https://i.sstatic.net/pbYKz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pbYKz.png" alt="enter image description here" /></a></p>
  
Tags: <minimax><alpha-beta-pruning><adversarial-search>
Title: Would the node with value 5 in this tree be pruned if doing left-to-right alpha-beta pruning?
UserDisplayName: maxutil
ThreadText: # Would the node with value 5 in this tree be pruned if doing left-to-right alpha-beta pruning?
  
  (Asked by: username_0 on 2022-12-09)
  
  I'm trying to understand if the node with value 5 would be pruned if doing left-to-right alpha-beta pruning in a minimax game. I can see two interpretations:
  
  1. Initialize $\alpha = -\infty$ and $\beta = \infty$. When you reach the leaf node of 15, $\alpha$ gets updated to 15. The algorithm stops if $\alpha \geq \beta$, and it is not. So, the node with value 5 is searched.
  2. The leaf node 15 is searched from the perspective of the MAX player (colored blue). Since the parent node of MAX is MIN (colored green), it is trying to minimize the value, there is no need to search the right child of the MAX player. That node would be chosen if it is >15. But MIN already has a 10 available to it, and the 5 node can be pruned.
  
  [![enter image description here](https://i.sstatic.net/pbYKz.png)](https://i.sstatic.net/pbYKz.png)
  
  **Tags:** minimax, alpha-beta-pruning, adversarial-search
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-12-09. Score: 0 | Accepted answer
  
  I think your confusion stems from forgetting that minimax and alphabeta is almost exclusively implemented as a depth first search.
  
  As a result, the node valued 5 would not be pruned, simply because we will explore it before ever getting to the node valued 10.
  
  If the tree structure was such that the children of the green node were flipped, then we would encounter the 10 node first. In this case, the 5 node would indeed be pruned.
  
  This illustrates a key aspect of alpha beta pruning, how the order we explore nodes is very important.
  
  If this is confusing, I suggest looking into depth first search and the order of when nodes are explored.
  
  > **Comments:**
  > **username_0**: Thanks, I just realized this after posting and thinking for 10 more minutes. I understand DFS, and the 10 node would not have been discovered yet.  
  > **username_1**: @maxutil no problem. I added some more info as well. If this answers your question please mark it with the green check.  
  
  ---
  
  