From: Laurent Julliard Date: 2005-01-10T06:45:11+09:00 Subject: [SOLUTION] LCD Numbers (#14) Here is my solution. I tried to make it as compact as possible (also see http://www.moldus.org/~laurent/Ruby/quiz/lcd.rb) # Ruby Quiz #14 - LCD Display # Laurent Julliard # digits = [[' - ','|.|',' . ','|.|',' - '], [' . ',' .|',' . ',' .|',' . '], [' - ',' .|',' - ','|. ',' - '], [' - ',' .|',' - ',' .|',' - '], [' . ','|. ',' - ',' .|',' . '], [' - ','|. ',' - ',' .|',' - '], [' - ','|. ',' - ','|.|',' - '], [' - ',' .|',' . ',' .|',' . '], [' - ','|.|',' - ','|.|',' - '], [' - ','|.|',' - ',' .|',' - ']] if ARGV[0] == "-s" s = ARGV[1].to_i; stg = ARGV[2] else s = 1 ; stg = ARGV[0] end aff = [] stg.each_byte do |c| aff << digits[c-48].collect { |l| l.sub(/\./,' '*s).sub(/-/,'-'*s) } end (aff = aff.transpose).each_index do |i| puts((aff[i].join(' ')+"\n")*(i%2 == 1 ? s : 1)) end