【发布时间】:2012-10-11 01:14:19
【问题描述】:
我无法理解我在*上找到的用于 alpha beta 修剪的伪代码:
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 β
令我困惑的是 if Player = MaxPlayer 条件。我理解整个用not(Player)递归调用函数来获得最小值,然后用Player递归调用函数,重复直到达到深度限制或找到目标状态。但是,我不明白
if β ≤ α
break
声明。我对此的理解是,找到第二个高于上次调用中找到的最小值(β)的值,即使用的值。但是由于这是函数的 MAX 部分,我们不想要 HIGHEST 值,而不仅仅是任何大于 beta 的值吗?
【问题讨论】:
标签: algorithm search artificial-intelligence alpha-beta-pruning