Perl, (削除) 592 (削除ここまで) (削除) 579 (削除ここまで) (削除) 540 (削除ここまで) 522(削除) 522 (削除ここまで) 510 bytes
Under a sector!
($L,$C,$b)=unpack"W/aW/aB*",q!12346677889999 _|/\)('
'<,<`>>.` PP ̈
̈@T @ðäð ̃SÀ§€fÌU`à ̈Àäð'€GÆf`3@ôäð ̃SÀ§€fÌU`à ̈Àäð'€GÖf`3 X1⁄2`fÍ5 s Î}1⁄2`gÛÖ·Î|1⁄2`gËÖ— $¡))ñTM ̃À8Sø¡`Õ<?'€pòõTM ̃À8Sô y_¬BÁax~O åýgáã?'ÃÏŒÖ`3àÔýåËþÏÃÆ~O‡ŸY¬Àf 9Ð^°`zÀÏ·¬œ>Þ°8o@WíkgþoÖ·ÃÊ ̧°aÀj®s
1⁄2`À*õŸ/X8|1⁄2`p>^€< ̄åkgúoÖ·ÓÊ ̧°aÀj® ka ̧•p ×ばつ ðô!;@c=map{$i<<=$_-$P if$_>$P;$P=$_;sprintf"%0$if$_>$P;$P=$_;sprintf"%${l}b",$i++}$L=~/./g;while($b){$b=~s/^$c[$_]// and$g.=($C=~/./sg)[$_]for 0..$#c}$_=pop;s/-am/;/;s/-pm/<:/;s;y/apm-/:;</;for$ad;for$a(0..5){for$i(/./g)map{$o.=substr((split$/,$g)[$a],($x=-48+ord$i48+ord)*12,('6356766766099'=~/./g)[$x]+3)}$o/./g;$o.=$/}print$o
($L,$C,$b) = unpack "W/aW/aB*", # grabextract code lengths, chars, and bitstream
q!12346677889999 _|/\)('
'<,<`>>.` PP ̈
̈@T @ðäð ̃SÀ§€fÌU`à ̈Àäð'€GÆf`3@ôäð ̃SÀ§€fÌU`à ̈Àäð'€GÖf`3 X1⁄2`fÍ5 s Î}1⁄2`gÛÖ·Î|1⁄2`gËÖ— $¡))ñTM ̃À8Sø¡`Õ<?'€pòõTM ̃À8Sô y_¬BÁax~O åýgáã?'ÃÏŒÖ`3àÔýåËþÏÃÆ~O‡ŸY¬Àf 9Ð^°`zÀÏ·¬œ>Þ°8o@WíkgþoÖ·ÃÊ ̧°aÀj®s
1⁄2`À*õŸ/X8|1⁄2`p>^€< ̄åkgúoÖ·ÓÊ ̧°aÀj® ka ̧•p ×ばつ ðô!;
@c=map@c {= map { # reconstruct huffman prefix codes
$i <<= $_-$P if $_ > $P; # increase code size
$P = $_; # keep track of previous code
sprintf "%0$"%${l}b", $i++ # append code as bitstring
}
$L=~/./g; # canonical huffman prefix lengths
while ( $b ) { # decompress font
$b =~ s/^$c[$_]// # match and strip prefix code
and $g .= ($C=~/./sg)[$_] # append char for prefix code
for 0..$#c # iterate prefix codes in order
} # luckily we can omit checking trailing bytes
$_ = pop; # get cmdline arg "12-34-am"
s/-am/;:/; # ord(';'':')-ord('0')=11=10
sy/apm-pm/<;</; d; # ord('<')'a'-ord> chr('0'11)=12
s/-/:/; , 'p' #-> ordchr(':'12), strip -ord('0')=10
,m
for $a (0..5) { # iterate 6 output lines
formap $i{ (/./g) { # iterate each char in input
$o .= substr(
( split $/, $g )[$a], # grab line $a
( $x=-48+ord$i48+ord ) * 12, # $x=glyph index, 12=glyph width
('6356766766099'=~/./g)[$x]+3 # glyph display width
)
} /./g;
$o .= $/ # append newline
}
print $o # output
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed. So here's the golfed version, gzipped and then base-64 encoded. Copy it, and paste it into base64 -d | gunzip > 522510.pl:
H4sIAA4lz1YAA9NQ8dFRcdZRSdK0Lc0rSEzOVgrXTwQiJy0lnUJFPkMjYxMzM3NzCwtLIOBTiK/R
j9Hk0lDXsUmw0xNlCGAMYFrBpMC1gtFBNIRpAasD44cnH/hmMAcfkFrekHaGLTRB5oHUigNPPrCrKCRMLCRDLCRiKT11bnBhY2siVy9hVy9hQioiLHEhDjEyMzQ2Njc3ODg5OTk5DiBffC9cKSgKJzws
N7gfS0swZuCPYNqbkHaW2ZSheAHjObbavQnpt6/xb1/AqrJQU/PjzBk8B9gtmIN/sC1MuGrDbK/ePi5gFQBQAVACqAIgCqgBQBVUAqAFQAH05PAOmANTwBqngGbMBlVgHOAaqMDk8AcngEfWZmAzAA9Y
wFfA/6meoTJ+DQfD07/pDx/bq/cfPt9zDWiS5QXWuA1sCaJVB85vX8M8h9nu3gZ2CAr1gZs0DNQBzoAHOBny9YGfL1g+XoAUkoSkp9ZmYDMAHOANT9A1Cwap4Bn5PABzgH9T9AeV/l8B7nwt2uzGBAB
0/y/turb98KkdbBvYVh3IWseQzbhqB7Pw8Z+Tx+Hn1mswGYAc6AKvWAMwCr1gZ8vWAc4Bny9YA5wPl6APK/vUAr4djE9jGK8zMDAwrv2gaO2QbJubWFCtkmljY6sSr6sSlrWtn+rrWt9PKuAawBqrA
oJCZphJvpxJgrRIAFLAuLijKzCtJU1I1UKnOqU1S0lHJ1NauVfGxrdPX00+3Ls/IzEnVAAZdtUqSaq4AawGquAeVcA64AeVcAdcAAAABrfQhO0BjPW1hcHskaTw8PSRfLSRQIGlmJF8+JFA7JFA9JF87
bV2xfpxKcrRKfKy+vkJiXopKup6thoozWGlxuiZIIi2/SMFAT09FOblWJd62IL/AulhfNzFX31ofc3ByaW50ZiIlJHtsfWIiLCRpKyt9JEw9fi8uL2c7d2hpbGUoJGIpeyRiPX5zL14kY1skX10vLyBh
xCjI1bcBM/St9K2BSlUSNYCKTTWrQexMDZCNQIvy9WyLS5OKS4o0NIoLcjJLVPR1VECmJ8bqaKhUbmQkZy49KCRDPX4vLi9zZylbJF9dZm9yIDAuLiQjY30kXz1wb3A7cy8tLzovO3kvYXBtLS87PC9k
2OqaWGjnF6WoZGpqGRrpaKibGZuamZuBkIGlpTrE3UDVFbHaxpq1IMNU9GvBnlTJBwAomvwhCgIAO2ZvciRhKDAuLjUpe21hcHskby49c3Vic3RyKChzcGxpdCQvLCRnKVskYV0sKCR4PS00OCtvcmQp
AA==KjEyLCgnNjM1Njc2Njc2NjA5OSc9fi8uL2cpWyR4XSszKX0vLi9nOyRvLj0kL31wcmludCRv
Perl, (削除) 592 (削除ここまで) (削除) 579 (削除ここまで) (削除) 540 (削除ここまで) 522 bytes
($L,$C,$b)=unpack"W/aW/aB*",q!12346677889999 _|/\)(',<`>. PP ̈
̈@T @ðäð ̃SÀ§€fÌU`à ̈Àäð'€GÆf`3 X1⁄2`fÍ5 s Î}1⁄2`gÛÖ· $¡))ñTM ̃À8Sø¡`Õ<?'€pò y_¬ åýgáã?'ÃÏŒÖ`3 9Ð^°`zÀÏ·¬œ>Þ°8o@WíkgþoÖ·ÃÊ ̧°aÀj® ka ̧•p ×ばつ ð!;@c=map{$i<<=$_-$P if$_>$P;$P=$_;sprintf"%0${l}b",$i++}$L=~/./g;while($b){$b=~s/^$c[$_]// and$g.=($C=~/./sg)[$_]for 0..$#c}$_=pop;s/-am/;/;s/-pm/</;s/-/:/;for$a(0..5){for$i(/./g){$o.=substr((split$/,$g)[$a],($x=-48+ord$i)*12,('6356766766099'=~/./g)[$x]+3)}$o.=$/}print$o
($L,$C,$b) = unpack "W/aW/aB*", # grab code lengths, chars, bitstream
q!12346677889999 _|/\)(',<`>. PP ̈
̈@T @ðäð ̃SÀ§€fÌU`à ̈Àäð'€GÆf`3 X1⁄2`fÍ5 s Î}1⁄2`gÛÖ· $¡))ñTM ̃À8Sø¡`Õ<?'€pò y_¬ åýgáã?'ÃÏŒÖ`3 9Ð^°`zÀÏ·¬œ>Þ°8o@WíkgþoÖ·ÃÊ ̧°aÀj® ka ̧•p ×ばつ ð!;
@c=map { # reconstruct huffman prefix codes
$i <<= $_-$P if $_ > $P; # increase code size
$P = $_; # keep track of previous code
sprintf "%0${l}b", $i++ # append code as bitstring
}
$L=~/./g; # canonical huffman prefix lengths
while ( $b ) { # decompress font
$b =~ s/^$c[$_]// # match and strip prefix code
and $g .= ($C=~/./sg)[$_] # append char
for 0..$#c # iterate prefix codes in order
} # luckily we can omit checking trailing bytes
$_ = pop; # get cmdline arg "12-34-am"
s/-am/;/; # ord(';')-ord('0')=11
s/-pm/</; # ord('<')-ord('0')=12
s/-/:/; # ord(':')-ord('0')=10
for $a (0..5) { # iterate 6 output lines
for $i (/./g) { # iterate each char in input
$o .= substr(
( split $/, $g )[$a], # grab line $a
( $x=-48+ord$i ) * 12, # $x=glyph index, 12=glyph width
('6356766766099'=~/./g)[$x]+3 # glyph display width
)
}
$o .= $/ # append newline
}
print $o # output
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed. So here's the golfed version, gzipped and then base-64 encoded. Copy it, and paste it into base64 -d | gunzip > 522.pl:
H4sIAA4lz1YAA9NQ8dFRcdZRSdK0Lc0rSEzOVgrXTwQiJy0lnUJFPkMjYxMzM3NzCwtLIOBTiK/R
j9Hk0lDXsUmw0xNlCGAMYFrBpMC1gtFBNIRpAasD44cnH/hmMAcfkFrekHaGLTRB5oHUigNPPrCr
N7gfS0swZuCPYNqbkHaW2ZSheAHjObbavQnpt6/xb1/AqrJQU/PjzBk8B9gtmIN/sC1MuGrDbK/e
wFfA/6meoTJ+DQfD07/pDx/bq/cfPt9zDWiS5QXWuA1sCaJVB85vX8M8h9nu3gZ2C/l8B7nwt2uz
0//turb98KkdbBvYVh3IWseQzbhqB/vUAr4djE9jGK8zMDAwrv2gaO2QbJubWFCtkmljY6sSr6sS
oJCZphJvpxJgrRIAFLAuLijKzCtJU1I1UKnOqU1S0lHJ1NauVfGxrdPX00+3Ls/IzEnVAAZdtUqS
bV2xfpxKcrRKfKy+vkJiXopKup6thoozWGlxuiZIIi2/SMFAT09FOblWJd62IL/AulhfNzFX31of
xCjI1bcBM/St9K2BSlUSNYCKTTWrQexMDZCNQIvy9WyLS5OKS4o0NIoLcjJLVPR1VECmJ8bqaKhU
2OqaWGjnF6WoZGpqGRrpaKibGZuamZuBkIGlpTrE3UDVFbHaxpq1IMNU9GvBnlTJBwAomvwhCgIA
AA==
Perl, (削除) 592 (削除ここまで) (削除) 579 (削除ここまで) (削除) 540 (削除ここまで) (削除) 522 (削除ここまで) 510 bytes
Under a sector!
($L,$C,$b)=unpack"W/aW/aB*",q!12346677889999 _|/\)(
'<,>.` PP ̈
̈@T @ôäð ̃SÀ§€fÌU`à ̈Àäð'€GÖf`3 X1⁄2`fÍ5 s Î|1⁄2`gËÖ— $¡))õTM ̃À8Sô BÁax~O àÔýåËþÏÃÆ~O‡ŸY¬Àf s
1⁄2`À*õŸ/X8|1⁄2`p>^€< ̄åkgúoÖ·ÓÊ ̧°aÀj® ka ̧•p ×ばつ ô!;@c=map{$i<<=$_-$P if$_>$P;$P=$_;sprintf"%${l}b",$i++}$L=~/./g;while($b){$b=~s/^$c[$_]// and$g.=($C=~/./sg)[$_]for 0..$#c}$_=pop;s/-/:/;y/apm-/;</d;for$a(0..5){map{$o.=substr((split$/,$g)[$a],($x=-48+ord)*12,('6356766766099'=~/./g)[$x]+3)}/./g;$o.=$/}print$o
($L,$C,$b) = unpack "W/aW/aB*", # extract code lengths, chars, and bitstream
q!12346677889999 _|/\)(
'<,>.` PP ̈
̈@T @ôäð ̃SÀ§€fÌU`à ̈Àäð'€GÖf`3 X1⁄2`fÍ5 s Î|1⁄2`gËÖ— $¡))õTM ̃À8Sô BÁax~O àÔýåËþÏÃÆ~O‡ŸY¬Àf s
1⁄2`À*õŸ/X8|1⁄2`p>^€< ̄åkgúoÖ·ÓÊ ̧°aÀj® ka ̧•p ×ばつ ô!;
@c = map { # reconstruct huffman prefix codes
$i <<= $_-$P if $_ > $P; # increase code size
$P = $_; # keep track of previous code
sprintf "%${l}b", $i++ # append code as bitstring
}
$L=~/./g; # canonical huffman prefix lengths
while ( $b ) { # decompress font
$b =~ s/^$c[$_]// # match and strip prefix code
and $g .= ($C=~/./sg)[$_] # append char for prefix code
for 0..$#c # iterate prefix codes in order
} # luckily we can omit checking trailing bytes
$_ = pop; # get cmdline arg "12-34-am"
s/-/:/; # ord(':')-ord('0')=10
y/apm-/;</d; # 'a'-> chr(11), 'p' -> chr(12), strip -,m
for $a (0..5) { # iterate 6 output lines
map { # iterate each char in input
$o .= substr(
( split $/, $g )[$a], # grab line $a
( $x=-48+ord ) * 12, # $x=glyph index, 12=glyph width
('6356766766099'=~/./g)[$x]+3 # glyph display width
)
} /./g;
$o .= $/ # append newline
}
print $o # output
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed. So here's the golfed version, base-64 encoded. Copy it, and paste it into base64 -d > 510.pl:
KCRMLCRDLCRiKT11bnBhY2siVy9hVy9hQioiLHEhDjEyMzQ2Njc3ODg5OTk5DiBffC9cKSgKJzws
Pi5gFQBQAVACqAIgCqgBQBVUAqAFQAH05PAOmANTwBqngGbMBlVgHOAaqMDk8AcngEfWZmAzAA9Y
Ar1gZs0DNQBzoAHOBny9YGfL1g+XoAUkoSkp9ZmYDMAHOANT9A1Cwap4Bn5PABzgH9T9AeV/GBAB
y/7Pw8Z+Tx+Hn1mswGYAc6AKvWAMwCr1gZ8vWAc4Bny9YA5wPl6APK/lrWtn+rrWt9PKuAawBqrA
aq4AawGquAeVcA64AeVcAdcAAAABrfQhO0BjPW1hcHskaTw8PSRfLSRQIGlmJF8+JFA7JFA9JF87
c3ByaW50ZiIlJHtsfWIiLCRpKyt9JEw9fi8uL2c7d2hpbGUoJGIpeyRiPX5zL14kY1skX10vLyBh
bmQkZy49KCRDPX4vLi9zZylbJF9dZm9yIDAuLiQjY30kXz1wb3A7cy8tLzovO3kvYXBtLS87PC9k
O2ZvciRhKDAuLjUpe21hcHskby49c3Vic3RyKChzcGxpdCQvLCRnKVskYV0sKCR4PS00OCtvcmQp
KjEyLCgnNjM1Njc2Njc2NjA5OSc9fi8uL2cpWyR4XSszKX0vLi9nOyRvLj0kL31wcmludCRv
Perl, (削除) 592 (削除ここまで) (削除) 579 (削除ここまで) 540(削除) 540 (削除ここまで) 522 bytes
$b=join'',unpack'(B8$L,$C,$b)*'=unpack"W/aW/aB*",q{!12346677889999 _|/\)
(',<`>. PP ̈
̈@T @ôäð ̃SÀ§€fÌU`à ̈Àäð'€GÖf`3@ðäð ̃SÀ§€fÌU`à ̈Àäð'€GÆf`3 X1⁄2`fÍ5 s Î|1⁄2`gËÖ—Î}1⁄2`gÛÖ· $¡))õTM ̃À8Sø¡`Õ<ñTM ̃À8Sø¡`Õ<?'€pê'€pò y_¬ åþgáãåýgáã?'ÃϬÖ`3'ÃÏŒÖ`3 9Ð^°`zÀÏ—¬œ>^°8/@WíkgþoÖ·ÓÊ ̧°aÀj®9Ð^°`zÀÏ·¬œ>Þ°8o@WíkgþoÖ·ÃÊ ̧°aÀj® ka ̧•p ×ばつ ô};mapð!;@c=map{$i<<=$_-$P if$_>$P;push@c,sprintf"%0$if$_>$P;$P=$_;sprintf"%0${l}b",$i++;$P=$_;$i++}"12346677889999"=~$L=~/./g;while($b){$b=~s/^$c[$_]// and$g.=(q{ _|/\)(
',<>`.}=~$C=~/./sg)[$_]for 0..$#c}$_=pop;s/-am/;/;s/-pm/</;s/-/:/;@w=map{3+$_}'6356766766099'=~/./g;for$a;for$a(0..5){for$i(/./g){$o.=substr((split$/,$g)[$a],($x=ord($i)$x=-4848+ord$i)*12,$w[$x]('6356766766099'=~/./g)[$x]+3)}$o.=$/}print$o
This program expects the time in the 2nd format ("12-34-am") as a commandline argument.
($L,$C,$b) = join'',unpack'(B8)*'unpack "W/aW/aB*", # grab code lengths, chars, #bitstream
split bitstream into bytes
q{!12346677889999 _|/\)
(',<`>. PP ̈
̈@T @ôäð ̃SÀ§€fÌU`à ̈Àäð'€GÖf`3@ðäð ̃SÀ§€fÌU`à ̈Àäð'€GÆf`3 X1⁄2`fÍ5 s Î|1⁄2`gËÖ—Î}1⁄2`gÛÖ· $¡))õTM ̃À8Sø¡`Õ<ñTM ̃À8Sø¡`Õ<?'€pê'€pò y_¬ åþgáãåýgáã?'ÃϬÖ`3'ÃÏŒÖ`3 9Ð^°`zÀÏ—¬œ>^°8/@WíkgþoÖ·ÓÊ ̧°aÀj®9Ð^°`zÀÏ·¬œ>Þ°8o@WíkgþoÖ·ÃÊ ̧°aÀj® ka ̧•p ×ばつ ô}ð!;
map@c=map { # reconstruct huffman prefix codes
$i <<= $_-$P if $_ > $P; # increase code size
push$P @c,= sprintf$_; "%0${l}b", $i++; # append code as bitstring
$P = $_; # keep track of previous code
sprintf "%0${l}b", $i++ # keep track of previous # append code as bitstring
}
"12346677889999"=~$L=~/./g; # canonical huffman prefix lengths
while ( $b ) { # decompress font
$b =~ s/^$c[$_]// # match prefix code and replacestrip withprefix charcode
and $g .= (q{ _|/\)(
',<>`.}=~$C=~/./sg)[$_] # getappend char belonging to prefix code
for 0..$#c # iterate prefix codes in order
} # luckily we can omit checking trailing bytes
$_ = pop; # get cmdline arg "12-34-am"
s/-am/;/; # ord(';')-ord('0')=11
s/-pm/</; # ord('<')-ord('0')=12
s/-/:/; # ord(':')-ord('0')=10
@w=map{3+$_}'6356766766099'=~/./g; # character widths
for $a (0..5) { # iterate 6 output lines
for $i (/./g) { # iterate each char in input
$o .= substr(
( split $/, $g )[$a], # grab line $a
( $x=ord($i)$x=-4848+ord$i ) *12* 12, # $x=glyph index, 12=glyph width
$w[$x] ('6356766766099'=~/./g)[$x]+3 # glyph display width
)
}
$o .= $/ # append newline
}
print $o # output
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed. So here's the golfed version, gzipped and then base-64 encoded. Copy it, and paste it into base64 -d | gunzip > 540522.pl:
H4sICBELzlYAAzU0MC5wbAAtUc1r03AYThqaynDtqZchGuorSWyaX7euX6bpihevhSkKW5uknc2yH4sIAA4lz1YAA9NQ8dFRcdZRSdK0Lc0rSEzOVgrXTwQiJy0lnUJFPkMjYxMzM3NzCwtLIOBTiK/R
fiRrWjrNMvsfeJJN8NCdLKOT3izCoODNrwlivSpuF0HYYYKnYVJ8eA8PL+j9Hk0lDXsUmw0xNlCGAMYFrBpMC1gtFBNIRpAasD44cnH/zvF9QEjd0rUHTXLthhmMAcfkFrekHaGLTRB5oHUigNPPrCr
KOUqzdxOsTdpbtMKYnk87+l7qNmZPp4L3vX0vDn8N7gfS0swZuCPYNqbkHaW2ZSheAHjObbavQnpt6/OTMv0csj+dedisfyHvyle9zxb1/fHJmYAqrJQU/u3plU
5BgWeOA5kisfiThm9vBP5PaRrL6fBHZ7Xthn2TPjzBk8B9gtmIN/P9y6PfSli+S+5L3sC1MuGrDbK/NEEt0128Efj3BHkmDS9jp
hfrj5xL99O3xYOI4pT97i0NSDj4eH+8OiBdEtjj0pa6h3NX7vw+r6sWbyesv70bkkDwYb7zCqvjBe
yPfM8IwFfA/w01X8G4Zh+OG5LdQVwwItkxFBikCe0iogZSEvGG1zPVfmTKOpNVqV0I0oWDW7FOJAC4cF6meoTJ+DQfD07/pDx/bq/cfPt9zDWiS5QXWuA1sCaJVB85vX8M8h9nu3gZ2C/l8B7nwt2uz
yDvVgh2aX4gtJhLJZCqVdhASdxCPVKGzrtUeMlBiLSiJOyYqQnkFpAJClNJYA5UXmU2LkrbRKsvM0//turb98KkdbBvYVh3IWseQzbhqB/vUAr4djE9jGK8zMDAwrv2gaO2QbJubWFCtkmljY6sSr6sS
zlAOaC6TlXl7KjdV1i2u6E0qyvNwvWyDJBq6IZgootSRgFxi1FFmStAtJOQ6ortDLAySTSdi8UQyoJCZphJvpxJgrRIAFLAuLijKzCtJU1I1UKnOqU1S0lHJ1NauVfGxrdPX00+3Ls/IzEnVAAZdtUqS
4UY0nabbV2xfpxKcrRKfKy+vkJiXopKup6thoozWGlxuiZIIi2/D+SYgcI4dnHWcrnGuGlnPJ0XzXbJbDUZxjRqWgsQB25SMFAT09FOblWJd62IL/pcAxsCXqzTUGNDay6Dx7foGDAulhfNzFX31of
zgpsFVjblQGyp5cBxCjI1bcBM/R+yKgArHAIAAA==St9K2BSlUSNYCKTTWrQexMDZCNQIvy9WyLS5OKS4o0NIoLcjJLVPR1VECmJ8bqaKhU
2OqaWGjnF6WoZGpqGRrpaKibGZuamZuBkIGlpTrE3UDVFbHaxpq1IMNU9GvBnlTJBwAomvwhCgIA
AA==
This font is 592 bytes.
The previous approach used a few variations on RLE compression to reduce this to 353 bytes, at the cost of 78 bytes decompression code.
The Huffman coding compresses the font to 191221 bytes at the cost of 182154 bytes for the decompression algorithm.
Perl, (削除) 592 (削除ここまで) (削除) 579 (削除ここまで) 540 bytes
$b=join'',unpack'(B8)*',q{ PP ̈
̈@T @ôäð ̃SÀ§€fÌU`à ̈Àäð'€GÖf`3 X1⁄2`fÍ5 s Î|1⁄2`gËÖ— $¡))õTM ̃À8Sø¡`Õ<?'€pê y_¬ åþgáã?'ÃϬÖ`3 9Ð^°`zÀÏ—¬œ>^°8/@WíkgþoÖ·ÓÊ ̧°aÀj® ka ̧•p ×ばつ ô};map{$i<<=$_-$P if$_>$P;push@c,sprintf"%0${l}b",$i++;$P=$_;}"12346677889999"=~/./g;while($b){$b=~s/^$c[$_]// and$g.=(q{ _|/\)(
',<>`.}=~/./sg)[$_]for 0..$#c}$_=pop;s/-am/;/;s/-pm/</;s/-/:/;@w=map{3+$_}'6356766766099'=~/./g;for$a(0..5){for$i(/./g){$o.=substr((split$/,$g)[$a],($x=ord($i)-48)*12,$w[$x])}$o.=$/}print$o
This program expects the time in the 2nd format "12-34-am" as a commandline argument.
$b = join'',unpack'(B8)*', # split bitstream into bytes
q{ PP ̈
̈@T @ôäð ̃SÀ§€fÌU`à ̈Àäð'€GÖf`3 X1⁄2`fÍ5 s Î|1⁄2`gËÖ— $¡))õTM ̃À8Sø¡`Õ<?'€pê y_¬ åþgáã?'ÃϬÖ`3 9Ð^°`zÀÏ—¬œ>^°8/@WíkgþoÖ·ÓÊ ̧°aÀj® ka ̧•p ×ばつ ô};
map { # reconstruct huffman prefix codes
$i <<= $_-$P if $_ > $P; # increase code size
push @c, sprintf "%0${l}b", $i++; # append code as bitstring
$P = $_; # keep track of previous code
}
"12346677889999"=~/./g; # canonical huffman prefix lengths
while ( $b ) { # decompress font
$b =~ s/^$c[$_]// # match prefix code and replace with char
and $g .= (q{ _|/\)(
',<>`.}=~/./sg)[$_] # get char belonging to prefix code
for 0..$#c # iterate prefix codes in order
} # luckily we can omit checking trailing bytes
$_ = pop; # get cmdline arg "12-34-am"
s/-am/;/; # ord(';')-ord('0')=11
s/-pm/</; # ord('<')-ord('0')=12
s/-/:/; # ord(':')-ord('0')=10
@w=map{3+$_}'6356766766099'=~/./g; # character widths
for $a (0..5) { # iterate 6 output lines
for $i (/./g) { # iterate each char in input
$o .= substr(
( split $/, $g )[$a], # grab line $a
( $x=ord($i)-48 ) *12, # $x=glyph index, 12=glyph width
$w[$x] # glyph display width
)
}
$o .= $/ # append newline
}
print $o # output
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed. So here's the golfed version, gzipped and then base-64 encoded. Copy it, and paste it into base64 -d | gunzip > 540.pl:
H4sICBELzlYAAzU0MC5wbAAtUc1r03AYThqaynDtqZchGuorSWyaX7euX6bpihevhSkKW5uknc2y
fiRrWjrNMvsfeJJN8NCdLKOT3izCoODNrwlivSpuF0HYYYKnYVJ8eA8PL+/zvF9QEjd0rUHTXLth
KOUqzdxOsTdpbtMKYnk87+l7qNmZPp4L3vX0vDn8/OTMv0csj+dedisfyHvyle9z/fHJmY/u3plU
5BgWeOA5kisfiThm9vBP5PaRrL6fBHZ7Xthn2T/P9y6PfSli+S+5L3/NEEt0128Efj3BHkmDS9jp
hfrj5xL99O3xYOI4pT97i0NSDj4eH+8OiBdEtjj0pa6h3NX7vw+r6sWbyesv70bkkDwYb7zCqvjB
yPfM8I/w01X8G4Zh+OG5LdQVwwItkxFBikCe0iogZSEvGG1zPVfmTKOpNVqV0I0oWDW7FOJAC4cF
yDvVgh2aX4gtJhLJZCqVdhASdxCPVKGzrtUeMlBiLSiJOyYqQnkFpAJClNJYA5UXmU2LkrbRKsvM
zlAOaC6TlXl7KjdV1i2u6E0qyvNwvWyDJBq6IZgootSRgFxi1FFmStAtJOQ6ortDLAySTSdi8UQy
4UY0nab/D+SYgcI4dnHWcrnGuGlnPJ0XzXbJbDUZxjRqWgsQB25/pcAxsCXqzTUGNDay6Dx7foGD
zgpsFVjblQGyp5cB/R+yKgArHAIAAA==
This font is 592 bytes.
The previous approach used a few variations on RLE compression to reduce this to 353 bytes, at the cost of 78 bytes decompression code.
The Huffman coding compresses the font to 191 bytes at the cost of 182 bytes for the decompression algorithm.
Perl, (削除) 592 (削除ここまで) (削除) 579 (削除ここまで) (削除) 540 (削除ここまで) 522 bytes
($L,$C,$b)=unpack"W/aW/aB*",q!12346677889999 _|/\)
(',<`>. PP ̈
̈@T @ðäð ̃SÀ§€fÌU`à ̈Àäð'€GÆf`3 X1⁄2`fÍ5 s Î}1⁄2`gÛÖ· $¡))ñTM ̃À8Sø¡`Õ<?'€pò y_¬ åýgáã?'ÃÏŒÖ`3 9Ð^°`zÀÏ·¬œ>Þ°8o@WíkgþoÖ·ÃÊ ̧°aÀj® ka ̧•p ×ばつ ð!;@c=map{$i<<=$_-$P if$_>$P;$P=$_;sprintf"%0${l}b",$i++}$L=~/./g;while($b){$b=~s/^$c[$_]// and$g.=($C=~/./sg)[$_]for 0..$#c}$_=pop;s/-am/;/;s/-pm/</;s/-/:/;for$a(0..5){for$i(/./g){$o.=substr((split$/,$g)[$a],($x=-48+ord$i)*12,('6356766766099'=~/./g)[$x]+3)}$o.=$/}print$o
This program expects the time in the 2nd format ("12-34-am") as a commandline argument.
($L,$C,$b) = unpack "W/aW/aB*", # grab code lengths, chars, bitstream
q!12346677889999 _|/\)
(',<`>. PP ̈
̈@T @ðäð ̃SÀ§€fÌU`à ̈Àäð'€GÆf`3 X1⁄2`fÍ5 s Î}1⁄2`gÛÖ· $¡))ñTM ̃À8Sø¡`Õ<?'€pò y_¬ åýgáã?'ÃÏŒÖ`3 9Ð^°`zÀÏ·¬œ>Þ°8o@WíkgþoÖ·ÃÊ ̧°aÀj® ka ̧•p ×ばつ ð!;
@c=map { # reconstruct huffman prefix codes
$i <<= $_-$P if $_ > $P; # increase code size
$P = $_; # keep track of previous code
sprintf "%0${l}b", $i++ # append code as bitstring
}
$L=~/./g; # canonical huffman prefix lengths
while ( $b ) { # decompress font
$b =~ s/^$c[$_]// # match and strip prefix code
and $g .= ($C=~/./sg)[$_] # append char
for 0..$#c # iterate prefix codes in order
} # luckily we can omit checking trailing bytes
$_ = pop; # get cmdline arg "12-34-am"
s/-am/;/; # ord(';')-ord('0')=11
s/-pm/</; # ord('<')-ord('0')=12
s/-/:/; # ord(':')-ord('0')=10
for $a (0..5) { # iterate 6 output lines
for $i (/./g) { # iterate each char in input
$o .= substr(
( split $/, $g )[$a], # grab line $a
( $x=-48+ord$i ) * 12, # $x=glyph index, 12=glyph width
('6356766766099'=~/./g)[$x]+3 # glyph display width
)
}
$o .= $/ # append newline
}
print $o # output
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed. So here's the golfed version, gzipped and then base-64 encoded. Copy it, and paste it into base64 -d | gunzip > 522.pl:
H4sIAA4lz1YAA9NQ8dFRcdZRSdK0Lc0rSEzOVgrXTwQiJy0lnUJFPkMjYxMzM3NzCwtLIOBTiK/R
j9Hk0lDXsUmw0xNlCGAMYFrBpMC1gtFBNIRpAasD44cnH/hmMAcfkFrekHaGLTRB5oHUigNPPrCr
N7gfS0swZuCPYNqbkHaW2ZSheAHjObbavQnpt6/xb1/AqrJQU/PjzBk8B9gtmIN/sC1MuGrDbK/e
wFfA/6meoTJ+DQfD07/pDx/bq/cfPt9zDWiS5QXWuA1sCaJVB85vX8M8h9nu3gZ2C/l8B7nwt2uz
0//turb98KkdbBvYVh3IWseQzbhqB/vUAr4djE9jGK8zMDAwrv2gaO2QbJubWFCtkmljY6sSr6sS
oJCZphJvpxJgrRIAFLAuLijKzCtJU1I1UKnOqU1S0lHJ1NauVfGxrdPX00+3Ls/IzEnVAAZdtUqS
bV2xfpxKcrRKfKy+vkJiXopKup6thoozWGlxuiZIIi2/SMFAT09FOblWJd62IL/AulhfNzFX31of
xCjI1bcBM/St9K2BSlUSNYCKTTWrQexMDZCNQIvy9WyLS5OKS4o0NIoLcjJLVPR1VECmJ8bqaKhU
2OqaWGjnF6WoZGpqGRrpaKibGZuamZuBkIGlpTrE3UDVFbHaxpq1IMNU9GvBnlTJBwAomvwhCgIA
AA==
This font is 592 bytes.
The previous approach used a few variations on RLE compression to reduce this to 353 bytes, at the cost of 78 bytes decompression code.
The Huffman coding compresses the font to 221 bytes at the cost of 154 bytes for the decompression algorithm.
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed.
For that reason, replace So here's the first statementgolfed version, gzipped and then base-64 encoded. Copy it, and paste it into $bbase64 =-d join.| gunzip > 540.pl with:
use MIME::Base64;
$b = join'',unpack'(B8)*',decode_base64<<EOD;H4sICBELzlYAAzU0MC5wbAAtUc1r03AYThqaynDtqZchGuorSWyaX7euX6bpihevhSkKW5uknc2y
FQBQAVACqAIgCqgBQBVUAqAFQAH05PAOmANTwBqngGbMBlVgHOAaqMDk8AcngEfWZmAzAA9YAr1gfiRrWjrNMvsfeJJN8NCdLKOT3izCoODNrwlivSpuF0HYYYKnYVJ8eA8PL+/zvF9QEjd0rUHTXLth
Zs0DNQBzoAHOBny9YGfL1g+XoAUkoSkp9ZmYDMAHOANT+AahYNU8Az8ngA5wD+pKOUqzdxOsTdpbtMKYnk87+l7qNmZPp4L3vX0vDn8/AHlfrAgA5f5nOTMv0csj+dedisfyHvyle9z/fHJmY/u3plU
4eM5BgWeOA5kisfiThm9vBP5PaRrL6fBHZ7Xthn2T/J4P9y6PfSli+S+5L3/Dz6zWYDMAOdAFXrAGYBV6wM+XrAOcAz5esAc4Hy9AHlftrWtnNEEt0128Efj3BHkmDS9jp
hfrj5xL99O3xYOI4pT97i0NSDj4eH+8OiBdEtjj0pa6h3NX7vw+r6sWbyesv70bkkDwYb7zCqvjB
yPfM8I/rrWt9PKuAawBqrAaq4Aw01X8G4Zh+OG5LdQVwwItkxFBikCe0iogZSEvGG1zPVfmTKOpNVqV0I0oWDW7FOJAC4cF
awGquAeVcA64AeVcAdcAAAABrfQ=yDvVgh2aX4gtJhLJZCqVdhASdxCPVKGzrtUeMlBiLSiJOyYqQnkFpAJClNJYA5UXmU2LkrbRKsvM
EODzlAOaC6TlXl7KjdV1i2u6E0qyvNwvWyDJBq6IZgootSRgFxi1FFmStAtJOQ6ortDLAySTSdi8UQy
4UY0nab/D+SYgcI4dnHWcrnGuGlnPJ0XzXbJbDUZxjRqWgsQB25/pcAxsCXqzTUGNDay6Dx7foGD
zgpsFVjblQGyp5cB/R+yKgArHAIAAA==
Explanation:
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed.
For that reason, replace the first statement $b = join.. with:
use MIME::Base64;
$b = join'',unpack'(B8)*',decode_base64<<EOD;
FQBQAVACqAIgCqgBQBVUAqAFQAH05PAOmANTwBqngGbMBlVgHOAaqMDk8AcngEfWZmAzAA9YAr1g
Zs0DNQBzoAHOBny9YGfL1g+XoAUkoSkp9ZmYDMAHOANT+AahYNU8Az8ngA5wD+p/AHlfrAgA5f5n
4eM/J4/Dz6zWYDMAOdAFXrAGYBV6wM+XrAOcAz5esAc4Hy9AHlftrWtn/rrWt9PKuAawBqrAaq4A
awGquAeVcA64AeVcAdcAAAABrfQ=
EOD
Explanation:
Note that due to character encoding issues, when you paste the above code in a file, the output may be somewhat malformed. So here's the golfed version, gzipped and then base-64 encoded. Copy it, and paste it into base64 -d | gunzip > 540.pl:
H4sICBELzlYAAzU0MC5wbAAtUc1r03AYThqaynDtqZchGuorSWyaX7euX6bpihevhSkKW5uknc2y
fiRrWjrNMvsfeJJN8NCdLKOT3izCoODNrwlivSpuF0HYYYKnYVJ8eA8PL+/zvF9QEjd0rUHTXLth
KOUqzdxOsTdpbtMKYnk87+l7qNmZPp4L3vX0vDn8/OTMv0csj+dedisfyHvyle9z/fHJmY/u3plU
5BgWeOA5kisfiThm9vBP5PaRrL6fBHZ7Xthn2T/P9y6PfSli+S+5L3/NEEt0128Efj3BHkmDS9jp
hfrj5xL99O3xYOI4pT97i0NSDj4eH+8OiBdEtjj0pa6h3NX7vw+r6sWbyesv70bkkDwYb7zCqvjB
yPfM8I/w01X8G4Zh+OG5LdQVwwItkxFBikCe0iogZSEvGG1zPVfmTKOpNVqV0I0oWDW7FOJAC4cF
yDvVgh2aX4gtJhLJZCqVdhASdxCPVKGzrtUeMlBiLSiJOyYqQnkFpAJClNJYA5UXmU2LkrbRKsvM
zlAOaC6TlXl7KjdV1i2u6E0qyvNwvWyDJBq6IZgootSRgFxi1FFmStAtJOQ6ortDLAySTSdi8UQy
4UY0nab/D+SYgcI4dnHWcrnGuGlnPJ0XzXbJbDUZxjRqWgsQB25/pcAxsCXqzTUGNDay6Dx7foGD
zgpsFVjblQGyp5cB/R+yKgArHAIAAA==