logo       

Re: [SPOILER] Perl Quiz-of-the-Week #17: msg#00101

Subject: Re: [SPOILER] Perl Quiz-of-the-Week #17
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



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe