# “Hello, World!” (Robbers' thread)

This is the robbers' thread. The cops' thread is here.

Your challenge is to take an uncracked submission from the cops' thread and find, for what input or inputs, the program will print Hello, World! and a newline. Capitalization, spacing, and punctuation must be exact.

Please comment on the cop's submission when you've cracked their code.

# TeX, by A Gold Man

Original source:

\read16to\x\message{Hello, World!}\bye


This already prints Hello, World!, but the newline is missing. The input is just placed in \x which is never used. In order to be able to modify the output, I guess we need to do some preparations (like, "lay a trap") before calling this code, so \x is actually expanded. It can be done when invoked like this (assuming the original source is in x.tex in the current directory):

tex '\def\vfill{\x}\input./x'


This first redefines \vfill (which is part of the expansion of \bye) to expand to our \x, so now we can provide some input printing the missing newline:

\newlinechar=@\message{@}


This sets the character used for newlines in \message to @ and immediately uses it.

This whole thing modifies the environment the original program will run in, so if there are any objections to this method, I'll retract it.

• Not what I had in mind, but very clever. The intended solution is way more evil. I'll consider myself cracked. – A Gold Man Aug 8 '17 at 20:23
• Just for the record, I thought that you were going to \let \message to \relax, which would then typeset the hello world with a newline (implicitly). But this is way better. – A Gold Man Aug 9 '17 at 7:10
• @AGoldMan There's an ongoing meta discussion about what form of input is allowed, I posted an answer for discussion there about your cop. If you're sure your intended solution works with any TeX implementation, I'd say feel free to consider my crack invalid and you're probably on a straight line to winning the cop part of this challenge (and I might score second as noone attempted to crack my C64 code so far, hehe) – Felix Palmen Aug 9 '17 at 7:17

Brainfuck by 2EZ 4RTZ

Correct input: Gdkkn+\x1fVnqkc \x09\xff, where \xHH indicates non-ASCII-printable hex character.

Explanation:

You just take the character codes of "Hello, World!\n" and subract one from each value. The last character \xff (255) causes the program to exit after you add one (since the 255+1 overflows to 0 and the loop exits).

• Darn, I had this crack but couldn't get it working on TIO ;-; +1 – MD XF Aug 8 '17 at 22:01
• Yeah, TIO doesn't work, that's what had me tripped up all this time. – totallyhuman Aug 8 '17 at 22:01
• Is this valid as the interpreter linked is specifically TIO? (on which 0xFF doesn't work from what I've tried) – dzaima Aug 8 '17 at 22:02
• I wrote a BF interpreter for fun once, so I passed input from a C program where I could specify hex inputs : ) – rexroni Aug 8 '17 at 22:03
• @dzaima lol TIO doesn't work. I just linked it since lazy. – Christopher Aug 8 '17 at 22:18

# ><> by Not a tree

This was an EPIC puzzle! I loved it!

Example solution:

TIHANICWHITEOCPSEARK

Wish I could upvote Not a tree's post three more times.

• Does anybody know if it is possible to add a hidden answer that contains a block of code/preformatted text? – rexroni Aug 9 '17 at 16:37
• Well done! Your solution isn't identical to mine, but it's functionally the same. I'm glad you enjoyed the puzzle! – Not a tree Aug 10 '17 at 0:12
• And you can make a hidden codeblock (with difficulty) by surrounding it with <pre><code> ... </code></pre> instead of the usual four-spaces method, and using &#10; instead of newlines. – Not a tree Aug 10 '17 at 0:16

# Perl 5, by Chris

Original code:

eval<>;END{print$x='x'}  Input: our$x;package X;require Tie::Scalar;@ISA=qw(Tie::Scalar);sub TIESCALAR{my$v;return bless\$v,'X';}sub STORE{}sub FETCH{return "Hello, World!\n"}tie $x,'X';  I'm not sure this is the intended solution. It works by changing the behavior of $x using a tie. The tie here is very simple, ignoring any STORE access and returning our desired output for any FETCH.

Try it online!

• Pretty much my intended solution, yes. – Chris Aug 8 '17 at 8:20
• I thought this was not cracked (forgot to refresh the cop thread), so I found this (simple) solution : print"Hello, World!\n";close(STDOUT);. – LP154 Aug 8 '17 at 10:09
• That's a nice trick! – Felix Palmen Aug 8 '17 at 10:19

# JavaScript (ES6), Voile

Input:

!(v.call=()=>true)||"()=>Hello, World!\n"


Cop code:

const e=eval,p=''.split,c=''.slice,v=[].every,f=s=>(t=c.call(s),typeof s=='string'&&t.length<81&&v.call(p.call(t,\n),l=>l.length<3)&&e(t)(t))


Try it online

This overwrites the v.call() method to always return true, but that part of the input is falsified and discarded for the string part which passes the string type check and length check, and eval's to the desired output Hello, World!\n`.

If Birjolaxew's crack is not accepted, maybe this one will.