The Essential Guide to HTML5

(Greg DeLong) #1

HANGMAN


293

Figure 9-10. After a correct guess of m


At this point, I am trying to lose, so I guess b. This results in what is depicted in Figure 9-11.


Figure 9-11. Game lost


Notice that the drawing shows a noose; the complete secret word is revealed; and a message appears
telling the player that the game is lost and to reload to try again.


Figure 9-12 shows a screenshot from another game, and the computer has responded to a guess of the
letter e by showing it in two positions. Handling letters appearing more than once is not difficult, but that
certainly was not obvious to me before I started the programming.


i
Free download pdf