Minimax
As the question author may already understand, minimax is an approach before it is an algorithm. The goal is to minimize the advantage of a challenger and maximize the advantage of the participant presently applying the minimax approach. This is a subset of a wider strategy of summing benefits and subtracting the sum of costs to derive a net value.
Alpha-beta Pruning
The strategic goal of alpha beta pruning is to produce uncompromized decision making with less work. This goal is usually driven by the cost of computing resources, the impatience of the person waiting on results, or a missed deadline penalty.
The principle involved is that if there is a finite range to the net gain that can aggregate as a result of traversing any subtree in a search. It can be proven, using the algebra of inequalities, that no knowledge can be lost in the search if the subtree cannot, under any conditions, show any net advantage over the other options.
Some Graph Theory to Clarify Pruning
Vertices are the graph theory name for what are often called tree nodes. They are represented as $\nu$ below, and they correspond to states. The connections between vertices are called edges in graph theory. They are represented as $\epsilon$ below, and they correspond to actions.
The minimax net gain thus far accumulated at an vertex can be calculated as the tree is traversed.
As the limitations to net gain at further depths are applied to these intermediate net gain values, it can be inferred that one edge (action) will, in every case, be advantageous over another edge. If an algorithm reveals that one edge leads to disadvantage in every possible case, then there is no need to traverse that edge. Such dismissal of never-advantageous edges saves computing resources and likely reduces search time. The term pruning is used because edges are like branches in a fruit orchard.
The Condition of Pruning and the Algorithm To Accomplish It
Initialization for the algorithm begins by setting the two Greek letter variables to their worst case values.
$$ \alpha = - \infty \\
\beta = \infty $$
The pruning rule for edge $\epsilon$ leading to a vertex $\nu$ is simply this.
$$ \alpha_\nu \geq \beta_\nu \Rightarrow \text{prune}(\epsilon_\nu) $$
Source code doesn't usually directly implement this declaration, but rather produces its effect in the algorithm, which can be represented in simplified pseudo-code. The algorithm to do such is simple once recursion is understood. That is an conceptual prerequisite, so learn about recursion first if not already known.
ab_minimax ν, α, β
if ν.depth = search.max_depth or ν.is_leaf
return ν.value
if ν.is_maximizing
for ε in ν.edges
x = max(β, ab_minimax ε.child, α, β)
if α ≥ β
ν.prune ε
return α
return α
else
for ε in ν.edges
x = min(α, ab_minimax child, α, β)
if α ≤ β
ν.prune ε
return β
return β