전치 테이블을 사용하여 알파 베타 전정을 구현하려는 중, 위키 백과에서 알고리즘의 의사 코드를 찾았습니다. https://en.wikipedia.org/wiki/Negamax#cite_note-Breuker-1 그러나이 psudocode가 잘못되었다는 것을 알았지 만, alphaOrig는 쓸모가 없다고 생각합니다. 대신의 :알파 베타 전정이있는 전이 테이블
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