next up previous contents index
Next: Pick a word Up: Hangman Previous: Excercise   Contents   Index

Putting the pieces together

Each of the parts of the flowchart will be a part of our game - hangman.pl.

Flowchart Subroutine Section Global Variables
Pick a word pick_a_word() Sec. 7.4 $choice
Initialize word_so_far() Sec. 7.5 @letters, $number_of_letters
      $bad_guesses, $good_guesses
      @word_so_far, @alphabet
Is the game over? while (not $game_over) {...} Sec. 7.6 $game_over
Draw Gallows gallows($bad_guesses) Sec. 7.1 $bad_guesses
Draw Word/Spaces print @word_so_far Sec. 7.6 @word_so_far
Draw Alphabet print @alphabet Sec. 7.6 @alphabet
Player Guesses a letter erase_guess() Sec. 7.8 $guess
Is the letter in the word? fill_in_space() Sec. 7.10 $match, $good_guesses
Write the letter in the spaces fill_in_space() Sec. 7.10 @word_so_far
Add a Body Part add_part() Sec. 7.9 $bad_guesses


next up previous contents index
Next: Pick a word Up: Hangman Previous: Excercise   Contents   Index
Tom Hunt 2002-06-09