[英]Creating Node for negamax/minimax for Reversi/Othello game
我为逆转游戏编写AI播放器,并决定使用NegaMax或MiniMax来做。 伪代码:
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 α
但是我需要将Node发送到此函数,如何创建此节点? 像使用所有可能的状态移动节点,然后为节点中每个可能的移动节点创建子节点一样?
如果您可以帮助解决α,β值...
节点可能意味着代表一个状态。 在游戏中,这是棋盘的状态(对于奥赛罗来说,棋子的位置,棋子的移动等)。 通常,在使用alpha / beta修剪的游戏中,可以生成所有下一个状态,但不能为所有可能的位置生成所有状态。
如果您使用的是Java,则Node对象可能具有方法getChildren()来从该状态(即Node对象)生成所有可能的移动。
至于α,β值,这些值在Integer.MIN_VALUE和Integer.MAX_VALUE处初始化
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.