Explore Library
Code QuizAdvanced

Alpha-Beta Pruning Cutoff

Find the incorrect cutoff condition that breaks alpha-beta pruning.

Codejavascript
function maxValue(node, alpha, beta) {
  if (node.isLeaf) return node.value;
  let v = -Infinity;
  for (const child of node.children) {
    v = Math.max(v, minValue(child, alpha, beta));
    if (v < beta) return v; // cutoff
    alpha = Math.max(alpha, v);
  }
  return v;
}

What is the bug in the pruning cutoff?