func max(alpha,beta,state):
v=max(action,min(alpha,-infinite,infinite)) for action in action(s)
return action which in actions(state) with value=v
func max-value(alpha,beta,state):
if end(state):return u(state)
v=-infinite
for action in action(s):
v=max(v,min-value(alpha,beta,result(state,action))
if v<=beta:return v
alpha=max(v,alpha)
return v
func min-value(alpha,beta,state):
if end(state):return u(state)
v=infinite
for action in action(s):
v=min(v,max-value(alpha,beta,result(state,action)))
if v>=alpha:return v
beta=min(v,beta)
return v
提供一种框架,上下剪枝,更新上下界,从而减少不必要的搜索量。