1
我在教自己的minimax算法,我只是有几个问题,我希望有人可以回答。了解minmax伪代码
首先在行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
:=是一项任务。 – Maroun