Alpha-beta Pruning - Pseudocode

Pseudocode

function alphabeta(node, depth, α, β, Player) if depth = 0 or node is a terminal node return the heuristic value of node if Player = MaxPlayer for each child of node α := max(α, alphabeta(child, depth-1, α, β, not(Player) )) if β ≤ α break (* Beta cut-off *) return α else for each child of node β := min(β, alphabeta(child, depth-1, α, β, not(Player) )) if β ≤ α break (* Alpha cut-off *) return β (* Initial call *) alphabeta(origin, depth, -infinity, +infinity, MaxPlayer)

Read more about this topic:  Alpha-beta Pruning