课程: AI Algorithms for Game Design with Python

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

The minimax algorithm

The minimax algorithm

- [Narrator] Now let's see the pseudo code 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 calls 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 the 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 children of the current state that has the value returned…

内容