chess:programming:alpha-beta_pruning:example
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
chess:programming:alpha-beta_pruning:example [2021/10/30 23:23] – peter | chess:programming:alpha-beta_pruning:example [2021/10/30 23:35] (current) – peter | ||
---|---|---|---|
Line 19: | Line 19: | ||
* D returns a value of 5 to B. | * D returns a value of 5 to B. | ||
* At B, beta = min(+INF, 5) which is 5. | * At B, beta = min(+INF, 5) which is 5. | ||
- | * The minimizer is now guaranteed a value of 5 or lesser. | + | * The minimizer is now guaranteed a value of 5 or less. |
* B now calls E to see if he can get a lower value than 5. | * B now calls E to see if he can get a lower value than 5. | ||
* At E the values of alpha and beta is not -INF and +INF but instead -INF and 5 respectively, | * At E the values of alpha and beta is not -INF and +INF but instead -INF and 5 respectively, | ||
Line 28: | Line 28: | ||
* Hence it breaks and E returns 6 to B. | * Hence it breaks and E returns 6 to B. | ||
* Note how it did not matter what the value of E's right child is. | * Note how it did not matter what the value of E's right child is. | ||
- | * It could have been +INF or -INF, it still would not matter, We never even had to look at it because the minimizer was guaranteed a value of 5 or lesser. | + | * It could have been +INF or -INF, it still would not matter. |
- | * So as soon as the maximizer saw the 6 he knew the minimizer would never come this way because | + | * We never even had to look at it because the minimizer was guaranteed a value of 5 or less. |
+ | * So as soon as the maximizer saw the 6 he knew the minimizer would never come this way because | ||
+ | * The Minimizer would always go for the left side of B as this gives a lesser value. | ||
* This way we do not have to look at that 9 and hence saved computation time. | * This way we do not have to look at that 9 and hence saved computation time. | ||
* E returns a value of 6 to B. | * E returns a value of 6 to B. | ||
* At B, beta = min(5, 6) which is 5. | * At B, beta = min(5, 6) which is 5. | ||
* The value of node B is also 5. | * The value of node B is also 5. | ||
+ | |||
+ | ---- | ||
So far this is how our game tree looks. | So far this is how our game tree looks. | ||
Line 41: | Line 45: | ||
{{: | {{: | ||
- | ---- | ||
* B returns 5 to A. | * B returns 5 to A. | ||
Line 67: | Line 70: | ||
* Therefore the best value at A is max(5, 2) which is a 5. | * Therefore the best value at A is max(5, 2) which is a 5. | ||
* Hence the optimal value that the maximizer can get is 5. | * Hence the optimal value that the maximizer can get is 5. | ||
+ | |||
+ | ---- | ||
This is how our final game tree looks like. | This is how our final game tree looks like. |
chess/programming/alpha-beta_pruning/example.1635636227.txt.gz · Last modified: 2021/10/30 23:23 by peter