転置テーブルを使ったアルファベータプルーニングを実装しようとしていますが、私はアルゴリズムの擬似コードをwikipediaで見つけました:https://en.wikipedia.org/wiki/Negamax#cite_note-Breuker-1 しかし、私はこのpsudocodeが間違っていると信じています。そして代わりに:アルファベータ刈り込みの転置テーブル
if bestValue ≤ alphaOrig
ttEntry.Flag := UPPERBOUND
それは次のようになります。
if bestValue ≤ α
ttEntry.Flag := UPPERBOUND
誰もが私が正しいかどうかを確認または私が間違っている理由を私に説明することができ、感謝!ここで
擬似コード:
function negamax(node, depth, α, β, color)
alphaOrig := α
// Transposition Table Lookup; node is the lookup key for ttEntry
ttEntry := TranspositionTableLookup(node)
if ttEntry is valid and ttEntry.depth ≥ depth
if ttEntry.Flag = EXACT
return ttEntry.Value
else if ttEntry.Flag = LOWERBOUND
α := max(α, ttEntry.Value)
else if ttEntry.Flag = UPPERBOUND
β := min(β, ttEntry.Value)
endif
if α ≥ β
return ttEntry.Value
endif
if depth = 0 or node is a terminal node
return color * the heuristic value of node
bestValue := -∞
childNodes := GenerateMoves(node)
childNodes := OrderMoves(childNodes)
foreach child in childNodes
v := -negamax(child, depth - 1, -β, -α, -color)
bestValue := max(bestValue, v)
α := max(α, v)
if α ≥ β
break
// Transposition Table Store; node is the lookup key for ttEntry
ttEntry.Value := bestValue
if bestValue ≤ alphaOrig
ttEntry.Flag := UPPERBOUND
else if bestValue ≥ β
ttEntry.Flag := LOWERBOUND
else
ttEntry.Flag := EXACT
endif
ttEntry.depth := depth
TranspositionTableStore(node, ttEntry)
return bestValue