From the course: AI Algorithms for Game Design with Python

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Challenge: A perfect cat in a small world

Challenge: A perfect cat in a small world - Python Tutorial

From the course: AI Algorithms for Game Design with Python

Challenge: A perfect cat in a small world

(upbeat bright music) - [Instructor] It is time for your first challenge. I like to call this "A Perfect Cat in a Small World". Your task is to finish the minimax algorithm, but don't worry, you won't have to write it from scratch. You'll just have to fill in the blanks indicated in the code. Now, let's talk about expectations. The title of this challenge is a playful hint, but it also serves as a reminder. Minimax can take an extremely long time to finish. To test your code efficiently within the default deadline of five seconds, you'll need to work with a very small world like this one. And when I say small, I mean two things. First, it's a five by five hex grid, and second, it has very few free tiles. After you block one tile, there will only be seven free tiles, which leads to 14 possible turns or a maximum depth of 14. This can definitely be achieved in less than five seconds. All challenges are in the CatTrapAlgorithms.pi source file in their respective folder. At the beginning…

Contents