1
function negamax(node, depth, α, β, color)
if node is a terminal node or depth = 0
return color * the heuristic value of node
else
foreach child of node
val := -negamax(child, depth-1, -β, -α, -color)
{the following if statement constitutes alpha-beta pruning}
if val≥β
return val
if val≥α
α:=val
return α
したがって、上記のは(ウィキペディアからコピーされた)私のnegamaxコードで、次のようにそれが呼び出された場合:Negamaxは常に正の値を返しますか?
その後negamax(origin, depth, -inf, +inf, 1)
、この関数は関係なく、常に我々が呼んでいるものの深さの正の値を返します。で機能する。これは、ヒューリスティックな値そのものが常に正であることを前提としています。