From the course: AI Algorithms for Gaming

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

The minimax algorithm

The minimax algorithm - Python Tutorial

From the course: AI Algorithms for Gaming

Start my 1-month free trial

The minimax algorithm

- Now let's see the Pseudocode for Minimax, as seen in the celebrated book, Artificial Intelligence A Modern Approach by Peter Norvig and Stuart Russell. First, recall that we use Minimax to produce a move, or more formally an action to take next at a given state of the game. But minimax is an optimization algorithm that produces a number, a score. So the decision algorithm for Minimax is just a wrapper for the function that implements the top max node. So in line one, we have the declaration of this minimax decision function, which takes a state as argument and returns an action. Line two, call to the function that implements the max node decision. This function is called Max Value, and as you can see it takes the same state of the game as argument. The result of this function is this score chosen by the max node and it's assigned to a value variable V. In line three, we return the action among the successors or…

Contents