Analyzing the Alpha-beta pruning algorithm in its fail-hard and fail-soft versions, I cannot find the difference in its behavior:
Fail-hard
function alphabeta(node, depth, α, β, maximizingPlayer) is
if depth = 0 or node is a terminal node then
return the heuristic value of node
if maximizingPlayer then
value := −∞
for each child of node do
value := max(value, alphabeta(child, depth − 1, α, β, FALSE))
if value ≥ β then
break (* β cutoff *)
α := max(α, value)
return value
else
value := +∞
for each child of node do
value := min(value, alphabeta(child, depth − 1, α, β, TRUE))
if value ≤ α then
break (* α cutoff *)
β := min(β, value)
return value
Fail-soft
function alphabeta(node, depth, α, β, maximizingPlayer) is
if depth = 0 or node is a terminal node then
return the heuristic value of node
if maximizingPlayer then
value := −∞
for each child of node do
value := max(value, alphabeta(child, depth − 1, α, β, FALSE))
α := max(α, value)
if value ≥ β then
break (* β cutoff *)
return value
else
value := +∞
for each child of node do
value := min(value, alphabeta(child, depth − 1, α, β, TRUE))
β := min(β, value)
if value ≤ α then
break (* α cutoff *)
return value
I understand that in fail-soft, both alpha and beta are determined before evaluating break de for-loop (branch), but:
- In the event that the analysis in the branch must end, the value of alpha and beta determined have no effect on the analyzes carried out in the rest of the other branches that will be found above it. am I not understanding the pseudocode correctly?
Thank you very much!