in reply to (Golf) Hangman
However, a good golf would be something that can be written into a function. So, maybe if you changed it so that the result of hangman'ing is return as a 1 or 0 and all the strings are either handled by the caller or passed in. In that spirit, I give you 134 :
sub h { @w=pop=~/./g;for$a(1..pop){print$_[0],$/;$_=<>;chop;$l{$_}++;@l=map{$l +{$_}?$_:'_'}@w;print@l,$/;return 1if!grep{!$l{$_}}@w} } if (h('guess', 7, 'foobar')) { print "Congratz!\n"; } else { print "Boo!\n"; }
------
/me wants to be the brightest bulb in the chandelier!
Vote paco for President!
|
|---|