From the course: AI Algorithms for Gaming

Unlock the full course today

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

Code example: A perfect cat in a small world

Code example: A perfect cat in a small world - Python Tutorial

From the course: AI Algorithms for Gaming

Start my 1-month free trial

Code example: A perfect cat in a small world

- [Instructor] Now I want to show you very briefly, how my implementation of the MinimaxCat works. First, in the CustomCat function, we get to call the minimax function only when none of the checkboxes is selected. That's the default algorithm. So let's go see that function. As you can see in line 123, this is just a wrapper for the Minimax function. But notice that it returns two values. The move and a placeholder, I'm not using. This placeholder contains the value of the best move. Remember that we are not interested in the value of the next move, but rather only in the next location of the cat, which is the move variable. That's what we return. Remember, this is the decision problem, not the optimization problem. So let's see the minimax function. This function is that line 296 and as you can see, it is a wrapper for the max value function. You may have noticed some extra arguments there. Those are useful…

Contents