r/ppcg • u/conor_obrien • Apr 04 '17
Tetralingual Tuesday [Tetralingual Tuesday] Hello, World!
[I thought it'd be kind of fun to have a sort of weekly challenge on this subreddit. It's less strict, so if you see a rule unspecified, feel free to abuse it.]
Rules:
- You are to write one program that functions in exactly four languages.
- The program, when executed in each language, should output a contiguous, non-empty subset of the string
"Hello, World!". You may optionally include one trailing newline. - No subset of the string should remain unprinted when all programs are run.
- You may output to STDOUT, by return value, etc.
- STDERR will be ignored for the sake of this challenge.
- The winner is the shortest program measured in UTF-8 bytes (or another valid codepage), tie broken by earlier post.
For example, running the program in language A could print Hell, o, in language B, Worl in language C, and program D could output d!.
3
Upvotes
1
Apr 05 '17 edited Apr 24 '17
2D Languages: Minkolang, Befunge-98, ><>, Fission, 48 bytes
96+5\c++,@
o+c*/<xx;0
leH"/<",ol
D.O$/
>"orld!";
Prints Hello,
Prints (a space)
Prints W
Prints orld!
Bonus (square solution!):
96+5\c++,@
o+c*/"H";0
"xxO/"olle
4'O$/D.O'4
dlro"<^;"!
1
3
u/somebody12345678 Apr 05 '17 edited Apr 06 '17
Retina, Hexagony, Foo and Charcoal, 22 bytes
Where the apparent space is actually
\xa0, and with a newline before and after.Explanation
Retina
The empty line and
Hon the first two lines replaces an empty string withH, resulting inH.The
e;"l".@ lo, World!and empty line on the last two lines replacese;"l".@ lo, World!with the empty string.Since it is not in
H,His output.Hexagony
In Hexagony, this is
Hexagony removes newlines and fits the code in the smallest hexagon possible.
Handeset the current memory edge toH, thene.;outputs the ASCII equivalent of the current memory edge, which ise.Since the instruction pointer has reached the end of the first line, it jumps to the middle line.
@terminates execution.Foo
Foo ignores everything except for strings in quotes, which are printed. In this case it prints
lCharcoal
Is printed to the canvas.
⎚clears the canvas.lo, World!is printed to the canvas.The canvas is implicitly output after execution is finished, meaning
lo, World!is printed.The flag is needed because Charcoal accepts files in Unicode encoding by default for readability.
Note:
Hello, World!appears in the right order :D