Chapter 26. Python Battle
In this book, we’ve covered how to make your own games. One thing we haven’t talked about yet, however, is game artificial intelligence (AI). Almost every game since Pac-Man has had some form of artificial intelligence that attacks the player, and this chapter will show you how to make one yourself.
Python Battle
The AIs we’re going to make in this chapter will be part of a game called Python Battle. Python Battle is a simple game with simple rules. On each turn, you may move forward, turn to face a different direction, or attack. When one bot attacks another, the bot that gets attacked loses one “health point.” The first bot to lose all its health points loses the game. Bots can only attack the square directly in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access