Game Tree(2-player, deterministic, turns)
Minimax Algorithm
Concept
Perfect play for deterministic, perfect-information games
Idea: choose move to position with highest minimax value => best achievable payoff against best play
Code
1 | function MINIMAX-DECISION(state) returns an action |
1 | function MAX-VALUE(state) returns a utility value |
1 | function MIN-VALUE(state) returns a utility value |
Properties of minimax
Complete: Yes, if the tree is finite
Optimal: Yes, against an optimal oppoent.
Time complexity: O(b^m)
Space complexity: O(bm)
If we explore every path, the algorithm will run for a lot of time, so it’s necessary to reduce searching-width(d) or searching-depth(m)
Reduce searching-width(d): Alpha-Beta purning
Concept
Code
1 | function ALPHA-BETA-DECISION(state) returns an action |
1 | function MAX-VALUE(state,a,b) returns a utility value |
1 | function MIN-VALUE(state,a,b) returns a utility value |
Properties of Alpha-Beta
Pruning does not affect final result
Good move ordering improvres effectiveness of pruning
With “perfect ordering” time complexity == O(b^(m/2)) => doubles solvable depth
Reduce searching-depth(m): Evaluation functions
An evaluation function returns an estimate of the expected utility of the game from a given position, just as the heuristic functions.