|Think about Loose Coupling|
(Golf) LED Signby tadman (Prior)
|on Jun 08, 2001 at 04:22 UTC||Need Help??|
Since my former attempt at proposing a Golf was a dismal failure, for a refereshing change, how about something that isn't NP-Complete? This particular function, as with any Perl Golf, should allow for suitable creative expression. TMTOWTDI as always.
Create a function which when given a numeric string, returns a multi-line string which is the equivalent 7-segment display output, as one might find on a cash register or digital watch. No external modules should be used. No requirement for compatibility with 'strict' or '-w', but the function must operate properly if called more than one time from within the same program.
An example is: print f("19.2");
Which would display:
Any combination of the characters 0-9, '-', or '.' are valid. Any other characters are ignored. 7 lines of text are always returned by the function, though these lines may be blank if no input was provided that was valid.
For reference, here is the complete character set, a 5x7 bitmap, with a ruler provided for reference purposes only:
My first take, a straight up approach, which is 272 characters without line breaks required here for readability.
As you can see, there is substantial room for improvement.