This chapter's game project is the Rock, Paper and Scissors game. The rules of the game are quite simple. Each player attempts to outguess an opponent (in this case, the computer) by consistently selecting the better of three choices. The rules for resolving each game are as follows:
Rock crushes scissors to win.
Paper covers rock to win.
Scissors cuts paper to win.
Matching choices automatically tie.
Figures 9.1 to 9.5 illustrate how the Rock, Paper and Scissors game works, outlining the application's overall functionality and execution.
Figure 9.1: The Rock, Paper and Scissors game begins by displaying the game board.
Figure 9.2: When the player clicks on the Play button, a 1.5-second countdown begins.
Figure 9.3: The player gets a half second at the end of the countdown to make a selection by choosing rock, paper, or scissors.
Figure 9.4: As soon as both the computer and the player have made their choices, the game displays graphics showing each move and determines who won.
Figure 9.5: The Rock, Paper and Scissors game also keeps a running tally of the number of wins, losses, and ties.