ASCII art "Hello-World!"

39

14

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.

sebcap26

Posted 2014-02-06T13:44:36.933

Reputation: 1 301

Question was closed 2016-04-26T22:14:26.720

5bash: 33 characters – http://pastebin.com/HZ1w8z8g Is this acceptable? – manatwork – 2014-02-06T13:51:04.193

4Why the hyphen though?... – Timwi – 2014-02-06T14:16:48.787

1I suppose to make impossible or unfeasibly hard the use of something predefined like HQ9+. – manatwork – 2014-02-06T14:23:21.720

What is "The output must work with a monospaced font (but the letters doesn't necessary use a monospaced font)" supposed to mean? Should it be a monospaced font or not? – Peter Taylor – 2014-02-06T14:37:16.190

1@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. – Timwi – 2014-02-06T14:39:27.887

Does the case of the letters matter? – Tomas – 2014-02-06T15:24:38.450

@manatwork if you add the number of characters needed to code figlet then it's acceptable :) – Tomas – 2014-02-06T15:26:00.797

1

Related, but different: Say “Hello” to the world in ASCII art

– Ilmari Karonen – 2014-02-06T15:58:57.880

@Tomas yes, the case matters. – sebcap26 – 2014-02-06T16:43:04.760

@manatwork Technically, that's not forbidden. – sebcap26 – 2014-02-06T16:45:57.633

1You should have restricted this contest to ascii-only source and no use of any external fonts. Would have been much more fun. Let's at least make a sub-contest for that. – Tomas – 2014-02-06T18:30:03.553

@manatwork How does it make HQ9 hard? All you need is to draw the ASCII ART, replace something with a Q(probably the . on !), and voila. – Cruncher – 2014-02-06T19:13:04.550

A Unix command. In Unix there used be a command-line tool to achieve just this. In good old matrix-printer days it was necessary to generate a title page for the output of a printing job. So there was a command for just this purpose: the generation of the ASCII-art representation of the arguments. But what was its name? It was so long ago that I forgot it - I did not use it many times anyway, but I was aware of it. – None – 2014-02-07T07:09:15.120

In the result, each character must be separated from each other by at least one space, the chars in "hello world" or the "#"s with which this is printed? – avalancha – 2014-02-07T11:32:31.120

@avalancha At least one space between the # separating each letters – sebcap26 – 2014-02-07T11:33:57.990

@ijbalazs: You may be thinking of either banner or figlet.

– Ilmari Karonen – 2014-02-07T17:37:54.470

Answers

18

I absolutely enjoyed this one

Perl, 126 116 114 102 98  87 (69) chars (ascii only & no external fonts)

As of now shortest ascii solution which doesn't use any external fonts.

Well, I wanted to present some elegant solution but @Ilmari Karonen challenged me with unpack... shouldn't have done that :-)

Well, this 92 88 69 chars code generates the uglish unreadable output identical to @Ilmari Karonen's:

say map{y/01/ #/r}unpack"((b6)7a)*",'eT@j@DE
UUBjdeE
wTujjTA
eUBTddE'

More elegant variant without unpack (88 chars):

map{print$"x$_,$/x/4/,"#"x!/7/}7&ord,7&ord>>3for'HRyYOKLIIjIRHBa@AJIAIIIJaQHQNSRH'=~/./g

But I think such |.|e||.-|||.,d! thing is nothing which resembles Hello-World! and shouldn't be allowed, so real solution goes here - unpack variant, 87 chars:

say map{y/01/ #/r}unpack"((b6)9a)*",'E`D@HB@Hd
EcD@HB@Hd
ggDsIbaIf
e`dDhRRHE
ECICPaQPf'

Output:

enter image description here

More elegant variant at 98 chars:

map{print$"x$_,$/x/1/,"#"x!/7/}7&ord,7&ord>>3for'PW{nw^QD[w}vK@X@PcP@jCDjXQk[rRRbSQD\CWbXeX'=~/./g

Output:

enter image description here

Older solution (114 chars), different type of coding:

print'#'x(3&ord),$"x($:=15&ord>>2),$/x!$:for'EmM}U}]MBEQSM}U}]MBOFNMQOKUMSKUOBEM]MMM]IIIMIUQIAEQWMMgFROYQOB'=~/./g

Output:

enter image description here

Tomas

Posted 2014-02-06T13:44:36.933

Reputation: 2 333

Forgot the exclamation at the end, i.e. Hello-World! Also, should be lower-case e, but I know you did upper-case to make it readable as a five pixel high font... – None – 2014-02-06T17:25:14.467

47

JavaScript, 178 bytes

c=document.createElement("canvas").getContext("2d");c.fillText("Hello-World!",0,7);d=c.getImageData(1,0,56,7).data;s="";for(i=3;i<1568;i+=4){s+=d[i]?"#":" ";s+=(i+1)%224?"":"\n"}

That works in Firefox 27 Scratchpad.

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

sebcap26

Posted 2014-02-06T13:44:36.933

Reputation: 1 301

I recognise Arial :-D – Timwi – 2014-02-06T14:35:00.567

4This is my favourite. You've used an interesting method to arrive at the solution. Wonderful! – Darth Egregious – 2014-02-06T18:24:29.203

2Ingenious, I do believe you've just created Figlet for JavaScript ;) – WallyWest – 2014-02-06T21:06:54.537

Dagnammit, this was my first thought too! Here's an upvote instead. :) – Jordan Gray – 2014-02-17T16:33:38.127

37

Mathematica 101 99 98

This rasterizes the expression, obtains the binary image data, converts each 1 to "#", each 0 to "" (empty space) and displays output in a 12 by 130 character grid.

GraphicsGrid[ImageData@ImageResize[Binarize@Rasterize@Style["Hello-World!",99],130] 
  /.{1→"",0→"#"}]

hello

One character economized thanks to Jonathan Van Matre.

DavidC

Posted 2014-02-06T13:44:36.933

Reputation: 24 524

1Why does the thickness vary between the l's? – MrZander – 2014-02-07T01:26:31.687

I did the rasterization on the expression as a single image. If I had done it letter by letter, the l's would have been identical. Also, by increasing the rasterization grid size, the output tends to approach the quality of the printed characters. But a larger grid results in relatively smaller "#", to the point that they appear to be mere pixels. The question remains: why do 2 l's in an image receive different weights? – DavidC – 2014-02-07T01:41:23.520

3

@MrZander, that's the very reason fonts have hinting: When trying to fit fonts into a low-resolution pixel grid, like in ASCII art or on screen stem width is never really uniform because the font cannot have integral-pixel wide stems at all sizes. Here is a nice explanation with pictures.

– Joey – 2014-02-07T08:50:41.747

@Joey, nice explanation and link. – DavidC – 2014-02-07T12:26:14.090

1prbably the best looking – Ronan Dejhero – 2014-02-09T15:05:40.600

Clever exploitation of Binarize@Rasterize. You can save a few bytes using 9 and 99 in place of 130 and 130. The output is somewhat less pretty, but still both readable and recognizably composed of #s. – Jonathan Van Matre – 2014-02-12T17:11:20.580

1Jonathan Van Matre, Thanks. The first parameter could be reduced to 99 but I wouldn't want to reduce the second, due to output quality. (I realize that this is a code-golf challenge, but I do have my pride.) – DavidC – 2014-02-12T17:33:04.950

25

Delphi 85 bytes

var s:tstringlist;begin s:=tstringlist.Create;s.LoadFromFile('\a');Write(s.Text);end.

I know, its not the prettiest solution but there was no rule that said you couldnt use external resources.
Result: Result

Teun Pronk

Posted 2014-02-06T13:44:36.933

Reputation: 2 599

12+1 for the creativity of using # as background rather than foreground. – gerrit – 2014-02-07T12:32:36.237

1You can declare s as TStrings instead. (But keep the instantiation with TStringList.) – manatwork – 2014-02-07T19:58:44.637

Is the file you're loading from something that actually ships with Delphi, or did you write it yourself? If the latter, I think you'd need to count its length as part of your score. – Ilmari Karonen – 2014-02-08T02:36:54.797

@Ilmari, I'm sure Delphi doesn't ship with a file with "Hello-World" ASCII art :) Moreover, it's described in the answer, that it uses external resources. – TLama – 2014-02-09T07:24:34.277

3

@TLama: I assumed so, too, I was just trying to phrase it politely. My point is that, even if external resources were allowed, this program would still fail on anyone's computer except its author's (and, in fact, we have no proof that it even works on his computer). Also, I can beat his score with the following Perl script: do X. The content of the "external resource" X is left unspecified (it works for me, isn't that enough?), but I've provided a couple of possible suggestions below...

– Ilmari Karonen – 2014-02-09T07:44:27.033

15

Perl 5, 54 bytes / 71 printable ASCII chars

Note: This is the second version of this answer. For the original 64-byte / 95-char version using PHP and gzinflate(), see the history of this answer.

Here's the 71-char printable ASCII version:

y/01/ #/,say for unpack'(B40)4',unpack u,'4I*`1`(JJI!$FFNRJU52HIJ0*))H'

The 54-byte version contains non-printable characters, so I'm providing it as a hex dump. On Unixish systems, you can use xxd -r to turn the hex dump back into an executable Perl script:

0000000: 792f 3031 2f20 232f 2c73 6179 2066 6f72  y/01/ #/,say for
0000010: 2075 6e70 6163 6b27 2842 3430 2934 272c   unpack'(B40)4',
0000020: 27a4 a011 008a aaa4 1126 9aec aad5 54a8  '........&....T.
0000030: a6a4 0a24 9a27                           ...$.'

Both need to be run with perl -M5.010 to enable the Perl 5.10+ say feature. They will produce the following output:

Screenshot of "Hello-World!" ASCII art

(Shown as a screenshot, because the huge line-height on SE makes ASCII art ugly and hard to read. The lower case "e" is kind of awkward, but I believe this qualifies as readable, if only barely so.)


Ps. If the output of the solution above feels too minimalistic for you, here's a 92-character variant that produces output similar to Tomas's solution:

y/01/ #/,say for unpack'(B56)*',unpack u,'CH!(`"(`"":,2``B``@GGDC\'(C#(YI!)("I)"2*,),`4,03D'

Here's a screenshot:

Screenshot of "Hello-World!" ASCII art


Pps. I'm pretty sure this (GolfScript, 51 chars) is the shortest printable-ASCII solution, if you don't count the ones that just call banner / FIGLet or that cheat in some other way:

'iJ@Q@HmURBIMM{JkUUJeMRAQIM'{2base(;{' #'=}/}%39/n*

The output is the same as for my 71-char Perl solution above.

Ilmari Karonen

Posted 2014-02-06T13:44:36.933

Reputation: 19 513

I'd say you have just crossed the border of readability :-) – Tomas – 2014-02-06T22:47:29.287

1It's considerably more readable in my terminal than here on SE, because of the huge line spacing here. – Ilmari Karonen – 2014-02-06T23:09:16.307

I mean, it is unreadable anyway. BTW I can produce your output in 92 chars, with no external compression algorithm :-)

– Tomas – 2014-02-07T10:24:05.060

@Tomas: You're right, zipping does not seem to be the winning answer here. I'd give you a +1 for that if I hadn't already. BTW, I can do it in 71 chars; see above. :-) – Ilmari Karonen – 2014-02-07T13:29:25.573

@Tomas: ps. I added a version that produces output similar to yours. – Ilmari Karonen – 2014-02-09T09:12:07.607

The bottommost line of the 93-char like-Tomas's-output solution seems to be garbled for me. – FireFly – 2014-02-09T13:28:17.607

1Ilmari, you shouldn't have challenged me with unpack :-) Found a solution of 69 chars (87 with the nice output of mine). – Tomas – 2014-02-09T16:55:56.443

@FireFly: Huh, you're right, there was a stray backslash in the code. I've no idea how it ended up in there, but I've fixed it now. – Ilmari Karonen – 2014-02-09T23:44:23.493

8

Shell + Figlet (35)

$ figlet -w 90 -f banner Hello-World!
#     #                                   #     #                             ### 
#     # ###### #      #       ####        #  #  #  ####  #####  #      #####  ### 
#     # #      #      #      #    #       #  #  # #    # #    # #      #    # ### 
####### #####  #      #      #    # ##### #  #  # #    # #    # #      #    #  #  
#     # #      #      #      #    #       #  #  # #    # #####  #      #    #     
#     # #      #      #      #    #       #  #  # #    # #   #  #      #    # ### 
#     # ###### ###### ######  ####         ## ##   ####  #    # ###### #####  ### 

grim

Posted 2014-02-06T13:44:36.933

Reputation: 397

What kind of font is this? Those just look like smaller upper-case characters. – Cruncher – 2014-02-06T19:14:14.587

it's banner -f banner It was the first font I found that used # instead of * or | and _. – grim – 2014-02-06T19:39:49.497

here's the same in pure Python

– jfs – 2014-02-07T08:03:40.593

Changing "90" to "9" yields a tall and skinny hello world, however because the OP does not care about columns or rows, it should be acceptable. – alexyorke – 2014-02-07T11:42:54.850

Sometimes voters baffle me. How come this gets a net score of +8, but the other figlet answer gets a net score of -3?

– Digital Trauma – 2014-04-18T20:28:19.673

8

Python 260 215 186 152

>>> print'eJyNkFEKwDAIQ/93isC7/x3LyIJullHrR1BfJSIJPUHTlmiUPHbxC7L56wNCgZAxv3SjDWIxsoOb\nzMaBwyHYPJ5sVPNYxXism74vcIsFZlYyrg=='.decode('base64').decode('zip')
#   #        #  #          #   #   #          #     #  #
#   #        #  #          #  # #  #          #     #  #
#   #   ##   #  #   ##      # # # #   ##   ## #   ###  #
#####  #  #  #  #  #  #     # # # #  #  #  #  #  #  #  #
#   #  ####  #  #  #  # ##  # # # #  #  #  #  #  #  #  #
#   #  #     #  #  #  #     # # # #  #  #  #  #  #  #   
#   #   ###  #  #   ##       #   #    ##   #  #   ###  #

Python 196 183 130 114 (but uglyer)

>>> print'eJxTVlBWgCAgAQHKqBywAJeyAgJCZREcZWUYyaUMIpUVEKqRNcLEueDqEaZBLVVWQDITADIdFBw='.decode('base64').decode('zip')
# #  #  # #        # # #        #   # #
# # # # # #  #     # # #  #  ## #  ## #
### ##  # # # # ## # # # # # #  # # #
# #  ## # #  #      # #   #  #  #  ## #

I used zipped data in base64 encoding. and the code decode it from base64 encoding and then unzipping it.

Elisha

Posted 2014-02-06T13:44:36.933

Reputation: 1 015

Wow, that's really stretching legibility! – None – 2014-02-07T16:19:14.143

7

PHP — 183 bytes

Using sebcap26's ASCII art as the source...

foreach(str_split(base64_decode('iASAERACCYgEgBKQAgmIxIwKoxo5+SSSCqSSSYnkksqkkkmJBJIKpJJIiOSMBEMSOQ'))as$i=>$j)echo strtr(sprintf("%8s%s",decbin(ord($j)),($i+1)%7?"":"\n"),'01',' #');

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

user15259

Posted 2014-02-06T13:44:36.933

Reputation:

6

Brainfuck, 372 Byte

(I know. but just for completeness, there has to be brainfuck ^^ It'S not going to get much shorter, as there are little repetitions. First and second line loop already...)

++++++++[>++++>++++<<-]>+++>>++++++++++>>+>++[-<<<<<.>.<.>..>>>[-<<<.>>>]<[-<<<.>>>]<<..<.>>>++[-<<.<.>..........<.>....>>]<<<.>.<.>>.>+>>]<<<<<...>.<.>.<.>.<.>.<.>..<..>..<...>.<.>..<.>..<.>..<..>...<..>.<.>..<...>.<.>>.<<.>.<.>.<.>...<.>.<.>.<.>..<.>.....<.>.<...>.<.>.<.>..<.>.<.>...<.>.<.>..<.>>.<<.>.<.>.<...>.<.>.<.>..<..>.......<..>.<..>...<..>..<.>...<.>..<..>..<.

Interpreter here: http://koti.mbnet.fi/villes/php/bf.php


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

Combining @ASKASK's number generator and image with my loops and some additional tuning, we get:

Brainfuck, 343 339 336 334 Bytes

Looks uglier than my original version though.

+++++[->++++++>+++++++>++<<<]>++>>>+>>++[-<<<<.<.>.<..>>>[-<<<.>>>]>[-<<<.>>>]<<<<..>.<.>>>++[-<<.<.........>.<...>>>]<<.<.>.>.>>+>]<<<<..<<+++++[->>.<.<]>.>.<..>...<.>.<.>.<.>.<..>.<...>..<.>.<..>..<.>.>.<.<.>.<.>.<...>.<.>.<.>.<.>.<.....<++++++[->>.<.<]>..>.<.>.<.>.>.<.<.>.<..>.<..>.<.>.<..>.<.......>...<...>.<..>.<...>.<..>.<..>.

(image see @ASKASK's Answer)

Johannes H.

Posted 2014-02-06T13:44:36.933

Reputation: 161

5

EcmaScript 6, 172 161

'¡I%e!c0ĄJ¥eìo0¸ËefMs0µKcÊIs0´Ê¢1éo'.split(0).map(s=>s.split('').map(c=>{for(i=8,s='';i--;)s+=(c.charCodeAt(0)-33)&(1<<i)?'#':' ';return s;}).join('')).join('\n')

Output:

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

Explanation:

The ASCII text is compacted into a string where each bit represent a pixel:

  • 0 for SPACE
  • 1 for #

An offset of 33 is applied in order to get only printable characters.

Florent

Posted 2014-02-06T13:44:36.933

Reputation: 2 557

charCodeAt(0) can be reduced to charCodeAt(). – Chiru – 2015-08-06T23:34:57.363

The first fat arrow function's brackets and return statement are not necessary. – manatwork – 2014-02-07T08:10:41.060

@manatwork I tried to removed it but then it was no longer compiling. Are you sure about that? – Florent – 2014-02-07T08:37:40.567

1

Firefox 27.0: http://i.stack.imgur.com/VyqnC.png

– manatwork – 2014-02-07T08:46:50.740

@manatwork Thanks! – Florent – 2014-02-07T08:50:54.147

4

Sclipting, 38 characters (76 bytes)

갦륈똄릵꺕녔꺒녪냕녪낷뚕년꺒녦냉괄낵要감嚙긂밃⓶掘⓶終丟併껧뜴꼧밍替現겠合終

Output:

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

Timwi

Posted 2014-02-06T13:44:36.933

Reputation: 12 158

4

The code-golf info page says "If you use Unicode, byte count should use UTF-8." If I'm not mistaken, that makes your program-length 114 bytes. (The 76 bytes you mention would be for UTF-16 without a BOM.)

– r.e.s. – 2014-02-06T14:52:11.490

@r.e.s.: I changed that, as it makes no sense to require that. My Sclipting interpreter understands UTF-16 just fine, so it’s a valid program encoded as UTF-16. – Timwi – 2014-02-06T16:28:03.427

1Timwi, case matters – Tomas – 2014-02-06T18:29:07.503

Shouldn't this be 'Hello-World" and not "HELLO-WORLD" – Mhmd – 2014-02-06T19:54:05.470

3@user689 - actually "Hello-World!" with an exclamation point at the end... – None – 2014-02-06T19:57:13.623

A mix between Korean and Chinese/Japanese ideographs. I thought those were only used for people's names in Korean now. Interesting. – Panzercrisis – 2014-02-06T20:20:45.320

Oh, I see why now. – Panzercrisis – 2014-02-06T20:22:36.093

I see that you edited the info page for the code-golf tag. It might have been a better idea to first propose and discuss such changes -- e.g. in response to Scoring code golf (bytes vs. characters).

– r.e.s. – 2014-02-07T00:51:52.007

@r.e.s.: Actually my edit was a proposal and it has been accepted by the community. (I don’t have the rep to edit it directly.) – Timwi – 2014-02-07T11:14:42.427

1I suppose "accepted by the community" means "accepted, without community discussion, by a small number of people with the power to do so." – r.e.s. – 2014-02-07T12:07:52.470

@r.e.s.: I apologize for any friction caused by my (and the reviewers’) actions. I didn’t realize that this was controversial. Please consider giving me the benefit of the doubt. I am engaging in community discussion about this on meta now. – Timwi – 2014-02-07T14:27:37.267

3

Brainfuck, 362 bytes

Sorry @johannes-h, I saw yours and was inspired to make my own. It uses a combination of faster number generation at the beginning and a simpler picture to generate the result in less bytes. It does not however use loops anywhere else so it is up for optimization.

+++++[->++++++>+++++++>++<<<]>++>.<.>.<.....>.<.>.<.........>.<...>.<.........>.<...>.<.>.>.<.<.>.<..>.<..>.<.>.<.........>.<...>.<.........>.<...>.<.>.>.<...<.>.<.>.<.>.<.>.<..>.<..>...<.>.<.>.<.>.<..>.<...>..<.>.<..>..<.>.>.<.<.>.<.>.<...>.<.>.<.>.<.>.<.....>.<.>.<.>.<.>.<.>.<.>.<...>.<.>.<.>.>.<.<.>.<..>.<..>.<.>.<..>.<.......>...<...>.<..>.<...>.<..>.<..>.

which generates:

pic

ASKASK

Posted 2014-02-06T13:44:36.933

Reputation: 291

Hm. How much shorter is the number generation? 'cause changing the image looks like cheating to me (at least when directly comparing our solutions - perfectly valid in this contest of course) ^^ BUt I'm going to look into yours later on :)

You can take my loop for the first two lines however. It's a lot shorter (was about 10-20 bytes if I remember correctly) – Johannes H. – 2014-02-07T06:29:35.670

got your version down to 343 Byte, see my answer – Johannes H. – 2014-02-07T07:11:08.170

and even shorter, replacing more repetitions by loops. 339 now. – Johannes H. – 2014-02-07T07:31:34.617

I dont have neough reputation to comment on yours but if you look closely at your new version you will find a "><" in there that can be deleted to take away two bytes :) – ASKASK – 2014-02-08T02:41:17.810

3

ImageMagick + sed, 71 bytes

I don't see any other ImageMagick entries, so here's my late stake in the ground:

convert +antialias label:Hello-World! xpm:-|sed '8,+9y/ /#/;s/[^#]/ /g'

I think the sed portion can probably be golfed some more.

Try it online.

Output:

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

Digital Trauma

Posted 2014-02-06T13:44:36.933

Reputation: 64 644

2

Postscript, 154 133

<~GasbQ8I>GO#QsOD7:?,pa&5XCgo@jeLPX:a4F9kN1nu1B@8KjD"^]WgY[MA.2VBjpTNo5$Pi%uI9Lr>,9`~>/FlateDecode filter 999 string readstring pop =

i.e.

    <~GasbQ8I>GO#QsOD7:?,pa&5XCgo@jeLPX:a4F9kN1nu1B@8KjD"^]WgY[MA.2VBjpTNo5$Pi%uI
9Lr>,9`~>
/FlateDecode filter 
999 string readstring pop 
=

ASCII-only source, inspiration for ASCII-art was Johannes H.'s answer :-)

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

(more readable in terminal)

Perl, 102

print$-%44?'':"\n",vec(unpack(u,'<!040`A!:4@`A`*%7918REEM1":T4)75E(#&1"0``'),$-++,1)?'#':' 'for 0..219

Same output as above. I know I lost to both Perl answers above, but I publish it anyway. At least I tried and was moving in the right direction (and hadn't seen shortest answer) :-).

user2846289

Posted 2014-02-06T13:44:36.933

Reputation: 1 541

2

Pure Bash, no external utilities - 133 characters:

c=" #";for x in 0x{5250088045,55520A914D,74556AAA54,535205124D};do while((s=(t=x)^(x/=2)*2,t));do L=${c:s:1}$L;done;echo "$L";L=;done

Uses right and left shift (divide and multiply by 2) and xor to find the one bits.

Font data stolen from Blender/Ilmari Karonen.

Tested in Bash 3.2 and 4.2

By the way, this is only 166 characters:

echo "# #  #  # #        #   #        #   # #
# # # # # #  #     # # #  #   # #  ## #
### #   # # # # ## # # # # # #  # # #  
# #  ## # #  #      # #   #  #  #  ## #"

Paused until further notice.

Posted 2014-02-06T13:44:36.933

Reputation: 121

1

Python 3, 114

print('\n'.join(bin(x)[2:]for x in[353530052677,366448644429,499649260116,357858349645]).translate({48:32,49:35}))

Output (4-character tall e and W stolen from @Ilmari Karonen):

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

And a shorter one (107):

print('\n'.join(bin(x)[2:]for x in[11993933918769,16391913257513,12021315382193]).translate({48:32,49:35}))

Output:

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

Blender

Posted 2014-02-06T13:44:36.933

Reputation: 665

It's mostly unreadable. Your World from 2nd output is actually Uorld. – Silviu Burcea – 2014-02-07T13:39:35.823

@SilviuBurcea: It looks better on an actual terminal emulator. Also, "Human-readable" gives you a bit of wiggle room. I'm sure you can guess what `"HELLO ⊔ORLD!" means. – Blender – 2014-02-07T17:35:29.110

Use hex constants and shave a few characters off – Floris – 2014-02-08T13:08:52.817

@Floris: I tried that. The two-character prefix makes them just as long up until around 20 digits. – Blender – 2014-02-09T00:15:38.833

1

Python 154 Characters, (Char 5X7 in size)

print'\n'.join(map(''.join,zip(*(''.join("# "[int(e)]for e in"{:07b}".format(ord(c))[1:])for c in"€÷÷÷€ÿñêêòÿ€ÿ€ÿñîîñÿûûÿŸáþÁ¿ÁþáŸÿñîîñÿàïÿ€ÿÿñîî€ÿ‚"))))

Output

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

Abhijit

Posted 2014-02-06T13:44:36.933

Reputation: 2 841

1

bash, 175 170 bytes

You need to waste quite a few characters in order to produce a pretty output!

base64 -d<<<H4sICKaT9FICAzAxAK2RQQ7AIAgE776CZP7/x1ZjERebcJAL0QybhcV6YdWizAPNaUatQQLFpj6h+c/XA05WF9Wtk9WJcxz4oe6e1YPQa7Wiut2wfjJ16STY30lSnNIlzvdpHhd6MiTOB65NYc+LAgAA|zcat

Output:

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

devnull

Posted 2014-02-06T13:44:36.933

Reputation: 1 591

You can make it smaller with lzma/unlzma – Emmanuel – 2014-08-08T16:02:24.753

1

Shell, 20 characters:

banner Hello-world\!

For this to work, of course you need the banner program. On Debian, you can get it by installing the bsdmainutils package.

This prints a beautifully rendered version of your message, designed to be printed on one of the old continuous-feed printers, so the output of the above text is 322 lines long by 123 columns wide, and you turn the printout on its side to read the message. You could hang the resulting paper on the wall as a banner, hence the name.

http://en.wikipedia.org/wiki/Banner_%28Unix%29

EDIT: Looks like Debian also has the sysvbanner package, which installs a banner program that prints the text horizontally for display on a terminal. However, this only prints the first 10 characters of the message, so it is kind of annoying for this code-golf problem!

steveha

Posted 2014-02-06T13:44:36.933

Reputation: 127

1I believe you meant to write banner hello-world. – Floris – 2014-02-08T13:01:23.930

@Floris, thanks for the heads-up. Fixed. – steveha – 2014-02-08T23:00:56.940

1Note that banner appeared on Unix v7 in 1979 and is found on virtually every Unix. – sch – 2014-02-09T16:33:58.107

@sch, I agree that banner is available for virtually every UNIX. I just put the Debian package as a convenient proof that I wasn't just making something up, for people who didn't know about it. These days I wouldn't expect to find banner installed by default on a UNIX, any more than I would expect to find a continuous-feed printer in a computer lab anymore. But any code golf on making banner text really ought to have the banner program in it somewhere. It's part of our rich cultural history as computer geeks. :-) – steveha – 2014-02-09T21:46:40.697

1

Bash:

(103 89 Bytes)

Code:

base64 -d<<<rohBEmRiqIihFVRS7IitVWRSqIihVVRQru5Aoldi|xxd -b|sed -e's/ //g;s/1/#/g;s/0/ /g'|cut -b'9-55'

Output:

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

Smaller, but less readable (Based on http://mckgyver.pbworks.com/f/1240440791/3PixelFont.jpg):

Code:

base64 -d<<<V0nCLsmQdklaqslQV23BTq2Q|xxd -b|sed -e's/ //g;s/1/#/g;s/0/ /g;'|cut -c'9-52'

Output:

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

christofsteel

Posted 2014-02-06T13:44:36.933

Reputation: 11

1

Authors: xem, aemkei, p01, jonas

Execute this in the JS console.

JavaScript, cross-browser,133 132 126 117 bytes

for(i=s="";l=[43117609029,64070269789,46349920852,46890400349][i++];)for(j=0,s+="\n";c=l.toString(2)[j++];)s+=" #"[c]

JavaScript, ES6, works on Firefox, 108 bytes

[,0xa0a028045,0xeeae2bb5d,0xacaabaa54,0xaeae2ba5d].map(a=>a.toString(2).replace(/./g,b=>' #'[b])).join('\n')

Result:

>
# #     # #       # #        #   # #
### ### # # ###   # # ### ## # ### #
# # ##  # # # # # ### # # #  # # #  
# # ### # # ###   # # ### #  # ### #

xem

Posted 2014-02-06T13:44:36.933

Reputation: 5 523

@p01 made a shorter version (118 bytes) here: https://twitter.com/p01/status/433230019419471872

– aemkei – 2014-02-11T13:43:33.677

1

Javascript / ES6 (108 bytes)

Copy into console:

[,0xa0a028045,0xeeae2bb5d,0xacaabaa54,0xaeae2ba5d].map(a=>a.toString(2).replace(/./g,b=>' #'[b])).join('\n')

Output:

"
# #     # #       # #        #   # #
### ### # # ###   # # ### ## # ### #
# # ##  # # # # # ### # # #  # # #  
# # ### # # ###   # # ### #  # ### #"

(Needs ECMAScript6 compatible browser ie. Firefox 22+)

Inspired by @maximeeuziere, @p01, @aemkei

Musterknabe

Posted 2014-02-06T13:44:36.933

Reputation: 11

.join('\n') can be reduced to .join(\

`)` where the space is an actual new line character. – Chiru – 2015-08-06T23:36:39.080

1

HTML, 209 characters

<pre># #     # #                      #   # #
# #     # #        # # #         #   # #
###  ## # #  #     # # #  #  ##  #  ## #
# # ##  # # # # ## # # # # # # # # # #
# # ### # #  #      # #   #  #   # ### #</pre>

Does this count? :)

Florrie

Posted 2014-02-06T13:44:36.933

Reputation: 831

0

F# - 204 characters

for s in(Seq.map(Seq.unfold(function|0L->None|i->Some(" #".[int(i%2L)],i/2L)))[173948798213L;174770890021L;191304848727L;182715110773L;45277009173L;191279670629L])do printfn"%s"(new string(Seq.toArray s))

Output:

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

mattnewport

Posted 2014-02-06T13:44:36.933

Reputation: 1 579

0

Python + pyfiglet -- 87 characters

from pyfiglet import figlet_format     
print(figlet_format('Hello-World!', font='banner'))

Output

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

To install pyfiglet, run:

$ pip install pyfiglet

jfs

Posted 2014-02-06T13:44:36.933

Reputation: 209

0

Python with pyfiglet: 66 using argv, 69 without

66:

from pyfiglet import*
print(figlet_format(sys.argv[1],font='3x5'))

69:

from pyfiglet import*
print(figlet_format('Hello-World!',font='3x5'))

firs must be called as, for example:

python asciiart.py 'Hello-World!'

second:

python asciiart.py.

Output:

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

(Well, it looks kinda crappy with this font. Nevertheless :) )

[edit] removed obsolete dash from the argument.

Taku

Posted 2014-02-06T13:44:36.933

Reputation: 37

Why the extra dash in front of the output? – Ilmari Karonen – 2014-02-07T17:32:32.960

My mistake, that's the output from the one using argv, where I used a dash before the argument (matter of habit, as I use bash all the time). I'll edit it, thank you. – Taku – 2014-02-07T17:44:00.677

0

Javascript 137 (134)

Uses the bits of integers to represent sharps an white spaces. Tested with Firefox 27.

137 character

s="";[0xadb73eead9,g=0xa9252aaa94,0xed252aac95,g+1,0xad272aee99].map(n=>{for(;n>0;n/=2)n%2?[s="#"+s,n--]:s=" "+s;s="\n"+s});console.log(s)

# # ## #  #  ###  # # # ### ### #  ##  #
# # #  #  #  # #  # # # # # # # #  # # #
### ## #  #  # #  # # # # # ##  #  # # #
# # #  #  #  # #  # # # # # # # #  # #  
# # ## ## ## ###  ##### ### # # ## ##  #"

134 character (rotated 180°)

s="";[0xadb73eead9,g=0xa9252aaa94,0xed252aac95,g+1,0xad272aee99].map(n=>{s+="\n";for(;n>0;n/=2)n%2?[s+="#",n--]:s+=" "});console.log(s)

"
#  ## ## # # ### #####  ### ## ## ## # #
  # #  # # # # # # # #  # #  #  #  # # #
# # #  #  ## # # # # #  # #  #  # ## ###
# # #  # # # # # # # #  # #  #  #  # # #
#  ##  # ### ### # # #  ###  #  # ## # #"

schwer

Posted 2014-02-06T13:44:36.933

Reputation: 1

0

Python3 (126)

There's an additional space between the chars to make it better readable. So technically it's a 125 character solution.

print(' '.join(['','\n'][i%40==0]+['#',' '][int('72liw1j4glyc34dum02j2a4ipxa8b7vvp65x511',36)//2**i%2==0]for i in range(200)))

Output:

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

schwer

Posted 2014-02-06T13:44:36.933

Reputation: 1

0

Bash 37, 33

toilet<<<"Hello-world"|tr \"m \#

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

Which is the same as:

echo "Hello-world" | toilet

From man toilet

TOIlet - display large colourful character

With tr "'\"m" "#" all " chars are replaced with #.

fedorqui

Posted 2014-02-06T13:44:36.933

Reputation: 179

tr's parameters would be shorter escaped than quoted. I mean tr \'\"m \# instead of tr "'\"m" "#". – manatwork – 2014-02-12T16:35:27.127

Oh good one, I wasn't aware of that. Thanks @manatwork – fedorqui – 2014-02-12T16:38:13.177

Wait a second. The toilet output had no single quote. Why you included it in tr's 1st parameter? Just tr \"m \# is enough. – manatwork – 2014-02-12T16:41:06.863

@manatwork I think I need more coffee :) – fedorqui – 2014-02-12T16:44:39.413

0

Smalltalk, 151

although this golf game is already over, for the reference:

i:=((Form extent:115@14)displayString:'Hello world'x:0y:12;asImage).0to:13 do:[:y|i valuesAtY:y from:0to:114 do:[:x :p|({$#.$ }at:p+1)print].Stdout cr]

output:

 ***  ***             ***       ***                                                         ***           **       
  *    *                *         *                                                           *            *       
  *    *                *         *                                                           *            *       
  *    *     ***        *         *        ***              ***   ***    ***     *** ***      *        *** *       
  ******    *   *       *         *       *   *              *     *    *   *      **   *     *       *   **       
  *    *   *     *      *         *      *     *             *  *  *   *     *     *          *      *     *       
  *    *   *******      *         *      *     *              * * *    *     *     *          *      *     *       
  *    *   *            *         *      *     *              * * *    *     *     *          *      *     *       
  *    *    *    *      *         *       *   *               ** **     *   *      *          *       *   **       
 ***  ***    ****    *******   *******     ***                *   *      ***     ******    *******     *** **      

blabla999

Posted 2014-02-06T13:44:36.933

Reputation: 1 869

You have to only use ' '(spaces) and '#' characters(also newline characters). – Mukul Kumar – 2014-03-07T03:32:31.943

my mistake; the output was from a previous run; the code is correct "{$#.$ }at:p+1". – blabla999 – 2014-03-17T16:26:30.417

0

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?"#":" ");}}

Transmission

Posted 2014-02-06T13:44:36.933

Reputation: 71

-1

"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...

Floris

Posted 2014-02-06T13:44:36.933

Reputation: 145

Personally, I would consider this cheating. – The Guy with The Hat – 2014-02-07T22:40:32.480

@RyanCarlson yes, but it's short... – Floris – 2014-02-08T00:53:31.630

@RyanCarlson It isn't any worse than using figlet. – mojo – 2014-02-08T04:09:11.250

3How 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. – steveha – 2014-02-08T04:31:37.533

1@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.) – steveha – 2014-02-08T04:37:25.007

@steveha - The only "difference" I can offer is that this "program" is available on your computer already - no scripts to write etc. Those operations would be additional key strokes that you would have to count. This - no extra key strokes needed on your computer. I agree it is a weak defense, but not much worse than banner or others like it. Agree with your suggested improvement of the question though. – Floris – 2014-02-08T12:59:16.983

@steveha The reason I wouldn't use figlet or banner is because they do all the ASCII art work for you. It seems like that was the heart of the challenge. "Cheating" might be an overstatement, but I wouldn't consider my own entry very legitimate if I used it. – mojo – 2014-02-08T14:01:39.373

I'd agree that this is a cheeky/cheaty solution, but I will note that you must have an http:// as part of the URL. Just because your fancy browser hides it doesn't mean it's not there. :) – Sean Allred – 2014-02-09T05:36:56.743

1@Floris You can transform your answer in a shell one: curl floris.us/h ;-) – Ionică Bizău – 2014-02-09T14:26:08.807

@IonicăBizău - thanks for that suggestion! It does indeed work! – Floris – 2014-02-09T14:31:51.587

-4

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.

Taku

Posted 2014-02-06T13:44:36.933

Reputation: 37

3

You could save two chars by just dropping the py. Also, there's no need to quote 3x5.

– Ilmari Karonen – 2014-02-07T23:29:33.883

7Big rule abuse, nothing even remotely similar to golfing. – Tomas – 2014-02-09T14:05:11.993

1No need for any of those quotes – Kevin – 2014-02-09T16:53:39.477

1Why not just compile one of the other solutions in this post, and give the binary a one character name? – The111 – 2014-02-09T21:43:08.230

I provided this answer seeing others use bash+banner and bash+figlet, both external tools. If that's rule abuse, my other answer uses python 2.7 with pyfiglet. Is using an established library discouraged/prohibited? – Taku – 2014-02-10T08:16:54.163

1Taku, the purpose of code golf should be to write a short program that solves the problem, not just call another program or library or whatever that already solves the very problem! Otherwise we might get to the extreme @The111 mentions. Well, it's a hole in the rules, it's your decision to abuse it or not. But think why did you get zero upvotes.. – Tomas – 2014-02-10T10:23:20.263

2I 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 :) – Taku – 2014-02-10T10:30:06.880