I'm looking at this pseudocode for the Minimax algorithm:
Function Minimax-Decision(state) returns an action
;inputs: state (current game state)
;'E' means element of, 'a' is the action
return a E Actions(state) maximizing Min-Value(Result(a, state))
Function Max-Value(state) returns a utility value
if Terminal-Test(state) then return Utility(state)
v <-- -infinity
for a, s in Successors(state) do v <-- Max(v, Min-Value(s))
return v
Function Min-Value(state) returns a utility value
if Terminal-Test(state) then return Utility(state)
v <-- infinity
for a, s in Successors(state) do v <-- Min(v, Max-Values(s))
return v
I think I know how the Minimax algorithm works. You fill "score" values from the bottom up starting from the utility scores. At Max's nodes are the largest of its children, Min's will be the smallest. Max predicts that Min will always try to put Max in the worst position possible for next turn, and using that knowledge, Max tries to make the best move possible.
So for: with order Max,Min,Max from the top
1) Max wants to make the best move for himself (max utility) so C1=5,C2=11,C3=8,etc
2) Max predicts that Min will want to put Max in the worst position possible (restrict Max to smallest utility) so B1=5,B2=2,B3=3
3) Max wants to make best possible move, so A=B1=5
Whats confusing me about the pseudocode is the double recursion, and the purpose of v. Can anyone break this one down for me?
Thanks for reading everyone!