• Book Name: Invent Your Own Computer Games with Python 4th Edition
  • Author: A L Sweigart
  • Pages: 374
  • Size: 9 MB
invent your own computer games with python free pdf download

Invent Your Own Computer Games with Python

When I first played video games as a kid, I was hooked. But I didn’t just want to play video games, I wanted to make them. I found a book like this one that taught me how to write my first programs and games. It was fun and easy. The first games I made were like the ones in this book. They weren’t as fancy as the Nintendo games my parents bought for me, but they were games I had made myself.

Now, as an adult, I still have fun programming and I get paid for it. But even if you don’t want to become a computer programmer, programming is a useful and fun skill to have. It trains your brain to think logically, make plans, and reconsider your ideas whenever you find mistakes in your code.


Many programming books for beginners fall into two categories. The first category includes books that don’t teach programming so much as “game creation software” or languages that simplify so much that what is taught is no longer programming. The other category consists of books that teach programming like a mathematics textbook—all principles and concepts, with few real-life applications for the reader. This book takes a different approach and teaches you how to program by making video games. I show the source code for the games right up front and explain programming principles from the examples. This approach was the key for me when I was learning to program. The more I learned how other people’s programs worked, the more ideas I had for my own programs.

All you’ll need is a computer, some free software called the Python interpreter, and this book. Once you learn how to create the games in this book, you’ll be able to develop games on your own.

Computers are incredible machines, and learning to program them isn’t as hard as people think. A computer program is a bunch of instructions that the computer can understand, just like a storybook is a bunch of sentences that the reader can understand. To instruct a computer, you write a program in a language the computer understands. This book will teach you a programming language called Python. There are many other programming languages you can learn, like BASIC, Java, JavaScript, PHP, and C++.

When I was a kid, I learned BASIC, but newer programming languages like Python are even easier to learn. Python is also used by professional programmers in their work and when programming for fun. Plus it’s totally free to install and use—you’ll just need an internet connection to download it. Because video games are nothing but computer programs, they are also made up of instructions. The games you’ll create from this book seem simple compared to the games for Xbox, PlayStation, or Nintendo. These games don’t have fancy graphics because they’re meant to teach you coding basics. They’re purposely simple so you can focus on learning to program. Games don’t have to be complicated to be fun!


Who Is This Book For?

Programming isn’t hard, but it is hard to find materials that teach you to do interesting things with programming. Other computer books go over many topics most new coders don’t need. This book will teach you how to program your own games; you’ll learn a useful skill and have fun games to show for it! This book is for:

• Complete beginners who want to teach themselves programming, even if they have no previous experience. • Kids and teenagers who want to learn programming by creating games. • Adults and teachers who wish to teach others programming. • Anyone, young or old, who wants to learn how to program by learning a professional programming language.


About This Book

In most of the chapters in this book, a single new game project is introduced and explained. A few of the chapters cover additional useful topics, like debugging. New programming concepts are explained as games make use of them, and the chapters are meant to be read in order. Here’s a brief rundown of what you’ll find in each chapter:

• Chapter 1: The Interactive Shell explains how Python’s interactive shell can be used to experiment with code one line at a time.
• Chapter 2: Writing Programs covers how to write complete programs in Python’s file editor.
• In Chapter 3: Guess the Number, you’ll program the first game in the book, Guess the Number, which asks the player to guess a secret number and then provides hints as to whether the guess is too high or too low.
• In Chapter 4: A Joke-Telling Program, you’ll write a simple program that tells the user several jokes.
• In Chapter 5: Dragon Realm, you’ll program a guessing game in which the player must choose between two caves: one has a friendly dragon, and the other has a hungry dragon.
• Chapter 6: Using the Debugger covers how to use the debugger to fix problems in your code.
• Chapter 7: Designing Hangman with Flowcharts explains how flowcharts can be used to plan longer programs, such as the Hangman game.
• In Chapter 8: Writing the Hangman Code, you’ll write the Hangman game, following the flowchart from Chapter 7.
• Chapter 9: Extending Hangman extends the Hangman game with new features by making use of Python’s dictionary data type.
• In Chapter 10: Tic-Tac-Toe, you’ll learn how to write a human-versuscomputer Tic-Tac-Toe game that uses artificial intelligence.
• In Chapter 11: The Bagels Deduction Game, you’ll learn how to make a deduction game called Bagels in which the player must guess secret numbers based on clues.
• Chapter 12: The Cartesian Coordinate System explains the Cartesian coordinate system, which you’ll use in later games.
• In Chapter 13: Sonar Treasure Hunt, you’ll learn how to write a treasure hunting game in which the player searches the ocean for lost treasure chests.
• In Chapter 14: Caesar Cipher, you’ll create a simple encryption program that lets you write and decode secret messages.
• In Chapter 15: The Reversegam Game, you’ll program an advanced human-versus-computer Reversi-type game that has a nearly unbeatable artificial intelligence opponent.
• Chapter 16: Reversegam AI Simulation expands on the Reversegam game in Chapter 15 to make multiple AIs that compete in computerversus- computer games.
• Chapter 17: Creating Graphics introduces Python’s pygame module and shows you how to use it to draw 2D graphics.
• Chapter 18: Animating Graphics shows you how to animate graphics with pygame.

• In Chapter 19: Collision Detection, you’ll learn how to detect when objects collide with each other in 2D games.
• In Chapter 20: Using Sounds and Images, you’ll improve your simple pygame games by adding sounds and images.
• Chapter 21: A Dodger Game with Sounds and Images combines the concepts in Chapters 17 to 20 to make an animated game called Dodger.

©enotes4u.com/ invent your own computer games with python free pdf download.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *