알파베타가지치기입니다
01 function alphabeta(node, depth, α, β, maximizingPlayer)
02 if depth = 0 or node is a terminal node
03 return the heuristic value of node
04 if maximizingPlayer
05 v := -∞
06 for each child of node
07 v := max(v, alphabeta(child, depth - 1, α, β, FALSE))
08 α := max(α, v)
09 if β ≤ α
10 break (* β cut-off *)
11 return v
12 else
13 v := ∞
14 for each child of node
15 v := min(v, alphabeta(child, depth - 1, α, β, TRUE))
16 β := min(β, v)
17 if β ≤ α
18 break (* α cut-off *)
19 return v
minimax 알고리즘의 검색트리를 탐색하는데 그 경우의 수를 줄이는 탐색 알고리즘이라는데.
minimax 알고리즘은
function minimax(node, depth, maximizingPlayer)
if depth = 0 or node is a terminal node
return the heuristic value of node
if maximizingPlayer
bestValue := -∞
for each child of node
val := minimax(child, depth - 1, FALSE)
bestValue := max(bestValue, val)
return bestValue
else
bestValue := +∞
for each child of node
val := minimax(child, depth - 1, TRUE)
bestValue := min(bestValue, val)
return bestValue
(* Initial call for maximizing player *)
minimax(origin, depth, TRUE)
입니다.
이게뭔소리당께요
본인은 프로그래밍c기초를 한권 공부한 사람입니다.
이해좀시켜주실 프걀형님들 계시나요..
어디 위킨가 찾아보면 너같은 중생을 위한 움짤 설명 있더라