Artificial intelligence Negamax';初始函数调用看起来像是最小化根节点而不是最大化?

Artificial intelligence Negamax';初始函数调用看起来像是最小化根节点而不是最大化?,artificial-intelligence,minimax,negamax,tree-search,Artificial Intelligence,Minimax,Negamax,Tree Search,Negamax通常如下所示: function negamax(node, depth, α, β, color) is if depth = 0 or node is a terminal node then return color × the heuristic value of node childNodes := generateMoves(node) childNodes := orderMoves(childNodes) value

Negamax通常如下所示:

function negamax(node, depth, α, β, color) is
    if depth = 0 or node is a terminal node then
        return color × the heuristic value of node
    childNodes := generateMoves(node)
    childNodes := orderMoves(childNodes)
    value := −∞
    foreach child in childNodes do
        value := max(value, −negamax(child, depth − 1, −β, −α, −color))
        α := max(α, value)
        if α ≥ β then
            break (* cut-off *)
    return value
初始调用是
negamax(rootNode,depth,−∞, +∞, 1) 
如果玩家调用它

我以最大化玩家调用的方式实现了Negamax,但每个
rootNode
都是最大化玩家的移动之一:

function negamaxHandler() is
    bestValue := −∞
    bestNode := null
    childNodes := generateMoves(currentGameState)
    foreach child in childNodes do
        value := negamax(child, depth-1, ???, ???, ???)
        if value > bestValue then
            bestValue := value
            bestNode := child
    return bestNode
因为Negamax返回一个值,所以我需要一个板状态(move)。因此,我手动执行Negamax的第一级,以便分析最佳移动位置。但是,对于什么值,我应该调用
negamax
on?更具说明性的是,如果调用
negamaxHandler
,则应
negamaxHandler
调用:

negamax(child, depth-1, −∞, +∞, 1)
-negamax(child, depth-1, −∞, +∞, 1)
negamax(child, depth-1, +∞, −∞, -1)
-negamax(child, depth-1, +∞, −∞, -1)
还是别的什么?澄清:

  • 最大化玩家呼叫
    negamaxHandler
  • negamaxHandler
    中对
    negamax
    的每个顶级调用都应该最小化

正确的函数调用是
-negamax(child,depth-1,−∞, +∞, -1) 
,尽管需要更改
negamaxHandler
功能:

function negamaxHandler(α, β, color) is
    bestValue := −∞
    bestNode := null
    childNodes := generateMoves(currentGameState)
    foreach child in childNodes do
        value := -negamax(child, depth-1, -β, -α, -color)
        if value > bestValue then
            bestValue := value
            bestNode := child
        α := max(bestValue, α)
        if α ≥ β then
           break
    return bestNode
negamaxHandler
称为
negamaxHandler(−∞, +∞, 1)