Here's another in a similar vein to my previous one (oh for the good old days...)
charset= {
:h=> [130,130,130,254,134,134,134,0],
:e=> [254,128,128,248,192,192,254,0],
:l=> [128,128,128,192,192,192,254,0],
:o=> [126,130,130,134,134,134,252,0],
:w=> [130,130,130,150,150,150,108,0],
:r=> [252,130,130,252,194,194,194,0],
:d=> [252,130,130,194,194,194,252,0],
:space=> [0,0,0,0,0,0,0,0]}
msg= [:h,:e,:l,:l,:o,:space,:w,:o,:r,:l,:d]
def to_pixels val
val.to_s(2).rjust(8,'0').gsub('0',' ').gsub('1','X')
end
0.upto(7) do |line|
msg.each do |ch|
print to_pixels(charset[ch][line])
end
puts
end
Cheers,
Dave