Errata

If you find any typos, please email them to [email protected]. (Apologies in advance if I haven't posted your errata submission yet or failed to give credit. Please email me to correct this.)

Chapter 2 - Pygame Basics

On page 23, there is the sentence, "Unfortunately, there isn’t a single function you can call that will set a single pixel to a color". Actually, there is the set_at() and get_at() methods for Surface objects. (Thanks to Ben LeBlanc)

Chapter 3 - Memory Puzzle

Figure 3-3 has the X and Y coordinates for the box coordinates reversed. (Thanks to tile ile)

Line 224 of the memory puzzle program is for coverage in range(BOXSIZE, (-REVEALSPEED) - 1, - REVEALSPEED):, but that second argument ((-REVEALSPEED) - 1) could be simplified to just -1 and the program would work just fine. This isn't a bug, but the code is kind of confusing.

Chapter 4 - Slide Puzzle

On page 85, there is the sentence, "Much of the code in Wormy is similar to the previous games we’ve looked at, especially the constants being set at the start of the code." which should actually read, "Much of the code in Slide Puzzle is similar to the previous games we’ve looked at, especially the constants being set at the start of the code." (Thanks to Ben LeBlanc)

Line 151 of slidePuzzle.py has an extra closing parentheses at the end of the line. (Thanks to Eduardo França)

On page 97, there is "Depending on if the blank space is at the edge of the board, lines 184 to 191 will remove other directional values from the lastMove list. Of the values that are left in lastMove, one of them is randomly selected with a call to random.choice() and returned." should be "Depending on if the blank space is at the edge of the board, lines 184 to 191 will remove other directional values from the validMoves list. Of the values that are left in validMoves, one of them is randomly selected with a call to random.choice() and returned." (Thanks to Tyler Mitchell)

On page 100, there is the sentence "Finally, we draw the buttons off to the slide of the screen" which should be "Finally, we draw the buttons off to the side of the screen" (Thanks to Tyler Michell)

Chapter 5 - Simulate

On page 129, the sentence "We could have left line 47 out entirely" should be "We could have left line 247 out entirely". (Thanks to C. Whitt)

Chapter 6 - Wormy

On page 131, the sentence "...a new apply randomly appears on the screen." should be "...a new apple randomly appears on the screen." (Thanks to C. Whitt)

Chapter 10 - Four Extra Games

On page 305, the sentence "If the player gets board of the colors..." should be "If the player gets bored of the colors..." (Thanks to David Keck)