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 depth-limited cat - Python Tutorial
From the course: AI Algorithms for Gaming
Code example: A depth-limited cat
- [Instructor] So now let me show you my implementation of the depth limited search algorithm. First the CustomCat takes this with the DLS flag. We have this at lane 92, as you can see the arguments are the maximum depth and the Alpha-Beta flag. So let's see this function. So in line 137 we have once more just a wrapper, but now for the Alpha-Beta function or the minimax function, it depends on the Alpha-Beta flag and notice that both functions are taking the max_depth parameter. So let's see how these functions handle this max_depth. And I will show this to you only in the minimax implementation. You see that the same logic is going on in the Alpha-Beta implementation. So notice that when we use minimax in line 296, we are using the max_depth parameter with a default value of infinity. That is dig as deep as you can, but if we sent some number there, that will be taken as the maximum depth we are willing to dig…
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.