[kw-pm] topics

Robert P. J. Day rpjday at mindspring.com
Fri Jan 3 06:53:49 CST 2003


  currently, i was thinking about adding an exercise to my current
perl course to program "hangman".  by the time i wanted to give
that program as an assignment, the students will have already
learned

1) file I/O, including reading /usr/dict/words
2) picking a random value from a range, including picking a random
   word from a file (see where this is going? :-)
3) s///
4) *possibly* tr///, if that's necessary

  i'd like to ask the students to pull all this together and write
a program that 

a) selects a random word from /usr/dict/words
b) prints the appropriate ...........  string
c) starts accepting guesses and fills in those letters until  
   the word is complete or 7 guesses have been made

  sure, it's not hard, but all the examples i've seen on the net
involve calling subroutines or modules, which i haven't covered 
yet.  or they get unnecessarily and overly complicated when there's
no need for that.

  anyone have a nice, *simple*, straightforward hangman game?  i've
written one myself, but i'm curious to see what real experts can
come up with.  remember, this is meant to be doable by new perl
programmers.

rday




More information about the kw-pm mailing list