簡體   English   中英

為Reversi / Othello游戲的negamax / minimax創建節點

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM