24
\$\begingroup\$

This challenge sounds too simple to not already exist, so let me know if it is a duplicate.

The task

Print Hello, world!

The rules

Your code has to be in "byte order". This means that every character / byte has a higher or equal byte value than the preceding character / byte.

Exceptions to this rule are the whitespace characters, which may occur anywhere.

The usual loopholes are not allowed.

Edit: Using built-in functions / constants resolving to Hello, world! is not allowed.

Edit 2: The output may be a(n anonymous) function returning the string, an expression resolving to the string, or any other way you think should be allowed.

example

HW is valid: 0x48 (H) <= 0x57 (W)
print is invalid: 0x72 (r) > 0x69 (i)
but PRint is valid: 0x50 (P) <= 0x52 (R) <= 0x69 (i) <= 0x6e (n) <= 0x74 (t)

The scoring

This is so the score is the number of characters / bytes. The lower the score, the higher the ranking.

\$\endgroup\$
11
  • 10
    \$\begingroup\$ There are many languages with 1-byte Hello World built-ins. Some may even print Hello World for an empty program. \$\endgroup\$
    – Dennis
    Mar 18, 2017 at 20:09
  • 2
    \$\begingroup\$ Very closely related. (The difference is that that one allows each line to be sorted independently, and that it's primarily scored by the number of lines.) \$\endgroup\$ Mar 18, 2017 at 20:09
  • \$\begingroup\$ @Dennis Added an extra rule because of that! Thanks \$\endgroup\$
    – Charlie
    Mar 18, 2017 at 20:14
  • \$\begingroup\$ Still trivial in 23, Headsecks, and Lenguage, but much longer than a couple of bytes. \$\endgroup\$
    – Dennis
    Mar 18, 2017 at 20:29
  • \$\begingroup\$ Default output like ans = Hello, world! is that OK? Otherwise, MATLAB and Octave won't be able to attempt this... disp, printf and eval are all in non-alphabetical order. \$\endgroup\$ Mar 18, 2017 at 20:34

3 Answers 3

15
\$\begingroup\$

WhiteSpace, 146 bytes

Since all whitespace may occur everywhere, this is is just the golfed Hello World program. Since whitespace doesn't show properly here, take the following program and replace all . by spaces, > by tabs and ; by newlines.

...;..>>..>.>.;..>>>>;...>;...>>>;...>..;..>>.>..;..>>..>.>>;..>>>>>>>;...>..;...>;.;...>>>.;..>>...>>;;..;.;.;>.>;...>>.>.>>;>...>;..;.;;;..>;;;;

Note

I didn't golf this, LukStorms did. His answer can be found here.

\$\endgroup\$
4
  • \$\begingroup\$ It's not in byte order. \$\endgroup\$ Mar 19, 2017 at 3:46
  • 1
    \$\begingroup\$ Indeed, but whitespace didn't have to be in byte order; it could appear everywhere \$\endgroup\$
    – Luke
    Mar 19, 2017 at 7:31
  • 3
    \$\begingroup\$ Oh. Good abuse of the rules then \$\endgroup\$ Mar 19, 2017 at 7:47
  • \$\begingroup\$ Exactly. That's also part of the reason this is community wiki. \$\endgroup\$
    – Luke
    Mar 19, 2017 at 7:48
15
\$\begingroup\$

Headsecks - 124 82 chars

Thanks to @MartinEnder for pointing me to a smaller hello-world!

Headsecks looks to be the right language for the job, because its brainfuck except that it takes each character mod 8.

 +19AISYchpx£¨°»ÁËÐÞàèðøĀĈĐĘĦīİĸŀňŐŘŠŨųŻƀƈƐƘƠƪƲƺǁǏǒǟǣǫǴǸȃȈȐțȤȫȴȼɀɋɓɜɠɫɱɹʃʉʑʞʣʩʴʺ˂ˏ

You can try it by going here: https://repl.it/G2I5/1, then here: https://sange.fi/esoteric/brainfuck/impl/interp/i.html

\$\endgroup\$
5
  • \$\begingroup\$ You need to post an actual Headsecks interpreter that will run this, not a Python program to convert to BF and a BF interpreter. Since the program contains non-ASCII, the interpreter you link to needs to handle non-ASCII Headsecks programs. \$\endgroup\$
    – mbomb007
    Mar 22, 2017 at 16:15
  • \$\begingroup\$ @mbomb007 there used to be an interpreter, but it 404s now :( esolangs.org/wiki/Headsecks \$\endgroup\$
    – Maltysen
    Mar 22, 2017 at 20:40
  • \$\begingroup\$ github.com/TieSoul/Multilang/blob/master/headsecks.py \$\endgroup\$
    – mbomb007
    Mar 22, 2017 at 20:48
  • \$\begingroup\$ @mbomb007 that one handles unicode codepoints, but not the weird wrapping tricks that the bf helloworld uses. I'll try to look for another one, or just rollback to my earlier, longer, answer. \$\endgroup\$
    – Maltysen
    Mar 22, 2017 at 20:59
  • \$\begingroup\$ Maybe someone should create an implementation, then have Dennis put it on TIO. Also, someone should edit Esolangs. I was going to, but idr my login info. \$\endgroup\$
    – mbomb007
    Mar 22, 2017 at 21:02
13
\$\begingroup\$

CJam, 784 bytes

"	 







































	 




































































	 











































































	 











































































	 














































































	 











	 	 






















































































	 














































































	 

















































































	 











































































	 



































































	 
"
"	
"')`er~

Try it online!

Not winning anything with that byte count, but this was still fun to make.

Explanation

The first large string encodes Hello, world! using only whitespace. Each character is mapped to a tab, a space, and a number of linefeeds equal to its codepoint minus 32.

Next, the string is transliterated by replacing tabs with ' and linefeeds with ). This results in many sequences of a literal space character followed by some number of increments. The string is eval'ed with ~, pushing the spaces and incrementing them to proper characters.

The stack is implicitly output at the end of the program.

\$\endgroup\$
1
  • 5
    \$\begingroup\$ Excellent, finally a truly clever answer! \$\endgroup\$ Mar 22, 2017 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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