Shortest Sorted Hello World

28

1

Write a program that takes no input and prints Hello, World! to stdout or your language's closest alternative. The catch is that each line in your program must only contain printable ASCII characters and it must be in lexicographical order, a.k.a. sorted.

Here are all 95 printable ASCII characters in order:

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

So, for example, the line !!A0~ would be invalid because the A and 0 are out of order. The line !!0A~ would be valid.

Each line in your program may be any length and there may be any number of lines. Empty lines are considered sorted. Each of the newlines in your program must be the same (no mixing \n and \r\n). Tabs and other non-printable ASCII characters are forbidden.

Due to popular demand, the win condition has been switched around:
The submission with the fewest lines wins. Tiebreaker goes to the shortest program (newlines count as single characters).

Only Hello, World! and an optional trailing newline should be output. Note that HQ9+ is invalid since it outputs hello, world. I may forbid languages similar to HQ9+ that have one character "Hello, World!" commands due to their triviality.

Hint:

This is definitely possible in Unary and Lenguage, though not very concisely.

Calvin's Hobbies

Posted 2015-03-27T03:51:34.733

Reputation: 84 000

7It's a bit late now, but somehow I feel like least lines then fewest bytes might have been more interesting... – Sp3000 – 2015-03-27T04:37:11.563

6@Sp3000 We'd need a combined measure, or else Unary and Lenguage would mean that only 1-liners could compete. – isaacg – 2015-03-27T04:44:24.293

@Sp3000 Maybe, I just wanted to make sure Unary/Lenguage weren't likely to win. I'm open to changing it though (sorry isaacg). Upvote Sp's comment if you agree. – Calvin's Hobbies – 2015-03-27T04:46:07.603

@Sp3000 I've taken your advice. See updates. – Calvin's Hobbies – 2015-03-27T06:05:17.613

Can the order be inversed? For example, reading from left-to-right? – Ismael Miguel – 2015-03-27T11:53:30.137

@IsmaelMiguel No – Calvin's Hobbies – 2015-03-27T11:55:22.473

@Calvin'sHobbies That made things dificult for me, but I managed it! – Ismael Miguel – 2015-03-27T12:22:38.820

Can you please define "or your language's closest alternative"? Does this mean if a language has a specific and different string it generally prints to show its functionality, we can do that instead? – mbomb007 – 2015-03-27T21:59:24.587

@mbomb007 The alternative is in place of stdout, not Hello, World!. Some languages don't really have a standard output stream (e.g. for Javascript I'd accept alert or console.log). – Calvin's Hobbies – 2015-03-27T22:04:42.937

Neither of those are sorted though. – mbomb007 – 2015-03-27T22:44:04.413

@mbomb007 I know, I was just giving a general example of an stdout alternative. – Calvin's Hobbies – 2015-03-27T22:47:15.563

This can be used for testing if your code lines are truly correctly sorted: http://ideone.com/knuIEL

– skagedal – 2015-03-30T14:38:49.337

Trust me, Unary isn't going to win, because of Headsecks. – mbomb007 – 2015-03-30T16:25:12.520

Why are "Hello World!" questions so popular, when many more important questions are unsolved – bacchusbeale – 2015-04-05T09:46:30.690

Answers

18

Headsecks, 1 line, 366 bytes

                                                                        $(((((((((((((((((((((((((((((,000000044888<AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADIIIIIIIIIIIILPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPTXXXXXXXXXXXXXXXXXXXXXXXX\```diiiiiilqqqqqqqqtyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy|

Headsecks is a trivial Brainfuck substitution where the only thing that matters is the code point modulo 8. The equivalent Brainfuck is merely

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------.

Luckily this naive approach just fits. There's some potential for golfing down bytes, but it might be hard.

Tested using this Python interpreter.


Generating code

code = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------."
command_map = "+-<>.,[]"

last_point = 32
out = []

for char in code:
    curr_mod = command_map.index(char)
    last_mod = last_point % 8

    if curr_mod > last_mod:
        last_point += curr_mod - last_mod

    elif curr_mod < last_mod:
        last_point += (8 - last_mod) + curr_mod

    out.append(chr(last_point))

print("".join(out))

Sp3000

Posted 2015-03-27T03:51:34.733

Reputation: 58 729

That was clever! +1 – theonlygusti – 2015-03-29T15:29:18.230

Could you use a shorter BF program, or is the program built a specific way for a reason? I tried my the BF program I used in your generator, but the output included some unicode. – mbomb007 – 2015-03-30T16:29:29.093

1@mbomb007 The problem with shorter BF programs is that even this naive method ends at code point 124, so I don't think there's enough wiggle room to introduce new chars... – Sp3000 – 2015-03-30T16:47:56.807

30

///, 7 lines, 22 bytes

/
//Hello
,
 Wor
l
d
!

A rare chance for /// to be competitive (well as long as no one starts with Unary and Lenguage...).

The code first encounters a /, and parses the

/
//

as a substitution instruction which removes all newlines from the remainder of the program. Afterwards, the program merely reads

Hello, World!

which is printed verbatim as it doesn't contain any further slashes.

Martin Ender

Posted 2015-03-27T03:51:34.733

Reputation: 184 808

19I didn't even realize that URLs could contain that many slashes in a row. – Alex A. – 2015-03-27T14:35:22.513

4@AlexA. It took months to get that URL working, IIRC. We had to keep renaming the article to deal with changes to the server configuration and MediaWiki configuration. – None – 2016-11-19T01:16:04.290

17

JavaScript (67 66 62 lines, 227 269 bytes)

(Note: only tested on Firefox 36 and Safari 8, contains minor ES6 features (the Set class))

Z
=
!""+
(0[[]]
+
(
!!""+Set
));c
=Z[~
-22]
$=Z[
3]
$$=Z[
15]
$$$=Z[
24]
$$$$=Z[
1]
$$$$$=Z[
0]
Set
[c
+
$$$+Z[
5]
+Z[
16]
+
$$$$$+
$$$$+Z[
2]
+c
+
$$$$$+
$$$+
$$$$]
(Z[
14]
+
$$+
$+
$$$$+
$$$$$+
"(\
'H\
"+
$+
$$+
$$+
$$$+
",\
 W\
"+
$$$+
$$$$+
$$+Z[
6]
+
"\
!')\
")
()

The code above basically does:

alert("Hello, World!")

Obviously alert is not sorted. So instead we need to generate the statement as a string, and "eval" it:

s = "alert('Hello, World!')";   // generate this using sorted code
eval(s)

How to generate the string? ES5 supports line continuation so that

"AL\
ERT" === "ALERT"

But the character code \ appears before all lowercase letters, so we have to generate the lowercase letters using other methods.

We borrow some idea of JSFuck here. The lowercase letters involved in the alert statements are:

t e r a o l d

all of these can be extracted from characters of standard objects, which may be expressed in terms of some sorted sequence:

t, e, r ← true      = !""
a, l    ← false     = !!""
o       ← function  = Set
d       ← undefined = 0[[]]

How do we evaluate the string? Surely we cannot use eval(s) as it is not sorted. Alternatively we could use Function(s)(), but we cannot use Function as it is not sorted either. However, Function is the constructor of all functions, which means Set.constructor === Function.

Adding the identifier constructor makes the list of lowercase letters become:

t e r a o l d c u n s

which fortunately could still be generated by "truefalseundefinedfunction":

t, e, r, u ← true      = !""
a, l, s    ← false     = !!""
o, c, n    ← function  = Set
d          ← undefined = 0[[]]

After prettifying, the code above should read like:

// lines 1~8 defines our string containing all lowercase letters we want
Z = true + (undefined + (false + Set))
// Z = "trueundefinedfalsefunction Set() { [native code] }"

// lines 8~20 defines the variables `c`, `$` (e), `$$` (l), `$$$` (o), 
// `$$$$` (r), `$$$$$` (t)
// for the corresponding lowercase letters extracted from `Z`

// the rest calls:
Set["constructor"]("alert('Hello, World')")()
// lines 22~36 generates the "constructor" string
// lines 37~61 generates the "alert('Hello, World')" string

Update: Renamed E, L, O, R, T to various repetition of $ to reduce 4 lines.

kennytm

Posted 2015-03-27T03:51:34.733

Reputation: 6 847

2Absolutely brilliant! I sure don't know if this is possible to use the same time of strategy in Python (it's case sensitive). – mbomb007 – 2015-03-29T00:54:08.477

Very nice! Note that =Z[3*7] can be written as =Z[~-22] which only needs one line break instead of two. – me and my cat – 2015-03-30T00:14:42.693

@mbomb007 Yeah, but spaces are and they're first in the ASCII set... – Harry Beadle – 2015-03-30T09:15:25.373

@meandmycat Thanks! Updated. – kennytm – 2015-03-30T10:10:25.997

13

Insomnia, 4 lines, 59 bytes

 FFFFGjnnnnooty
FLLddeejkopqyyyyy~~
(<ddjnoppppqrtu
<<Fddfj

This program is generated by optimizing for line count.

10 lines, 43 bytes

(u
pt
(dppty
p~
j
<Fptt{
(otz
?o
FLu
<?FFu~

This above program is generated by optimizing for byte count.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2015-03-27T03:51:34.733

Reputation: 5 683

11

Cygwin bash, 16 lines, 60 bytes

This only works due to the case-insensitive file name on Windows, and the fact that Cygwin look up the utilities case-insensitively even if you don't set it to recognize path case-insensitively.

A\
=Hello
A\
+=\
",
"Wor
A\
+=l
A\
+=d
A\
+=\
!
E\
CHO\
 $A

Take note of that ECHO at the end.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2015-03-27T03:51:34.733

Reputation: 5 683

I'm not sure if this is 17 or 16 lines (there is a new line at the very end), but either way, this is not going to win anything. – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ – 2015-03-27T14:43:15.263

You won 10 upvotes, that's a lot already. The most upvoted ones (as of now) have 12 upvotes! And the /// solution with 23 upvotes. – Ismael Miguel – 2015-03-30T08:52:52.460

11

><>, 6 lines, 111 bytes

  """""""/;;Hello
        &\o
      &++\oooo~~
"++++++++\bbbdlr
    +++++\ccccccccfooo}
    $++66\cfffffooooopr

I'm having trouble golfing out an extra line, but in any case I'm happy to have beaten the 7-line method.

Explanation

><> is a stack-based 2D language where instructions are single chars and program flow can be up, down, left or right. The " instruction toggles string parsing, pushing chars until a closing " is met, but because of the nature of ><> there's no such thing as "multi-line string parsing" like with CJam's strings or Python's triple quoted strings. This turned out to be a major problem because starting and ending a line with a " and having other chars in between (e.g. "some chars") is not allowed!

Note that / and \ reflect program flow, so we actually execute the first line then all of the lines in reverse order, and most lines are actually executed backwards!

[Line 1]

""""""              Three empty strings, push nothing
"/;;Hello  "        Push "/;;Hello  ". Note the wrapping - ><> is toroidal!
""""""              Three empty strings, push nothing

[Line 6]
66++$               Turn the top " " into "," by adding 12, then swap top two
rp                  Reverse stack and pop top 3
ooooo               Print "Hello", stack is now " ,"
fffffc              Push some 15s and a 12

[Line 5]
+++++               Sum the 15s and 12 to give 87, or "W"
}ooo                Move "W" to the back and output ", W"
fcccccccc           Push a 15 and some 12s

[Line 4]
++++++++            Sum the 15 and 12s to give 111, or "o"
"rldbbb\++++++++"   Push chars to stack
r                   Reverse stack
ld                  Push length of stack and 13, not used
bbb                 Push three 11s

[Line 3]
++&                 Sum the 11s to give 33, or "!" and put in register
~~                  Pop top two
oooo                Print "orld"

[Line 2]
&                   Put "!" from register to stack
o                   Print "!"

[Line 1]
;                   Terminate

On a side note, here's an amusing attempt at a ><> least bytes (23 lines, 47 bytes):

v
"
!
d
l
r
o
W

,
o
l
l
e
H
"
/<
l
?
!
;
o
\^

Sp3000

Posted 2015-03-27T03:51:34.733

Reputation: 58 729

2

In the second code you can save 2 bytes thanks to vertical wrap-around: http://pastebin.com/heqCr1vJ

– randomra – 2015-03-28T22:57:16.360

10

CJam, 5 4 lines, 162 bytes

"Hello
")))))))))))))))))))))))))))))))))))68S\cel
"Wor
")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))@SX\c|

Same number of lines as Insomnia! (but a lot more bytes)

Try it online.

Explanation

"Hello\n"        Push "Hello" and a newline
)                Uncons the newline
)))...)))        Increment the newline into a ","
68S\             Push 68 and a space then swap, leaving 68 on top
c                Convert 68 into a char "D"
el               Lowercase "D" into "d"
"Wor\n"          Push "Wor" and a newline
)                Uncons the newline
)))...)))        Increment the newline into an "l"
@                Rotate top three elements, moving the "d" to the top
SX\              Push a space and 1 then swap, leaving the space on top
c                Convert the space (which is an array) into a char
|                Bitwise or the space (32) with 1 to give "!" (33)    

CJam automatically prints the stack afterwards.

Thanks to @Optimizer for reminding me that Sc works, because otherwise SX| fails (it does a setwise or instead, giving the array consisting of a space and 1).

Sp3000

Posted 2015-03-27T03:51:34.733

Reputation: 58 729

8

PHP (7 / 17 lines, 36 / 59 bytes):

Due to the amount of invalid answer, I rewrote this answer.

The browser version? Gone.

But I have 2 solutions, both based on bitwise xor (^) of strings in PHP.

This is an extremely powerful solution! Sometimes, it allows to save plenty of bytes.

First, the shortest answer:

Echo
Hello
,AM^mm
,Wor
,OOO^
"#+n
";

I know, it looks awful, but it works!

The next one depends on newlines.

Yes, it uses newlines (\n/UNIX style is required)!

Echo
Bo
.ff
.e
.
"&*]ex
fn
"^
"\n
\n
\n
\n
\n
\n
\n
",B^c
;

The newlines on this one are required to work.

It isn't perfect, but works!


Both answers were based on @MartinBüttner's solution:

Echo
Hello
.
chr
(44
).
chr
(29
+3
).Wor
.l
.d
."!
";

A special thank to @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳, @CJDennis, @MartinBüttner and @skagedal for detecting all my mistakes and for their suggestions.

Ismael Miguel

Posted 2015-03-27T03:51:34.733

Reputation: 6 797

@n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Thank you a lot for that. I totally forgot to check a 8th time. I've fixed it now. – Ismael Miguel – 2015-03-27T13:02:20.580

@MartinBüttner I call that bizarre, since browsers usually remove the newlines. – Ismael Miguel – 2015-03-27T13:42:05.870

1The output in the browser is Hello , Wor l d !. Note the extra spaces! This is not a valid answer, unfortunately. – CJ Dennis – 2015-03-30T08:13:01.700

@CJDennis Can you tell me the browser you used? – Ismael Miguel – 2015-03-30T08:25:34.740

1Tested in Firefox 36, IE 8, Opera 12.17 & Opera 28 (Chromium) on Windows XP. All rendered the output identically. Since any number of whitespace characters are rendered as a single space character (barring no break space, etc.) each newline gets converted to a space. I would be interested to know if any browser renders your output without spaces! – CJ Dennis – 2015-03-30T08:37:51.163

@CJDennis I've fixed it now. It's a monster, but works as expected. I'll call it frankencode (after Frankenstein). – Ismael Miguel – 2015-03-30T08:38:57.033

@MartinBüttner I may sound like a stubborn child, but there is nothing saying that the output can't be the rendered output. Also, I make it explicit that it only works in a web-browser. And the rendered output matches exactly what is required. I really appreciata a lot your solution and I will add it as an alternative answer ans suggestion with the due credit. – Ismael Miguel – 2015-03-30T09:07:13.217

@MartinBüttner I've reduced your code. If you want to update the pastebin, feel free to do so. – Ismael Miguel – 2015-03-30T09:21:07.163

1Nice abuse of the language! Since the errors it generates technically go to stderr and not stdout, your code is now valid even though in my case I see a lot of errors in my browser! And, incredibly nit-picky, my PHP setup has short tags off so the first line on my computer is <?php which is invalid! However, I'll forgive you for this! OK, just tested <?Php which works, so I've just learnt that the start tag is case-insensitive! – CJ Dennis – 2015-03-30T10:45:14.187

You can save 5 characters and one line in your browser version by removing the <br> as the newline is optional. – CJ Dennis – 2015-03-30T11:01:00.800

@CJDennis I can put there the 'long' tags if you wish. Or I can go crazy and use the <script language="php"></script> tag (Yes, it works too!). But I'm happy with the result. Actually, I could drop the echo entirelly, if instead of <=>? the order had the ? between < and =. Also, I can't drop the <br>. If I leave the <br> out, the browser will render a space at the end, instead of a new line. According to the rules, that is invalid. The errors generated are because the constants Hello, Wor, l and d don't exist and PHP is warning that it is assuming them as a string. – Ismael Miguel – 2015-03-30T11:31:42.283

1The top two solutions in this answer do not follow the rules. The top one has, as line 8, ."!<br - this is not sorted. The second one has as line 10: ."! - not sorted. – skagedal – 2015-03-30T14:27:55.963

@skagedal It is indeed badly sorted... I'm trying to find a fix for it and I'm preparing an update, 'cause this answer is getting a mess with so many edits. – Ismael Miguel – 2015-03-30T15:02:55.453

@skagedal I've rewritten the whole answer and it is clean now. I'm sorry for the delay. – Ismael Miguel – 2015-03-30T23:09:32.340

1@IsmaelMiguel I'm sorry, but no. Line 7 of the first suggestion is not sorted. Lines 5 and 7 of the second suggestion are not sorted. – skagedal – 2015-03-31T06:06:31.297

@skagedal Thanks for pointing out. Now they are fixed. But I'm not happy with the fix. I'll look for a better one. – Ismael Miguel – 2015-03-31T08:10:42.987

@skagedal Now they are correct. I've managed to reduce 2 lines from the first answer. The last one will be harder, but it was also just meant as an alternative. The idea was to use as many newlines as possible. But once again, thanks for pointing that out. It was a bit late when I made the edit, so, I kinda expected to mess up somewhere. – Ismael Miguel – 2015-03-31T08:17:06.043

1@IsmaelMiguel The first solution now has correctly sorted lines! :) Line 6 of the second still doesn't work. – skagedal – 2015-03-31T11:07:04.000

@skagedal You are correct once again. The fix was easy: Just swapped quotes! Since the order is "#$%&, this now is correct. – Ismael Miguel – 2015-03-31T11:10:56.573

@IsmaelMiguel Good job! :) – skagedal – 2015-03-31T11:49:45.087

@skagedal Thank you. Sadly, I only saw your python code 20 minutes ago. Kinda late on the run, but surelly helped me to check once again if I had screwed again or if everything was well ordered. – Ismael Miguel – 2015-03-31T11:55:22.417

8

><> (Fish), 5 lines, many bytes

The code is extremely long, when I say [6535529689086686142930090 '+' signs] and [6535529689086686142930090 'd' characters] in the first line of the code, I mean that there are literally 6535529689086686142930090 plus signs in a row!

(And for the following lines add the necessary prefix spaces.)

'[6535529689086686142930090 '+' signs]^`[6535529689086686142930090 'd' characters]
                                   **,/288
                                     -/:o
                             %**288:;?\
                                   (1:\

A shorter testable alternative which only prints Hi:

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++^`hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
                                                                                                                               **,/288
                                                                                                                                 -/:o
                                                                                                                         %**288:;?\
                                                                                                                               (1:\

Method:

  • In the first line we create a huge number representing the string in base128.
  • In the rest of the lines (going from bottom to top) we print the following character in every loop until the value of the integer reaches 0.
  • The looping code is :1(?;:882**%:o-288**,.

(We can print arbitrary 2+ chars long string with this method.)

randomra

Posted 2015-03-27T03:51:34.733

Reputation: 19 909

Not a valid solution; 6535529689086686142930090 is not ordered. – theonlygusti – 2015-03-29T15:23:14.533

@theonlygusti "The code is extremely long, interpret [6535529689086686142930090 '+' signs] and [6535529689086686142930090 'd' characters] literally in the first line of the code." (If unclear what I mean by that check the second piece of code.) – randomra – 2015-03-29T16:25:17.530

Oh, okay! Sorry, silly me :P I took it literally. – theonlygusti – 2015-03-29T16:29:58.050

2Size is 13 YB, roughly 1000 times the size of the Internet. – Charles – 2015-03-30T15:37:21.060

@Charles I get ~40YB including the latter lines. – Veedrac – 2015-03-31T15:42:14.263

@Veedrac You don't know what a "YB" is, do you. Yottabyte

– mbomb007 – 2017-03-22T16:21:58.797

@Yottabyte I don't know what Veedrac of March 31, 2015 was thinking, but he obviously wasn't thinking straight. – Veedrac – 2017-03-22T19:44:54.617

7

Pyth, 7 lines, 23 bytes

-
"Hello
,
 Wor
l
d
!"b

Pretty simple, just use a multiline string and remove the newlines.

Try it here.

isaacg

Posted 2015-03-27T03:51:34.733

Reputation: 39 268

@orlp I added multiline strings a few days ago, and Pyth has had support for newlines in the input for ages. This doesn't use multiline mode at all. Try it on the online compiler, which definitely has no multiline mode. – isaacg – 2015-03-27T04:14:46.067

2Its almost the same in CJam, with same byte count too. – Optimizer – 2015-03-27T06:00:19.890

4

Forth, 41 lines, 143 bytes

Try it online.

I'm very proud of this. I whipped it out pretty quickly once I found I could do it, having Google searched for case-insensitive languages, and I already know Forth decently. It can almost definitely be shortened, both bytes and lines. Suggestions are appreciated. :D

This program essentially pushes the decimal value of each ASCII character, then prints each one. I attempted to optimize while I wrote it, hence it is less readable than I'd like.

33
99
1
+
DUp
8
+
2DUp
6
+
SWap
11
+
2OVer
SWap
8
9
*
EMit
1
+
EMit
DUp
DUp
EMit
EMit
3
+
EMit
29
3
2DUp
+
EMit
*
EMit
EMit
EMit
EMit
EMit
EMit

mbomb007

Posted 2015-03-27T03:51:34.733

Reputation: 21 944

The Emit lines don't work, as i (105) is less than m (109). – bcsb1001 – 2015-03-29T19:25:13.143

It should be "EMit", then? – skagedal – 2015-03-30T13:33:00.393

4

Marbelous, 9 lines, 94 bytes

3333
    @ADD
    358C
++--29\\
++--3555DE
<<<<<<>>~~
+++++446666D
++++++++../\
      ++------

Test it online here. Using spaces for blank cells must be checked.

Visual representation of source:

Visual representation of above source

Explanation: Each hexadecimal value in this program moves downward every "tick" (unless it is on \\, in which case it moves to the right). ++ will increment the value, -- decrement, ~~ apply a bitwise not, etc. Values that fall of the bottom are printed as an ASCII character.

For example: The 33 in the top corner becomes (((0x33 +1 +1) << 1) +1 +1 = 0x6C (l).

es1024

Posted 2015-03-27T03:51:34.733

Reputation: 8 953

2

Rebol - 15 lines (51 bytes)

PRin
AJOin
[
'Hello
Sp 
+
12
Sp
'Wor
'l
'd
Sp
+
1
]

Words in Rebol are case-insensitive (eg. PRINT, Print and print would all call the same function).

The above code tidied up:

prin ajoin [
    'Hello  sp + 12  sp  'Wor  'l  'd  sp + 1
]

NB. sp returns the space char!

draegtun

Posted 2015-03-27T03:51:34.733

Reputation: 1 592

Your program is invalid, the { can't be before any letters. – theonlygusti – 2015-03-28T15:29:43.457

@theonlygusti - Fixed (gone from 9 lines to 13). The only line that caused me a problem was {,}. This is now Sp + 12 (over 3 lines) which is equivalent of space character + 12 (ie. comma) – draegtun – 2015-03-29T13:07:51.187

2

Perl, 17 lines

$_
=
'pr
int
"Hello
,
 Wor
l
d
!"';s
!
!!g
;s
!.
*
!$&
!eex

nutki

Posted 2015-03-27T03:51:34.733

Reputation: 3 634

2

Unary, 1 line, lots of bytes

Every character in this program is 0. The source is too long to put in here, but it consists of a string of this many zeros:

327380789025192647555922325233404088310881092761595127419003295178342329930050528932118548

This is the decimal representation for this binary number:

0b1010010010010010010010010110000010010010010110000010010000010010010000010010010000010001001001001011111000010000010000011110001111001011111000000100000011011011100010010010010010010010100100010010010100000000100001011100001100010010010100011011011011011011100011011011011011011011011100000000010100

Which was created from this BrainF*** program:

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

See how I generated it: http://ideone.com/lMT40p

mbomb007

Posted 2015-03-27T03:51:34.733

Reputation: 21 944

2

Batch - 39 Lines (202 bytes)

I wanted to cut down on the size by enabling delayed expansion by running the code inside of a cmd call using the /v on switch, but could not get past all the carats.

@S^
ET^
LO^
C^
AL^
 EN^
ABL^
E^
DEL^
AY^
E^
DEX^
P^
ANS^
IO^
N
@S^
ET^
 0=Hello
@S^
ET^
 1=^
,^
 Wor
@S^
ET^
 2=l
@S^
ET^
 3=d
@E^
CHO^
 !^
0^
!!1^
!!2^
!!3^
!^^^
!

Without the newlines (and carats to escape newlines):

@SETLOCAL ENABLEDELAYEDEXPANSION
@SET 0=Hello
@SET 1=, Wor
@SET 2=l
@SET 3=d
@ECHO !0!!1!!2!!3!^^!

unclemeat

Posted 2015-03-27T03:51:34.733

Reputation: 2 302

1

Ruby, 19 lines, 95 bytes

$;=
$>
$;<<
:Hello
$;<<
44::chr
$.=
33::
-1
$;<<
$.::chr
$;<<
:Wor
$;<<
:l
$;<<
:d
$;<<
33::chr

Possibly the second-hardest code restriction for Ruby I've seen on this site, after the monstrosity here.

Edit for explanation: The only Ruby output method that's sorted is the << method on STDOUT. Unfortunately, the constant for STDOUT is $>, and > is higher ASCII than most symbols, so it's not really possible to call a method on it. We need a multi-line assignment statement to get it into a more tractable variable name, $; (semicolon is still pretty high, but most variables of this form are either non-assignable, or can only be strings).

Symbols (:Wor, etc. ) are the easiest way to do a literal, and I don't see a way to strip newlines from a string, so I need multiple print statements. The space and punctuation can't go into a symbol literal, but luckily the chr method on numbers is legal, so I can get a character from its ASCII value. :: is an alternate way of calling methods. Space is tricky because I can't write 32, so I subtract 1 from 33 and assign it to a variable.

histocrat

Posted 2015-03-27T03:51:34.733

Reputation: 20 600

0

Retina, 12 lines, 29 bytes (non-competing)

The language is newer than the challenge.


Hello
$
,
$
 Wor
$
l
$
d
$
!

Try it online

mbomb007

Posted 2015-03-27T03:51:34.733

Reputation: 21 944