firstSelection = None # stores the (x, y) of the first box clicked. DISPLAYSURF.fill(BGCOLOR) startGameAnimation(mainBoard)
Line 1  sets up a variable called
firstSelection with the value
None is the value that represents a lack of a value. It is the only value of the data type,
NoneType. More info at http://invpy.com/None) When the player clicks on an icon on the board, the program needs to track if this was the first icon of the pair that was clicked on or the second icon. If
None, the click was on the first icon and we store the XY coordinates in the
firstSelection variable as a tuple of two integers (one for the X value, the other for Y). On the second click the value will be this tuple and not
None, which is how the program tracks that it is the second icon click. Line 3  fills the entire surface with the background color. This will also paint over anything that used to be on the surface, which gives us a clean slate to start drawing graphics on.
If you’ve played the Memory Puzzle game, you’ll notice that at the beginning of the game, all of the boxes are quickly covered and uncovered randomly to give the player a sneak peek at which icons are under which boxes. This all happens in the
startGameAnimation() function, which is explained later in this chapter.
It’s important to give the player this sneak peek (but not long enough of a peek to let the player easily memorize the icon locations), because otherwise they would have no clue where any icons are. Blindly clicking on the icons isn’t as much fun as having a little hint to go on.