Looks from the script that it expects a second argument on the
command-line, which is the number of incorrect guesses allowed.
i.e.
> hangman.pl /usr/dict/words 5
______
e
_____e
b
_____e
r
_____e
t
_____e
l
____le
o
____le
n
icicle
DEATH!
- Brian
Jim Martinez wrote:
On May 28 driordan-Wuw85uim5zDR7s880joybQ@xxxxxxxxxxxxxxxx wrote:
#!/local/bin/perl -ln
$c=shift if @ARGV;
push @w,$_ if /^[a-z]{2,}$/}{%g=map{$_=>0}@w=split //,$w[int(rand(@w))];
print map '_',@w;
while(chomp($_=<STDIN>)){
!/^[a-z]$/||$u{$_}?next:$u{$_}++;
defined $g{$_}?$g{$_}++:$c--;
if(eval join '*',values %g or !$c){print join
'',@w,"\n",!$c?"DEATH!":"LIFE!" and last}
print join '',map{$g{$_}?$_:'_'}@w}
hi tor,
my 2nd time playing hangman with your script resulted in this:
:!perl tor_fuglerud.pl /usr/share/dict/words
________
r
playgoer
DEATH!
Same here:
jjm:~$ perl hangman.pl /usr/share/dict/words
_____
e
caper
DEATH!
peace out,
zenitram
also, i wasn't counting to be sure, but i think that i was allowed to
many guesses in my first go around.
peace,
doug
--
- Brian Small
Credence Systems
503-466-7257
|