--------------030909030706050101080809
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Apologies for a very late entry. I was on the road last week, but I
didn't peek at anybody else's solutions. No golfing here, just
straightforward raster output.
--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoil.com/>
--------------030909030706050101080809
Content-Type: text/plain;
name cd.rb.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename cd.rb.txt"
#!/usr/bin/env ruby -w
require 'getoptlong'
$size
GetoptLong.new(
["-s", GetoptLong::REQUIRED_ARGUMENT]
).each do |opt, val|
case opt
when '-s': $size al.to_i
end
end
$digits RGV[0] || ''
# 0-
# 1| 2|
# 3-
# 4| 5|
# 6-
SEGMENTS
# 0 1 2 3 4 5 6
[ '-', '|', '|', ' ', '|', '|', '-' ], # 0
[ ' ', ' ', '|', ' ', ' ', '|', ' ' ], # 1
[ '-', ' ', '|', '-', '|', ' ', '-' ], # 2
[ '-', ' ', '|', '-', ' ', '|', '-' ], # 3
[ ' ', '|', '|', '-', ' ', '|', ' ' ], # 4
[ '-', '|', ' ', '-', ' ', '|', '-' ], # 5
[ '-', '|', ' ', '-', '|', '|', '-' ], # 6
[ '-', ' ', '|', ' ', ' ', '|', ' ' ], # 7
[ '-', '|', '|', '-', '|', '|', '-' ], # 8
[ '-', '|', '|', '-', ' ', '|', '-' ], # 9
]
def horz(w)
$digits.each_byte do |d|
mark EGMENTS[d - ?0][w * 3]
print ' ' + (mark * $size) + ' ' + (' ' * $size)
end
print "\n"
end
def vert(w)
$size.times do
$digits.each_byte do |d|
mark1 EGMENTS[d - ?0][(w * 3) + 1]
mark2 EGMENTS[d - ?0][(w * 3) + 2]
print mark1 + (' ' * $size) + mark2 + (' ' * $size)
end
print "\n"
end
end
horz(0)
vert(0)
horz(1)
vert(1)
horz(2)
--------------030909030706050101080809--