From the course: AI Algorithms for Gaming
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Code example: A pruning cat - Python Tutorial
From the course: AI Algorithms for Gaming
Code example: A pruning cat
- [Instructor] Let me show you my implementation of the Alpha-Beta Cat. So, the custom cat function takes the Alpha-Beta pruning algorithm from the AB fly. And you can see that this is used in line 97. Once again, only if AB is selected, we will use the Alpha-Beta Cat function. Notice that this AB fly is also used in lines 92 and in line 95 because Alpha-Beta pruning can be used with the other optimizations of the algorithm. So let's fast forward to the Alpha-Beta function. Once again, in line 130, we have the Alpha-Beta Cat function, which works just like the mini max cat function. And the Alpha-Beta function is in line 384. As you can see, the function call works pretty much like the mini max call. Once again, we are sending a move of minus one, minus one to the first call. And the function we call is called AB max value, for Alpha-Beta pruning max value. Let's look at it. As you can see in line 314, this function…
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 45s
-
(Locked)
Code example: A perfect cat in a small world6m
-
(Locked)
Alpha-beta pruning5m 32s
-
(Locked)
The alpha-beta search algorithm5m 9s
-
(Locked)
Code example: A pruning cat3m 25s
-
-
-
-
-