Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword or section
Like this
1Activity

Table Of Contents

Using More Than One Variable
Summary
Strings
String Concatenation
Writing Programs in IDLE's File Editor
Hello World!
hello.py
How the "Hello World" Program Works
The "Guess the Number" Game
Sample Run of "Guess the Number"
Guess the Number's Source Code
guess.py
The import Statement
The random.randint() Function
Passing Arguments to Functions
Blocks
The Boolean Data Type
Comparison Operators
Conditions
Experiment with Booleans, Comparison Operators, and Conditions
The Player Guesses
if Statements
Leaving Loops Early with the break Statement
Check if the Player Won
Check if the Player Lost
Summary: What Exactly is Programming?
A Web Page for Program Tracing
Make the Most of print()
Sample Run of Jokes
Joke's Source Code
jokes.py
Escape Characters
Quotes and Double Quotes
The end Keyword Argument
Introducing Functions
Sample Run of Dragon Realm
Dragon Realm's Source Code
dragon.py
def Statements
Boolean Operators
Return Values
Variable Scope
Parameters
Where to Put Function Definitions
Displaying the Game Results
The Colon :
Where the Program Really Begins
Designing the Program
Bugs!
Starting the Debugger
Stepping
The Go and Quit Buttons
Find the Bug
buggy.py
Break Points
coinFlips.py
How to Play "Hangman"
Sample Run of "Hangman"
ASCII Art
Designing a Program with a Flowchart
Creating the Flow Chart
Summary: The Importance of Planning Out the Game
Hangman's Source Code
hangman.py
Multi-line Strings
Constant Variables
Lists
Changing the Values of List Items with Index Assignment
List Concatenation
The in Operator
Removing Items from Lists with del Statements
Lists of Lists
Methods
The reverse() and append() List Methods
The Difference Between Methods and Functions
The range() and list() Functions
for Loops
elif ("Else If") Statements
Review of the Functions We Defined
Dictionaries
Sets of Words for Hangman
The random.choice() Function
Multiple Assignment
Sample Run of Tic Tac Toe
Source Code of Tic Tac Toe
tictactoe.py
Game AI
List References
Short-Circuit Evaluation
truefalsefizz.py
The None Value
Summary: Creating Game-Playing Artificial Intelligences
Bagel's Source Code
bagels.py
The random.shuffle() Function
Augmented Assignment Operators
The sort() List Method
The join() String Method
String Interpolation
Summary: Getting Good at Bagels
Grids and Cartesian Coordinates
Negative Numbers
Math Tricks
Absolute Values and the abs() Function
Coordinate System of a Computer Monitor
Summary: Using this Math in Games
sonar.py
The remove() List Method
Summary: Review of our Sonar Game
About Cryptography
The Caesar Cipher
ASCII, and Using Numbers for Letters
The chr() and ord() Functions
Sample Run of Caesar Cipher
Caesar Cipher's Source Code
cipher.py
The isalpha() String Method
The isupper() and islower() String Methods
Brute Force
Summary: Reviewing Our Caesar Cipher Program
How to Play Reversi
Sample Run
Reversi's Source Code
reversi.py
The bool() Function
Summary: Reviewing the Reversi Game
"Computer vs. Computer" Games
AISim1.py
AISim2.py
Percentages
The round() Function
Comparing Different AI Algorithms
AISim3.py
Learning New Things by Running Simulation Experiments
Installing Pygame
Hello World in Pygame
Hello World's Source Code
pygameHelloWorld.py
Importing the Pygame Module
Variables Store References to Objects
Fonts, and the pygame.font.SysFont() Function
Attributes
Constructor Functions and the type() function
The pygame.PixelArray Data Type
Events and the Game Loop
Animation
The Animation Program's Source Code
animation.py
Some Small Modifications
Summary: Pygame Programming
The Collision Detection Program's Source Code
The pygame.time.Clock Object and tick() Method
The Keyboard Input Program's Source Code
pygameInput.py
The colliderect() Method
Summary: Collision Detection and Pygame Input
Image and Sound Files
Sprites and Sounds Program
The Sprites and Sounds Program's Source Code
spritesAndSounds.py
Setting Up the Window and the Data Structure
Summary: Games with Graphics and Sounds
Review of the Basic Pygame Data Types
Dodger's Source Code
dodger.py
Implementing the Cheat Codes
Modifying the Dodger Game
Summary: Creating Your Own Games
Glossary
About the Author
0 of .
Results for:
No results containing your search query
P. 1
Invent Your Own Computer Games With Python - Al Sweigart

Invent Your Own Computer Games With Python - Al Sweigart

Ratings: (0)|Views: 16 |Likes:
Published by tblups

More info:

Published by: tblups on Dec 05, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/08/2011

pdf

text

original

You're Reading a Free Preview
Pages 9 to 226 are not shown in this preview.
You're Reading a Free Preview
Pages 235 to 351 are not shown in this preview.
You're Reading a Free Preview
Pages 360 to 416 are not shown in this preview.
You're Reading a Free Preview
Page 425 is not shown in this preview.
You're Reading a Free Preview
Pages 434 to 436 are not shown in this preview.

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->