in reply to This was a lot of fun
Spoiler!
Download the code or set code wrapping to larger value than default if you want to read this.
Here's the cleaned up code with some explanations.
The code has run-lenght encoded images of the digits.
use warnings; $INITTERM= "\n"; # originally "\ec" $r= ' _/\|'; # The format of the rle data in @m is like this: # One digit for count, one digit for the character: 1=space 2=_ 3=/ 4= +\ 5=| # I've inserted spaces for clarity. $m[0]= '52 112221 113211 113211 51 1142 1142 52 113211 + 1142'; # _____ __ ___ ___ ____ ____ _____ ___ + ____ $m[1]= '153115 211521 133114 133114 153115 1341 1341 4113 153115 + 133115'; # | | | / \ / \ | | / / / | | + / | $m[2]= '153115 211521 311311 311213 153215 1542 1542 311311 153215 + 143215'; # | | | / _/ |___| |____ |____ / |___| + \___| $m[3]= '153115 211521 211321 4114 4115 4115 153115 211321 153115 + 4115'; # | | | / \ | | | | / | | + | $m[4]= '153215 221522 111332 143213 4115 4213 143213 111331 153215 + 4115'; # |___| __|__ /___ \___/ | ____/ \___/ / |___| + | $s= 5; for $k (0..$s-1) { # decode the rle data to plain strings while ($m[$k]=~ /(\S)(\S)/g) { $t[$k].= substr($r, $2-1, 1) x $1; } } # @t (orig. @~) now contains the decoded characters, each element is o +ne line: # _____ __ ___ ___ ____ _________ ___ ____ # | | | / \/ \| |/ / /| |/ | # | | | / _/|___||____|____ / |___|\___| # | | | / \ | || | / | | | # |___|__|__ /___\___/ |____/\___/ / |___| | do { localtime=~ /.*(\d)(\d):(\d)(\d):(\d)(\d).*/; for $i (0..4) { # for each line if ($i==0) # before 1st line, print top of frame { print $INITTERM, "=" x 45, "\n" } print "| "; # print the first digit print substr ($t[$i], $1*5, 5), " ", substr ($t[$i], $ +2*5, 5); # the first colon print+(($i==2) ? "o " : " "), (($i==3) ? "o " : " ") +; # the second digit print substr ($t[$i], $3*5, 5), " ", substr ($t[$i], $ +4*5, 5); # the second colon print+(($i==2) ? "o " : " "), (($i==3) ? "o " : " ") +; # the third digit print substr ($t[$i], $5*5, 5), " ", substr ($t[$i], $ +6*5, 5); print " |\n"; if ($i==4) # and the bottom frame after the 5th line { print "| ", " " x 41, " |\n", "=" x 45, "\n" +; } } } while(sleep(1.5)); __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: This was a lot of fun
by ninja-joe (Monk) on May 09, 2004 at 05:20 UTC |