in reply to (tye)Re3: (Golf) Let's go bowling (113)
in thread (Golf) Let's go bowling
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re4: (Golf) Let's go bowling (105)
by tye (Sage) on Aug 15, 2001 at 03:58 UTC | |
Thanks! Those are much shorter ways of splitting and dealing with the 10s. My method of summing is a bit shorter, so that gets me to 105:
The |. on the end of the first regex is required so that the regex matches the entire string. Take a 5-frame game as an example: Those last two substitutions wouldn't happen without the "|." on the end of the regex. The zero-width lookahead assertions, (?=...), aren't part of the "match" and so don't get "consumed" during replacement. If we required that unused bonus frames be recorded as "-", for example, we could get even shorter. For example, this 86-stroke version: - tye (but my friends call me "Tye") | [reply] [d/l] [select] |
by petral (Curate) on Aug 21, 2001 at 23:38 UTC | |
Much simpler ( 84 chars): And here's a little bit more complicated one which passes strict and -w (and yes, I do have other things I'm supposed to be doing with my time): update(5sep): Actually, here's a pretty straightforword one for perl 5.6.0 and higher that passes -w and use strict at 85 chars:
   p | [reply] [d/l] [select] |