我正在自学极小化极大算法,希望有人能回答我几个问题。
首先,在第05行中,符号:=是什么意思?
其次,在第08/14行中,我注意到方法max或min被调用时带有两个参数,这个方法会返回什么?它会返回迄今为止找到的最大值还是最小值?是否有伪代码示例或者我理解错了?
首先,在第05行中,符号:=是什么意思?
其次,在第08/14行中,我注意到方法max或min被调用时带有两个参数,这个方法会返回什么?它会返回迄今为止找到的最大值还是最小值?是否有伪代码示例或者我理解错了?
01 function minimax(node, depth, maximizingPlayer)
02 if depth = 0 or node is a terminal node
03 return the heuristic value of node
04 if maximizingPlayer
05 bestValue := −∞
06 for each child of node
07 v := minimax(child, depth − 1, FALSE)
08 bestValue := max(bestValue, v)
09 return bestValue
10 else (* minimizing player *)
11 bestValue := +∞
12 for each child of node
13 v := minimax(child, depth − 1, TRUE)
14 bestValue := min(bestValue, v)
15 return bestValue