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 - Python Tutorial
From the course: AI Algorithms for Gaming
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Minimax overview4m 1s
-
(Locked)
Minimax example5m
-
(Locked)
The minimax algorithm3m 41s
-
(Locked)
A word on complexity2m 46s
-
(Locked)
Code example: A perfect cat in a small world6m
-
(Locked)
Alpha-beta pruning5m 32s
-
(Locked)
The alpha-beta search algorithm5m 10s
-
(Locked)
Code example: A pruning cat3m 25s
-
-
-
-
-