Invent Your Own Computer Games with Python will show you how to make classic computer games in Python, even if you've never programmed before.
Each chapter introduces a new game as well as step-by-step explanations of how the code works. As you build games like Reversi, Hangman, Tic-Tac-Toe, Dragon Realm, Guess the Number, Jokes, Dodger, Bagels, and Sonar, you'll learn how programmers turn their game ideas into reality. You'll also find chapters on game refinements like collision detection and input, Cartesian coordinates, artificial intelligence simulation, sounds and images, debuggers, and cryptography, to help you take your game programming to the next level.
Learn how to
- Combine loops, variables, input/output, and flow control statements into real working programs
- Choose the right data structures such as lists, dictionaries, and tuples
- Debug your programs and find common errors
- Program simple artificial intelligence to create smarter adversaries
- Use graphics and animation with Pygame
- Convert plain text into secret code using cryptography
- Translate a location on screen into integers your program can identify with Cartesian coordinates
Once you've worked your way through the fun and games, you'll have a solid foundation in Python, an understanding of computer science fundamentals, and the confidence to advance your new game programming skills.
What new game will you create with the power of Python?
The projects in this book are compatible with Python 3.
Table of Contents
Chapter 1: The Interactive Shell
Chapter 2: Writing Programs
Chapter 3: Guess the Number
Chapter 4: A Joke-Telling Program
Chapter 5: Dragon Realm
Chapter 6: Using the Debugger
Chapter 7: Designing Hangman with Flowcharts
Chapter 8: Writing the Hangman Code
Chapter 9: Extending Hangman
Chapter 10: Tic-Tac-Toe
Chapter 11: The Bagels Deduction Game
Chapter 12: The Cartesian Coordinate System
Chapter 13: Sonar Treasure Hunt
Chapter 14: Caesar Cipher
Chapter 15: The Reversegam Game
Chapter 16: Reversegam AI Simulation
Chapter 17: Creating Graphics
Chapter 18: Animating Graphics
Chapter 19: Collision Detection
Chapter 20: Using Sounds and Images
Chapter 21: A Dodger Game with Sounds and Images