39
\$\begingroup\$

Your goal is to write the shortest program that outputs "Hello-World!" as ASCII art.

Rules :

  • It must be human readable, I don't care about it's size (cols/rows)
  • Output must contain only spaces (" "), sharps ("#") and newlines
  • The output must work with a monospaced font (but the letters doesn't necessary use a monospaced font)
  • In the result, each character must be separated from each other by at least one space

Please add a title with the language and the number of bytes in your code.

\$\endgroup\$
  • 5
    \$\begingroup\$ bash: 33 characters – pastebin.com/HZ1w8z8g Is this acceptable? \$\endgroup\$ – manatwork Feb 6 '14 at 13:51
  • 4
    \$\begingroup\$ Why the hyphen though?... \$\endgroup\$ – Timwi Feb 6 '14 at 14:16
  • 1
    \$\begingroup\$ I suppose to make impossible or unfeasibly hard the use of something predefined like HQ9+. \$\endgroup\$ – manatwork Feb 6 '14 at 14:23
  • 1
    \$\begingroup\$ @PeterTaylor: The output consisting of spaces and hashes must work with a monospaced font, but the letters represented by the plethora of hashes need not all have the same width. \$\endgroup\$ – Timwi Feb 6 '14 at 14:39
  • 1
    \$\begingroup\$ Related, but different: Say “Hello” to the world in ASCII art \$\endgroup\$ – Ilmari Karonen Feb 6 '14 at 15:58

33 Answers 33

1 2
0
\$\begingroup\$

C#, 205 203 202 bytes

I'm storing the text as an array of 5 longs, each representing a row in the display. I iterate over the array, and use bitwise comparison to work out if each bit is a # (1) or a space (0).

class G{static void Main(){foreach(var c in new long[]{0x14401100505,0x16589102525,0x15455575557,0x5455505535,0x16448A02565})for(int i=0;i<42;i++)System.Console.Write((i>40)?"\n":(c&1L<<i)>0?"#":" ");}}
\$\endgroup\$
-1
\$\begingroup\$

"cURL", 16 characters:

program: (computer science) a sequence of instructions that a computer can interpret and execute;

curl floris.us/h

Produces:

#   #      #  #           #   #          #     #  #
#   #  ##  #  #   ##      #   #  ##   ## #   ###  #
##### #### #  #  #  # ### # # # #  # #   #  #  #  #
#   # #    #  #  #  #     # # # #  # #   #  #  #
#   #  ##   #  #  ##       # #   ##  #    #  ###  #

I guess if I had a cooler domain, it would be shorter...

\$\endgroup\$
  • \$\begingroup\$ Personally, I would consider this cheating. \$\endgroup\$ – The Guy with The Hat Feb 7 '14 at 22:40
  • \$\begingroup\$ @RyanCarlson yes, but it's short... \$\endgroup\$ – Floris Feb 8 '14 at 0:53
  • 3
    \$\begingroup\$ How is this different from putting an arbitrarily large program into a script called x, setting execute permission on x, setting the PATH to include the current directory, and then saying you have a one-character solution (just type x!). I think this whole class of solution is cheating. \$\endgroup\$ – steveha Feb 8 '14 at 4:31
  • 1
    \$\begingroup\$ @mojo, figlet is at least a common program, to which people have access. Some people already have it installed, and others can install it. I don't think it's "cheating" to use such a program. But I do think this problem would be better if it required answers to be written in a programming language and not run any external programs or include any library modules. (That would of course invalidate my own answer, which depends on the user having the banner program installed.) \$\endgroup\$ – steveha Feb 8 '14 at 4:37
  • 1
    \$\begingroup\$ @Floris You can transform your answer in a shell one: curl floris.us/h ;-) \$\endgroup\$ – Ionică Bizău Feb 9 '14 at 14:26
-4
\$\begingroup\$

Shell + pyfiglet, 31 characters

pyfiglet can run as a shell tool, so we can simply go like this:

pyfiglet -f'3x5' 'Hello-World!'

which gives us:

# #      #   #          # #          #    #  #  
# # ###  #   #  ###     # # ### ###  #  ###  #  
### ##   #   #  # # ### ### # # #    #  # #  #  
# # ###  ##  ## ###     ### ### #    ## ###     
# #                     # #                  #  

Looks much better with less line spacing.

Letters are separated with one space, and in terminal it's well readable.

\$\endgroup\$
  • 3
    \$\begingroup\$ You could save two chars by just dropping the py. Also, there's no need to quote 3x5. \$\endgroup\$ – Ilmari Karonen Feb 7 '14 at 23:29
  • 7
    \$\begingroup\$ Big rule abuse, nothing even remotely similar to golfing. \$\endgroup\$ – Tomas Feb 9 '14 at 14:05
  • 1
    \$\begingroup\$ No need for any of those quotes \$\endgroup\$ – Kevin Feb 9 '14 at 16:53
  • 1
    \$\begingroup\$ Why not just compile one of the other solutions in this post, and give the binary a one character name? \$\endgroup\$ – The111 Feb 9 '14 at 21:43
  • 2
    \$\begingroup\$ I see your point. Please excuse my misunderstanding, then, based on many answers in this - and other - topics, I got the idea that the purpose was just to write the shortest code possible, any hack goes, but that would indeed lead to calling some URL containing ASCIIart through curl, and, granted, it would be pointless. Thanks for pointing that out, I'm still new to the idea, and not a sesoned programmer as well. I'll keep my libraries in my pants next time :) \$\endgroup\$ – Taku Feb 10 '14 at 10:30
1 2

Not the answer you're looking for? Browse other questions tagged or ask your own question.