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

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…

Contents