Answers.Body: <p>First, allow me to draw it for better visualization:</p>
  <pre><code>1. (α=-∞,β=∞) from B ➡ D
  
               B (α=-∞,β=∞)
            ↙ / \
  (α=-∞,β=∞) D   E
             |   |
          -7=J   K=0
  --------------------------
  2. (v=-7) J ➡ D α=max(-7,-∞)=-7
  
               B (α=-∞,β=∞)
  α=max(-7,-∞)/ \
  (α=-7,β=∞) D   E
        ↖    |   |
          -7=J   K=0
  --------------------------
  3. (α=-7) D ➡ B β=min(∞,-7)=-7
  
                 β=min(∞,-7)
               B (α=-∞,β=-7)
           ↗  / \
  (α=-7,β=∞) D   E
             |   |
          -7=J   K=0
  --------------------------
  4. (α=-∞,β=-7) from B ➡ E
  
               B (α=-∞,β=-7)
              / \       ↓
  (α=-7,β=∞) D   E (α=-∞,β=-7)
             |   |
          -7=J   K=0
  --------------------------
  </code></pre>
  <pre><code>5. (v=0) K ➡ E β=min(0,-7)=-7
  
               B
              / \ β=min(0,-7)
  (α=-7,β=∞) D   E (α=-∞,β=-7)
             |   |    ⬈?
          -7=J   K=0
  --------------------------
  
  </code></pre>
  <hr />
  <p>Update: I found this simulator. It behaves exactly like you describe:</p>
  <p><a href="http://homepage.ufp.pt/jtorres/ensino/ia/alfabeta.html" rel="nofollow noreferrer">http://homepage.ufp.pt/jtorres/ensino/ia/alfabeta.html</a></p>
  <ul>
  <li>Enter Tree Structure: <code>2 3 1 1 1 1 1</code></li>
  <li>Enter Values <code>-7 0 -4 -10</code></li>
  </ul>
  <p>I noticed that it tries to update β on node <code>K-&gt;E</code>. As <code>β=min(0,-7)</code>, it won't change.</p>
  <p>It's possible to check their internal code by inspecting the page, to debug even further.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-29T11:57:43.633Z
Answers.Text: Thanks a lot for the explanation Andre! I have taken note in my textbook that if a node will be cut, you don't have to update the alpha and beta values, but in this case, E is not being pruned. I will edit the post with some more information - apologies for not clarifying
Answers.UserDisplayName: Gerhardus Carinus
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-29T12:00:10.253Z
Answers.Text: OK, I'll check your updates later.
Answers.UserDisplayName: Andre Goulart
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-29T13:23:12.267Z
Answers.Text: Updated with an interactive live example with the exact behavior as you stated.
Answers.UserDisplayName: Andre Goulart
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-24T07:11:12.980Z
Answers.LastActivityDate: 2021-08-29T13:22:05.550Z
Answers.LastEditDate: 2021-08-29T13:22:05.550Z
Answers.UserDisplayName: Andre Goulart
Body: <p>I have been working on a problem to which I've applied alpha-beta pruning. While I got most of the answers right, there is one part I'm not quite getting:</p>
  <p><a href="https://i.sstatic.net/4JWvh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4JWvh.png" alt="enter image description here" /></a></p>
  <p>Note that I've only provided a part of the tree I'm working on. Node <span class="math-container">$B$</span> starts with the following values:</p>
  <p><strong><span class="math-container">$B$</span></strong></p>
  <ul>
  <li><span class="math-container">$v = \infty$</span></li>
  <li><span class="math-container">$\alpha = - \infty$</span></li>
  <li><span class="math-container">$\beta = \infty$</span></li>
  </ul>
  <p>Now, we push the alpha and beta values down to node <span class="math-container">$D$</span> from parent node <span class="math-container">$B$</span>, and calculate its value:</p>
  <p><strong><span class="math-container">$D$</span></strong></p>
  <ul>
  <li><span class="math-container">$v = -\infty$</span></li>
  <li><span class="math-container">$\alpha = -\infty$</span></li>
  <li><span class="math-container">$\beta = \infty$</span></li>
  </ul>
  <p>As leaf node <span class="math-container">$J$</span> has a value of <span class="math-container">$-7$</span>, we push that back up to parent node <span class="math-container">$D$</span>, changing node <span class="math-container">$D$</span>'s value to <span class="math-container">$-7$</span> (as it is better than the old value of <span class="math-container">$-\infty$</span>), and we also change the <span class="math-container">$\alpha$</span> value of node <span class="math-container">$D$</span> (as it is also better than the old value of <span class="math-container">$-\infty$</span>).</p>
  <p><strong>New <span class="math-container">$D$</span></strong></p>
  <ul>
  <li><span class="math-container">$v = -7$</span></li>
  <li><span class="math-container">$\alpha = -7$</span></li>
  <li><span class="math-container">$\beta = \infty$</span></li>
  </ul>
  <p>We now push the value of <span class="math-container">$-7$</span> back up to parent node <span class="math-container">$B$</span>, changing node <span class="math-container">$B$</span>'s value to <span class="math-container">$-7$</span> (as it is better than the old value of <span class="math-container">$\infty$</span>), and we also change the <span class="math-container">$\beta$</span> value of node <span class="math-container">$B$</span> (as it is also better than the old value of <span class="math-container">$\infty$</span>).</p>
  <p><strong>New <span class="math-container">$B$</span></strong></p>
  <ul>
  <li><span class="math-container">$v = -7$</span></li>
  <li><span class="math-container">$\alpha = -\infty$</span></li>
  <li><span class="math-container">$\beta = -7$</span></li>
  </ul>
  <p>We now traverse down to node <span class="math-container">$E$</span> (and we don't prune it because node <span class="math-container">$B$</span>'s value is NOT &lt;= its <span class="math-container">$\alpha$</span> value), and we push the alpha and beta values down from node <span class="math-container">$B$</span>, and calculate its value:</p>
  <p><strong><span class="math-container">$E$</span></strong></p>
  <ul>
  <li><span class="math-container">$v = -\infty$</span></li>
  <li><span class="math-container">$\alpha = -\infty$</span></li>
  <li><span class="math-container">$\beta = -7$</span></li>
  </ul>
  <p>As leaf node <span class="math-container">$K$</span> has a value of <span class="math-container">$0$</span>, we push that back up to parent node <span class="math-container">$E$</span>, changing node <span class="math-container">$E$</span>'s value to <span class="math-container">$0$</span> (as it is better than the old value of <span class="math-container">$-\infty$</span>). Now, this is the point where my confusion lies. According to my understanding, at this point we would also set the <span class="math-container">$\alpha$</span> value of node <span class="math-container">$E$</span> to <span class="math-container">$0$</span> (as it is better than the old value of <span class="math-container">$-\infty$</span>). However, the answer I received to this question specifies that we do NOT change the <span class="math-container">$\alpha$</span> value of node <span class="math-container">$E$</span>, and rather leave it as <span class="math-container">$-\infty$</span>.</p>
  <p>Can someone please explain to me why this is the case?</p>
  <p><strong>UPDATE</strong></p>
  <p>I did not originally include the full subtree - this is it:</p>
  <p><a href="https://i.sstatic.net/swGzN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/swGzN.png" alt="enter image description here" /></a></p>
  <p>In this instance, only node M should be pruned. However, my question still stands as to why the answer did not update the alpha value of node E, as no pruning happened in that part of the tree.</p>
  
Tags: <alpha-beta-pruning>
Title: Alpha beta pruning - rules for updating alpha/beta value
UserDisplayName: Gerhardus Carinus
ThreadText: # Alpha beta pruning - rules for updating alpha/beta value
  
  (Asked by: username_0 on 2021-06-24)
  
  I have been working on a problem to which I've applied alpha-beta pruning. While I got most of the answers right, there is one part I'm not quite getting:
  
  [![enter image description here](https://i.sstatic.net/4JWvh.png)](https://i.sstatic.net/4JWvh.png)
  
  Note that I've only provided a part of the tree I'm working on. Node $B$ starts with the following values:
  
  **$B$**
  
  * $v = \infty$
  * $\alpha = - \infty$
  * $\beta = \infty$
  
  Now, we push the alpha and beta values down to node $D$ from parent node $B$, and calculate its value:
  
  **$D$**
  
  * $v = -\infty$
  * $\alpha = -\infty$
  * $\beta = \infty$
  
  As leaf node $J$ has a value of $-7$, we push that back up to parent node $D$, changing node $D$'s value to $-7$ (as it is better than the old value of $-\infty$), and we also change the $\alpha$ value of node $D$ (as it is also better than the old value of $-\infty$).
  
  **New $D$**
  
  * $v = -7$
  * $\alpha = -7$
  * $\beta = \infty$
  
  We now push the value of $-7$ back up to parent node $B$, changing node $B$'s value to $-7$ (as it is better than the old value of $\infty$), and we also change the $\beta$ value of node $B$ (as it is also better than the old value of $\infty$).
  
  **New $B$**
  
  * $v = -7$
  * $\alpha = -\infty$
  * $\beta = -7$
  
  We now traverse down to node $E$ (and we don't prune it because node $B$'s value is NOT <= its $\alpha$ value), and we push the alpha and beta values down from node $B$, and calculate its value:
  
  **$E$**
  
  * $v = -\infty$
  * $\alpha = -\infty$
  * $\beta = -7$
  
  As leaf node $K$ has a value of $0$, we push that back up to parent node $E$, changing node $E$'s value to $0$ (as it is better than the old value of $-\infty$). Now, this is the point where my confusion lies. According to my understanding, at this point we would also set the $\alpha$ value of node $E$ to $0$ (as it is better than the old value of $-\infty$). However, the answer I received to this question specifies that we do NOT change the $\alpha$ value of node $E$, and rather leave it as $-\infty$.
  
  Can someone please explain to me why this is the case?
  
  **UPDATE**
  
  I did not originally include the full subtree - this is it:
  
  [![enter image description here](https://i.sstatic.net/swGzN.png)](https://i.sstatic.net/swGzN.png)
  
  In this instance, only node M should be pruned. However, my question still stands as to why the answer did not update the alpha value of node E, as no pruning happened in that part of the tree.
  
  **Tags:** alpha-beta-pruning
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-08-24. Score: 3
  
  First, allow me to draw it for better visualization:
  1. (α=-∞,β=∞) from B ➡ D
  
               B (α=-∞,β=∞)
            ↙ / \
  (α=-∞,β=∞) D   E
             |   |
          -7=J   K=0
  --------------------------
  2. (v=-7) J ➡ D α=max(-7,-∞)=-7
  
               B (α=-∞,β=∞)
  α=max(-7,-∞)/ \
  (α=-7,β=∞) D   E
        ↖    |   |
          -7=J   K=0
  --------------------------
  3. (α=-7) D ➡ B β=min(∞,-7)=-7
  
                 β=min(∞,-7)
               B (α=-∞,β=-7)
           ↗  / \
  (α=-7,β=∞) D   E
             |   |
          -7=J   K=0
  --------------------------
  4. (α=-∞,β=-7) from B ➡ E
  
               B (α=-∞,β=-7)
              / \       ↓
  (α=-7,β=∞) D   E (α=-∞,β=-7)
             |   |
          -7=J   K=0
  --------------------------
  
  5. (v=0) K ➡ E β=min(0,-7)=-7
  
               B
              / \ β=min(0,-7)
  (α=-7,β=∞) D   E (α=-∞,β=-7)
             |   |    ⬈?
          -7=J   K=0
  --------------------------
  
  
  
  Update: I found this simulator. It behaves exactly like you describe:
  http://homepage.ufp.pt/jtorres/ensino/ia/alfabeta.html
  
  Enter Tree Structure: 2 3 1 1 1 1 1
  Enter Values -7 0 -4 -10
  
  I noticed that it tries to update β on node K->E. As β=min(0,-7), it won't change.
  It's possible to check their internal code by inspecting the page, to debug even further.
  
  > **Comments:**
  > **username_0**: Thanks a lot for the explanation Andre! I have taken note in my textbook that if a node will be cut, you don't have to update the alpha and beta values, but in this case, E is not being pruned. I will edit the post with some more information - apologies for not clarifying  
  > **username_1**: OK, I'll check your updates later.  
  > **username_1**: Updated with an interactive live example with the exact behavior as you stated.  
  
  ---
  
  