课程: AI Algorithms for Game Design with Python

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Challenge: A depth-limited cat

Challenge: A depth-limited cat

(upbeat music) - [Instructor] It's coding time again. For this challenge, your task is to modify the code for minimax and alpha beta pruning in their respective max value and min value methods to support depth limited search. Once again, you will find the instructions in the source file, and you will be required to fill in the blanks in a few parts of the code. This time, you may test your cat in any world. The size of the world is not a limitation anymore because you'll have control of the maximum depth to reach. Try it with different depths. To implement limited depth search, we need a few additions to the code. First look at line 38 where we have two new class attributes, max depth, which keeps track of the maximum depth we are willing to reach, and reached max depth, which is a flag we will set the first time we reach the maximum depth. This flag may be useful for this algorithm, but it will become crucial a little later. The first use of these is in the select cat move method…

内容