HTML and CSS Reference
In-Depth Information
makes sense to start small and, once you are happy with your game, make a longer list. My technique of
using an external file for the word list supports this approach.
For the user interface, I chose to place blocks with each letter of the alphabet on the screen. The player
chooses a letter by clicking a block. After a letter is selected, its block disappears. This decision was
influenced by the fact that most people playing the pencil-and-paper version write out the alphabet and
cross out the letters as they are chosen.
Figure 9-1 shows the opening screen. The computer has selected a word with four letters. Notice that in
our program, the gallows appears on the screen already. Alternatively, you can choose to make that the
first one or two steps of the progression of drawings.
Figure 9-1. Opening screen
One advantage to using a small word bank is that I know what the word is now, even though my coding
uses a random process to select the word. This means I can develop the game without any stress in
playing it. I decided to select an a first. As Figure 9-2 shows, this letter does not appear in the secret word,
so an oval for a head is drawn on the screen, and the block for the letter a disappears.
Search WWH ::




Custom Search