简体   繁体   English

为Reversi / Othello游戏的negamax / minimax创建节点

[英]Creating Node for negamax/minimax for Reversi/Othello game

I write AI player for reversi game, and I decide to do it with NegaMax or MiniMax. 我为逆转游戏编写AI播放器,并决定使用NegaMax或MiniMax来做。 Pseodocode: 伪代码:

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 α

But I need to sent Node to this function, how can I create this node? 但是我需要将Node发送到此函数,如何创建此节点? Like create Node with all possibles move for state, and then create child-nodes for everyone possible move in Node? 像使用所有可能的状态移动节点,然后为节点中每个可能的移动节点创建子节点一样?

And if you can help with α, β values... 如果您可以帮助解决α,β值...

Node likely is meant to represent a single state. 节点可能意味着代表一个状态。 In games this is the state of the board (for Othello the placement of the pieces, whose move it is. etc.). 在游戏中,这是棋盘的状态(对于奥赛罗来说,棋子的位置,棋子的移动等)。 Generally in games that use alpha/beta pruning, generating all the next states is possible, but generating all the states for all possible positions is not. 通常,在使用alpha / beta修剪的游戏中,可以生成所有下一个状态,但不能为所有可能的位置生成所有状态。

If you're using Java, then a Node object might have a method getChildren() to generate all possible moves from that state, themselves Node objects. 如果您使用的是Java,则Node对象可能具有方法getChildren()来从该状态(即Node对象)生成所有可能的移动。

As for the α, β values, these are initialized at Integer.MIN_VALUE and Integer.MAX_VALUE 至于α,β值,这些值在Integer.MIN_VALUE和Integer.MAX_VALUE处初始化

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM