There is a program, banner(1), on a lot of unix systems that does this. So
either you might not want to do it in Ruby (because this does it already),
e.g.,

banner -w 40 Hello, World

Or you can look at its source and see how it does it:
http://www.opensource.apple.com/source/text_cmds/text_cmds-9/banner/chset.c
contains encoding of the letters and then
http://www.opensource.apple.com/source/text_cmds/text_cmds-9/banner/banner.c
uses it. It goes further by correctly printing drop characters like j, p,
q, etc.

HTH,
Paul


On Thu, May 7, 2015 at 5:29 PM, Miles Morales <nncy.vall...@gmail.com>
wrote:

>
> <https://lh3.googleusercontent.com/-m_DS-J8aZ1Q/VUwDJxCokUI/AAAAAAAAAyY/D0q23OpxzYE/s1600/Screen%2BShot%2B2015-05-07%2Bat%2B6.35.13%2BPM.png>
> How can you alter the following code to replicate the letters 'G' and 'X'
> into your command prompt using ROR? I was able to create the letter H to
> display on my cmd.
>
>
> Draw top Region 1
>     for y in 1..8
>       for x in 1..6
>         print "*"
>       end
>
>       for x in 1..8
>         print " "
>       end
>
>       for x in 1..6
>         print "p"
>       end
>
>       print "\n"
>     end
>
>
> Draw center bar Region 2 goes all the way across the bar
> Use a different character or different regions.
>
>
>   for y in 1..3
>       for x in 1..20
>         print "*"
>       end
>       print "\n"
>     end
>
>
> Draw bottom bar Region 3 Look like the top bar
>
> for y in 1..8
>       for x in 1..6
>         print "*"
>       end
>
>       for x in 1..8
>         print " "
>       end
>
>       for x in 1..6
>         print "*"
>       end
>
>       print "\n"
>     end
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/48237a6d-2b72-4a0b-9174-84e2eea6e351%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/48237a6d-2b72-4a0b-9174-84e2eea6e351%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAMEJyisWF%2BhnScf883sChyHE1PTgnrsd8SOXMni2ZxV4%3D%3DOfKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to