Open Access
This article is

- freely available
- re-usable

*Algorithms*
**2012**,
*5*(4),
521-528;
doi:10.3390/a5040521

Article

Alpha-Beta Pruning and Althöfer’s Pathology-Free Negamax Algorithm

Department of Computer Science & Engineering, American University in Cairo, Cairo, Egypt

Received: 25 July 2012; in revised form: 6 October 2012 / Accepted: 25 October 2012 / Published: 5 November 2012

## Abstract

**:**

The minimax algorithm, also called the negamax algorithm, remains today the most widely used search technique for two-player perfect-information games. However, minimaxing has been shown to be susceptible to game tree pathology, a paradoxical situation in which the accuracy of the search can decrease as the height of the tree increases. Althöfer’s alternative minimax algorithm has been proven to be invulnerable to pathology. However, it has not been clear whether alpha-beta pruning, a crucial component of practical game programs, could be applied in the context of Alhöfer’s algorithm. In this brief paper, we show how alpha-beta pruning can be adapted to Althöfer’s algorithm.

Keywords:

game tree; search pathology; alpha-beta pruning## 1. Introduction

The minimax algorithm remains today the most widely used game tree search technique for two-player perfect-information games. For a given board position, a game tree is built to some depth, a static board-evaluation function is applied to the leaf nodes, and evaluation values are propagated up the tree and used to estimate the evaluation of the root. A criticism of minimaxing is that because the evaluation function applied to the leaf nodes is itself an estimate rather than an exact measurement, evaluation errors introduced at the search frontier can become amplified as they are propagated up the tree, leading to an incorrect root evaluation. Pearl has written [1, p. 427],

Yet, it should come as a surprise that the minimax method works at all. The static evaluation function does not exactly evaluate the positions at the search frontier, but, only provides estimates of their strengths; minimaxing these estimates as if they are true payoffs amounts to committing one of the deadly sins of statistics, computing a function of the estimates instead of an estimate of the function.

Researchers [1,2,3,4,5,6,7,8,9,10,11,12,1314] have found that in models of game trees with an erroneous evaluation function, evaluation errors are not always eliminated by minimaxing and can, in fact, grow with the height of the tree, leading to a situation known as game tree pathology where increasing the depth of search results in loss of accuracy. Recent work [9] suggests that the pathology phenomenon may be even more common than previously thought.

As an alternative to conventional minimaxing, Ingo Althöfer’s [15] alternative minimax algorithm, which uses evaluation values of all nodes in the tree, rather than only leaf nodes, in the evaluation of the root, has been proven not to suffer from pathology. However, one reason why Althöfer’s algorithm has not been used in practical game programs has been the uncertainty regarding the compatibility of the algorithm with alpha-beta pruning: in the conclusion of [15], Althöfer comments that alpha-beta pruning may be “still possible” with his algorithm. Therefore, in the remainder of this paper, we show how full alpha-beta pruning can be adapted to Althöfer’s algorithm.

## 2. Review of Althöfer’s Algorithm

In the negamax formulation of standard minimaxing, the valuation ${V}_{x}$ of a game tree node x is defined as
where $\Gamma \left(x\right)$ denotes the children of x, and f is the static board-state evaluation function.

$${V}_{x}=\left\{\begin{array}{ccc}\underset{y\in \Gamma \left(x\right)}{max}\{-{V}_{y}\}\hfill & \phantom{\rule{20.0pt}{0ex}}& x\phantom{\rule{4pt}{0ex}}\mathrm{not}\phantom{\rule{4pt}{0ex}}\mathrm{a}\phantom{\rule{4pt}{0ex}}\mathrm{leaf}\hfill \\ f\left(x\right)\hfill & & \mathrm{otherwise}\hfill \end{array}\right.$$

In Althöfer’s negamax algorithm, the valuation of a leaf node is also simply its static evaluation, but for a non-leaf node x,
assuming that all leaf nodes are at the same depth. Most tournament-oriented programs are based on iterative deepening, which means they already apply the evaluation function to internal nodes as well as leaf nodes. In Althöfer’s algorithm, these evaluation function values for internal nodes are used in addition to those for leaf nodes.

$${W}_{x}=\underset{y\in \Gamma \left(x\right)}{max}\{-{W}_{y}\}+f\left(x\right)\phantom{\rule{0.277778em}{0ex}}$$

## 3. Review of Alpha-Beta Pruning

Alpha-Beta pruning [17] is a mathematically sound technique to detect and prune away “dead branches” in a game tree, i.e., branches that cannot have an effect on the outcome of the search. Today, alpha-beta pruning remains a crucial component of any practical game program that uses minimaxing.

Figure 1 shows alpha-beta pruning applied to the standard negamax formulation of minimax search. If x is a node in a game tree, let $\ell \left(x\right)$ denote its level and let $p\left(x\right)$ denote its parity,
When the algorithm begins processing a new node x, the parameter α represents the current maximum valuation of any node of x’s parity that is an ancestor of x. The parameter β represents the negative of the current maximum valuation of any node of the opposite parity to x that is an ancestor of x. For example, in Figure 2, x is passed $\alpha =-2$ and $\beta =1$. The $\alpha =-2$ indicates the fact that u has a value of $-2$. The $\beta =1$ represents the fact that y currently has a value of $-\left(1\right)$. When z returns to x a value of $2>\beta $ (note that when we say “return to x” we mean the value returned by z after x has negated it), it becomes clear that the remaining children of x do not need to be examined. This is because the value that x will return to y will be less than or equal to $-2$, which means that y will prefer v over x. Therefore, the remaining children of x become irrelevant and can be safely pruned. When x passes parameters to its own child z, it will pass β equal to the negative of its own α. For x, α represented the highest value of an ancestor of its own parity. Since the child of x will be of opposite parity to x, the value that will be passed for β will correctly be the negative of the maximum value of an ancestor of opposite parity.

$$p\left(x\right)=\left\{\begin{array}{cc}1\hfill & \phantom{\rule{4pt}{0ex}}\mathrm{if}\phantom{\rule{4pt}{0ex}}\ell \left(x\right)\phantom{\rule{4pt}{0ex}}\mathrm{is}\phantom{\rule{4pt}{0ex}}\mathrm{odd}\hfill \\ 0\hfill & \phantom{\rule{4pt}{0ex}}\mathrm{if}\phantom{\rule{4pt}{0ex}}\ell \left(x\right)\phantom{\rule{4pt}{0ex}}\mathrm{is}\phantom{\rule{4pt}{0ex}}\mathrm{even}\hfill \end{array}\right.$$

When x passes the β parameter to a child, it should pass the negation of the maximum value of an ancestor of the child of opposite parity to the child, i.e., of its own parity. This value will either be the negation of the α that x received from its own parent, or it will be the negation of the value of one of the earlier siblings of z (represented in the algorithm in Figure 1 by the variable

`m`), if that sibling returned a value greater than α. For example, consider the situation illustrated in Figure 3 where x had a child w prior to z. If w returns to x a value less than the α of x (e.g., $-4$), then the maximum value of an ancestor of z of x’s own parity will still be the α that x received from y. If, however, w returns to x a value greater than α (e.g., $-1$), then the maximum value of an ancestor of z of x’s parity will be the current value of x itself. Therefore, z will be passed a value of β equal to the negation of the value x received from w, which is a sibling of z.In this way, the values of α and β are propagated throughout the tree, where for each node, they represent a window within which the node must score or else it will be irrelevant.

## 4. Applying Alpha-Beta Pruning to Althöfer’s Algorithm

Figure 4 shows our application of alpha-beta pruning to Althöfer’s algorithm. In Althöfer’s algorithm, as described by Equation (2), the valuation of a node u is equal to the value of the optimal path from a leaf node to u. If y is an ancestor of x, we define the value ${Q}_{x,y}$ of the path ${L}_{x,y}$ from x to y to be

$${Q}_{x,y}=\left[\sum _{z\in {L}_{x,y}\&p\left(z\right)=p\left(y\right)}f\left(z\right)\right]-\left[\sum _{z\in {L}_{x,y}\&p\left(z\right)\ne p\left(y\right)}f\left(z\right)\right]\phantom{\rule{0.277778em}{0ex}}$$

In other words, ${Q}_{x,y}$ is equal to the sum of the evaluation function applied to the nodes in the path ${L}_{x,y}$ of the same parity as y minus the sum of the evaluation function applied to the nodes in the path ${L}_{x,y}$ of the opposite parity to y. The Althöfer valuation ${W}_{u}$ of a node u at a given point in the execution of the search is equal to the optimal value of ${Q}_{x,u}$ such that x belongs to the set of leaf nodes examined thus far,

$${W}_{u}=max\{{Q}_{x,u}\mid x\phantom{\rule{4pt}{0ex}}\mathrm{is}\phantom{\rule{4pt}{0ex}}\mathrm{a}\phantom{\rule{4pt}{0ex}}\mathrm{leaf}\}\phantom{\rule{0.277778em}{0ex}}$$

Consider the situation shown in Figure 5 where x is the node that we are currently processing. As soon as it is discovered that ${W}_{z}=4$, the remaining children of x are cut off because $-{W}_{z}+f\left(x\right)\ge {\beta}_{x}$.

In the application of alpha-beta pruning to standard negamax, as discussed earlier, the parameters ${\alpha}_{x}$ and ${\beta}_{x}$ that are passed to a node x are equal to
where ${V}_{u}$ refers to the current valuation of a node u according to Equation (1). In our algorithm, the meanings are
where $\pi \left(x\right)$ denotes the parent of x. In 18,
because y is the node that maximizes Equation (9) for x. Similarly,
because u is the node that maximizes Equation (8) for x.

$${\alpha}_{x}=max\{{V}_{u}\mid u\phantom{\rule{4pt}{0ex}}\mathrm{is}\phantom{\rule{4pt}{0ex}}\mathrm{an}\phantom{\rule{4pt}{0ex}}\mathrm{ancestor}\phantom{\rule{4pt}{0ex}}\mathrm{of}\phantom{\rule{4pt}{0ex}}x\phantom{\rule{4pt}{0ex}}\mathrm{and}\phantom{\rule{4pt}{0ex}}p\left(u\right)=p\left(x\right)\}\phantom{\rule{0.277778em}{0ex}}$$

$$-{\beta}_{x}=max\{{V}_{v}\mid v\phantom{\rule{4pt}{0ex}}\mathrm{is}\phantom{\rule{4pt}{0ex}}\mathrm{an}\phantom{\rule{4pt}{0ex}}\mathrm{ancestor}\phantom{\rule{4pt}{0ex}}\mathrm{of}\phantom{\rule{4pt}{0ex}}x\phantom{\rule{4pt}{0ex}}\mathrm{and}\phantom{\rule{4pt}{0ex}}p\left(v\right)\ne p\left(x\right)\}\phantom{\rule{0.277778em}{0ex}}$$

$${\alpha}_{x}=max\{{W}_{u}-{Q}_{\pi \left(x\right),u}\mid u\phantom{\rule{4pt}{0ex}}\mathrm{is}\phantom{\rule{4pt}{0ex}}\mathrm{an}\phantom{\rule{4pt}{0ex}}\mathrm{ancestor}\phantom{\rule{4pt}{0ex}}\mathrm{of}\phantom{\rule{4pt}{0ex}}x\phantom{\rule{4pt}{0ex}}\mathrm{and}\phantom{\rule{4pt}{0ex}}p\left(u\right)=p\left(x\right)\}\phantom{\rule{0.277778em}{0ex}}$$

$$-{\beta}_{x}=max\{{W}_{v}-{Q}_{\pi \left(x\right),v}\mid v\phantom{\rule{4pt}{0ex}}\mathrm{is}\phantom{\rule{4pt}{0ex}}\mathrm{an}\phantom{\rule{4pt}{0ex}}\mathrm{ancestor}\phantom{\rule{4pt}{0ex}}\mathrm{of}\phantom{\rule{4pt}{0ex}}x\phantom{\rule{4pt}{0ex}}\mathrm{and}\phantom{\rule{4pt}{0ex}}p\left(v\right)\ne p\left(x\right)\}\phantom{\rule{0.277778em}{0ex}}$$

$$\begin{array}{ccc}\hfill -{\beta}_{x}=2& =& {W}_{y}-[f\left(y\right)-f\left(u\right)+f\left(v\right)]\phantom{\rule{0.277778em}{0ex}}\hfill \\ & =& -3-\left[\right(-1)-(1)+(-3\left)\right]\phantom{\rule{0.277778em}{0ex}}\hfill \\ & =& -3-[-5]=2\phantom{\rule{0.277778em}{0ex}}\hfill \end{array}$$

$$\begin{array}{ccc}\hfill {\alpha}_{x}=-7& =& {W}_{u}-[f\left(u\right)-f\left(v\right)]\phantom{\rule{0.277778em}{0ex}}\hfill \\ & =& -3-[1-(-3\left)\right]\phantom{\rule{0.277778em}{0ex}}\hfill \\ & =& -3-\left[4\right]=-7\phantom{\rule{0.277778em}{0ex}}\hfill \end{array}$$

## 5. Concluding Remarks

The issue of pathology in game trees might be expected to become more problematic as technological advances allow us to search deeper and deeper game trees. With more difficult games, such as Go [18], game tree pathology could come to the fore as a prohibitive factor. With Althöfer’s algorithm, there is a guarantee that evaluation errors will not grow to dominate the search, and, for programs that use iterative deepening, Althöfer’s algorithm will not add much additional computational burden. In this brief paper, we have shown how alpha-beta pruning, an important component of realistic game programs, can be added to the algorithm, making its practical application more feasible.

The author is indebted to the anonymous reviewers for their useful comments, which substantially improved the paper.

## References

- Pearl, J. On the nature of pathology in game searching. Artif. Intell.
**1983**, 20, 427–453. [Google Scholar] [CrossRef] - Delcher, A.; Kasif, S. Improved Decision-Making in Game Trees: Recovering from Pathology. In Proceedings of the National Conference on Artificial Intelligence, San Hose, CA, USA, September 1992; pp. 513–518.
- Luštrek, M.; Gams, M.; Bratko, I. Is real-valued minimax pathological. Artif. Intell.
**2006**, 170, 620–642. [Google Scholar] [CrossRef] - Luštrek, M.; Bulitko, V. Thinking too much: Pathology in Pathfinding. In Proceedings of the 2008 Conference on ECAI, Patras, Greece, July 2008; pp. 899–900.
- Luštrek, M. Pathology in heuristic search. AI Commun.
**2008**, 21, 211–213. [Google Scholar] - Mutchler, D. The multiplayer version of minimax displays game-tree pathology. Artif. Intell.
**1993**, 64, 323–336. [Google Scholar] [CrossRef] - Nau, D.S. An investigation of the causes of pathology in games. Artif. Intell.
**1982**, 19, 257–278. [Google Scholar] [CrossRef] - Nau, D.S. Pathology on game trees revisited and an alternative to minimaxing. Artif. Intell.
**1983**, 21, 221–244. [Google Scholar] [CrossRef] - Nau, D.S.; Luštrek, M.; Parker, A.; Bratko, I.; Gams, M. When is it better not to look ahead. Artif. Intell.
**2010**, 174, 1323–1338. [Google Scholar] [CrossRef] - Pearl, J. Asymptotic properties of minimax trees and game-searching procedures. Artif. Intell.
**1980**, 14, 113–138. [Google Scholar] [CrossRef] - Piltaver, R.; Luštrek, M.; Gams, M. The pathology of heuristic search in the 8-puzzle. J. Exp. Theor. Artif. Intell.
**2012**, 24, 65–94. [Google Scholar] [CrossRef] - Sadikov, A.; Bratko, I.; Konenenko, I. Bias and pathology in minimax search. Theor. Comput. Sci.
**2005**, 349, 261–281. [Google Scholar] [CrossRef] - Schrufer, G. Presence and Absence of Pathology on Game Trees. In Advances in Computer Chess; Beal, D.F., Ed.; Pergamon: Oxford, UK, 1986; volume 4, pp. 101–112. [Google Scholar]
- Wilson, B.; Parker, A.; Nau, D. Error Minimizing Minimax: Avoiding Search Pathology in Game Trees. In Proceedings of International Symposium on Combinatorial Search (SoCS-09), Los Angeles, CA, USA, July 2009.
- Althöfer, I. An incremental negamax algorithm. Artif. Intell.
**1990**, 43, 57–65. [Google Scholar] [CrossRef] - Karp, R.M.; Pearl, J. Searching for an optimal path in a tree with random costs. Artif. Intell.
**1983**, 21, 99–116. [Google Scholar] [CrossRef] - Knuth, D.E.; Moore, R.W. An analysis of alpha-beta pruning. Artif. Intell.
**1975**, 6, 293–326. [Google Scholar] [CrossRef] - Müller, M. Computer Go. Artif. Intell.
**2002**, 134, 145–179. [Google Scholar] [CrossRef]

© 2012 by the authors licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license ( http://creativecommons.org/licenses/by/3.0/).