There's more than one way to do things | |
PerlMonks |
Re: (Golf) Let's go bowlingby dragonchild (Archbishop) |
on Aug 08, 2001 at 21:51 UTC ( [id://103133]=note: print w/replies, xml ) | Need Help?? |
Coming in at a whopping 223(!) characters, a first attempt:
There has to be a better way... I thought about switching the if-elsif-else to BLOCK,next if(EXPR);, but I couldn't figure a way to get rid of the splice in the elsif block. *shrugs* Update: for(0..$#_){if($_[$_]=~/X/){$t+=10+($_[$_+1]=~/X/?10:$_[$_+1])+($_[$_+2]=~/X/?10:($_[$_+2]=~/\//?10-$_[$_+1]:$_[$_+2]));last if!defined$_[$_+3]}if($_[$_+1]=~/\//){$t+=10+($_[$_+2]=~/X/?10:$_[$_+2]);splice@_,$_+1,1;last if!defined$_[$_+2]}else{$t+=$_[$_]}}$t That fixes the perfect score problem. Comes in at 242. Update2: With some ideas from chipmunk, I'm down to 208. (I didn't want to steal his concept, but improve my own. *grins*)
------ Vote paco for President!
In Section
Meditations
|
|