As some of you may know, to get a language onto Dennis's wonderful Try It Online!, a Hello, World! program is required. Recently, Dennis pushed up a way to load these programs from the website. Here is a JSON pastebin of the characters used in those programs, by frequency, as of July 27, 2017.
Some of those characters need some love, so your challenge is to output Hello, World! (preferably in a language involved in this process), using only the characters specified below. These characters are all of the characters used between 10 and 99 (inclusive) times, along with the two most common characters, 0 and , because I'm feeling nice.
0 $&*?ABCDEFGIJKLNPQRSTUXYZ\`gjkqwxyz{}÷≤≥=║_
Your usage of the character should be based on its appearance in a normal program, not based on its code point or byte value.
You must use at least one character from that set, so 0-length programs are invalid.
This is code-golf, so shortest answer in bytes wins.
-
\$\begingroup\$ may I output a space in the next line? \$\endgroup\$dzaima– dzaima2017年08月01日 14:56:15 +00:00Commented Aug 1, 2017 at 14:56
-
\$\begingroup\$ @dzaima If you cannot output it without the space, do it. If getting rid of the space just uses more bytes, get rid of the space \$\endgroup\$Stephen– Stephen2017年08月01日 15:05:09 +00:00Commented Aug 1, 2017 at 15:05
-
\$\begingroup\$ Is there a community consensus (or specific dis/allowance here) on non-printing characters making their way into output (STDOUT)? Not sure I've seen it come up before (and it would be easily overlooked) but it changes my strategy dramatically here... \$\endgroup\$brhfl– brhfl2018年03月06日 15:38:07 +00:00Commented Mar 6, 2018 at 15:38
-
\$\begingroup\$ @brhfl not that I know of - the only norm is that trailing newlines are usually allowed, you could ask in chat \$\endgroup\$Stephen– Stephen2018年03月06日 23:03:47 +00:00Commented Mar 6, 2018 at 23:03
14 Answers 14
Perl 5, 76 bytes
}{${$_=$`x?B?}{?\w$?}{$_=qq{Lg\LLL$&= w$&RLD=}&qq=y}\LLL$&L _$&RLDA=}=$_=\*G
This uses a feature that has been deprecated, but works locally in my terminal (which is version 5.18.2 as noted). In older versions of Perl ?\w? is a synonym for /\w/ which gives me access to regexp matching and I have enough chars for $& (last match) and $` (text preceding last match). I need these to be able to get the O. I generate this be creating a glob reference ($_=\*G which, cast to a scalar, is something like GLOB(0x7ffb728028d0)). Once that's in $_, ?B? will match the B and $` will contain GLO, I can then match against \w$ which would store O in $& which is inserted into the strings that I'm running stringwise-AND to create the rest of the text, the body of the string is lowercased using \L.
Try it online! - uses /\w/ in place of ?\w? as the version of Perl on TIO is too new.
Perl 5, 65 bytes
This is a bit more cheaty as it relies on the filename on TIO (which is .code.tio), so I don't really think this is competing, but I was happy with the result!
}{${$_=0ドル}{?\w$?}{$_=qq{Lg\LLL$&= w$&RLD=}&qq=y}\LLL$&L _$&RLDA=}
-
\$\begingroup\$ I didn't say anything about the content of flags, so
-pis fine. Good job, this is what I was hoping for when I asked this :) \$\endgroup\$Stephen– Stephen2017年08月01日 15:51:33 +00:00Commented Aug 1, 2017 at 15:51 -
1\$\begingroup\$ how... what... the... \$\endgroup\$Okx– Okx2017年08月01日 15:53:58 +00:00Commented Aug 1, 2017 at 15:53
-
\$\begingroup\$ @StepHen I'm glad to have obliged! I did honestly really enjoy this. I'm glad you aren't penalising the flag too, I'll update my post. Thanks! \$\endgroup\$Dom Hastings– Dom Hastings2017年08月01日 17:48:51 +00:00Commented Aug 1, 2017 at 17:48
-
\$\begingroup\$ @Okx I'm glad to have had that effect! \$\endgroup\$Dom Hastings– Dom Hastings2017年08月01日 17:49:04 +00:00Commented Aug 1, 2017 at 17:49
-
\$\begingroup\$ You sure you don't need to add 15 bytes <3? \$\endgroup\$Magic Octopus Urn– Magic Octopus Urn2017年08月03日 21:47:28 +00:00Commented Aug 3, 2017 at 21:47
Unary, 7*10182 bytes
Unary is Brainfuck converted to binary converted to unary using 0 as the counter. Essentially, it condenses a Brainfuck program into a number and the output is that number of 0s. They are usually very large programs.
I won't paste the program here because I don't know how much text SE allows but I bet it's less than this. Instead, I'll paste the precise number of zeroes in this answer:
708184005756841022918598670049178934705323143517361395031673227349803938380119378597780037353721967636097362645175347036417214959141923667629285233360306016978751166690464736541968556
As this is a fairly cheap answer, guaranteed to not be the shortest, and I simply copied it, I'm making this a wiki post.
-
2\$\begingroup\$ "I don't know how much text SE allows" at least it's not 7*10¹8² which is waaaaaay larger than 65536. \$\endgroup\$Erik the Outgolfer– Erik the Outgolfer2017年08月01日 08:16:51 +00:00Commented Aug 1, 2017 at 8:16
05AB1E, (削除) 137 (削除ここまで) (削除) 106 (削除ここまで) 95 bytes
X00X00DXX00DXX00XX0X0X00D0XXXX0X00X00XXX00XXX0XXXXXX00XXXXX0XXXX00D0X000DD00XXJC000gDD0000g***B
-31 thanks to @Adnan for pointing out I could use base 108.
-?? thanks to @Riley for pointing out some things wrong.
Old version (different method):
05AB1E, (削除) 211 (削除ここまで) (削除) 186 (削除ここまで) 166 bytes
0g00g000000000gUX000000gXX00000g000g00g000gD0000g0 000g00000gX00000gX00000g0 00000g00000000g0000000g00g00000000gD000000gX0000000g0g00000gUXJX00000000000000000g000g**B
Haha! AND HERE I THOUGHT ESOLANGS STOOD NO PLAUSIBLE CHANCE!
First we get 255 stored in X:
00g # Push 2 (length of 00).
00000g # Push 5 (length of 00000).
00000g # Push 5.
JU # Join to 255 and store in X.
Then, using the same length trick we push: 1296995323340359595058728869715
0g00g000000000g000000g000000000g000000000g00000g000g00g000g000g0000g0 000g00000g000000000g00000g000000000g00000g0 00000g00000000g0000000g00g00000000g00000000g000000g000000000g0000000g0g00000gJ
Where we just use 0<space> instead of the length trick for the zeros.
Then, finally, we push the 255 we stored and convert from 255 to base 10:
X # Push stored 255.
B # Convert to base 255.
Still golfing using the other allowed chars, and duplication, it will be a minute.
-
\$\begingroup\$ 77 bytes \$\endgroup\$Kevin Cruijssen– Kevin Cruijssen2022年03月04日 13:51:36 +00:00Commented Mar 4, 2022 at 13:51
Beatnik, 148 bytes
K QQQQQQQG ZD XA K QQJA KD ZD XA K KG KD ZD ZD ZD XA XA K B KD ZD XA K QQQQF ZD ZD XA K QQQD XA K A Z KD XA ZD XA K B KD XA ZD XA K J Z XA K QQQB XA
Explanation
Beatnik bases the instruction executed based on the scrabble score of the word. Here's a shortened explanation:
Code Scrabble Score Explanation
K 5 push the scrabble score of the next word
QQQQQQQG 72 72 ['H']
ZD 12 pop a value; push it back twice
XA 9 pop a value; print its ASCII character
KD 7 pop two values; push their sum
Z 10 pop two values; push their difference
Moorhens (v2.0), (削除) 3423 (削除ここまで) (削除) 983 (削除ここまで) (削除) 923 (削除ここまで) (削除) 866 (削除ここまで) (削除) 749 (削除ここまで) 716 bytes
I think this can be golfed a bit, Moorhens is not an easy language to work with.
xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU xU xU xU xU xU xU xU xU xU KA AA xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU xU xU xU xU KA KA xU xU xU AA AA AA AA AA KA xU AA KA xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU xU KA xU xU xU KA XI XI XI XI XI XI KA XI XI XI XI XI XI XI XI AA AA AA AA AA AA AA AA AA AA AA AA
Explanation
Moorhens is a language based of of dictionary words. Each word corresponds to an operation based on its hash. The five operations used here are xU, ER, XI, KA, and AA
xUincrements the TOSERputs a new zero on the stack.XIdecrements the TOSKAduplicates the TOSAArolls the TOS to the bottom
We push each letter with sucessive applications of these operations.
-
5\$\begingroup\$ 'The two operations' - I'm not well versed in esolangs but surely those are five operations? \$\endgroup\$boboquack– boboquack2017年08月01日 09:49:24 +00:00Commented Aug 1, 2017 at 9:49
-
\$\begingroup\$ @boboquack fixed \$\endgroup\$2017年08月01日 15:57:10 +00:00Commented Aug 1, 2017 at 15:57
-
1\$\begingroup\$ link to language? \$\endgroup\$Leaky Nun– Leaky Nun2017年08月02日 09:53:21 +00:00Commented Aug 2, 2017 at 9:53
-
\$\begingroup\$ I think this is it. github.com/Wheatwizard/Moorhen \$\endgroup\$recursive– recursive2018年03月05日 18:54:50 +00:00Commented Mar 5, 2018 at 18:54
SOGL V0.12, (削除) 89 (削除ここまで) (削除) 75 (削除ここまで) 68 bytes
z{}xxxx≥x≥x≥xXUqXxq≤qq≤q *R_IIRq q *R_I0II*IRqxXq≤qxqxq CR_0II÷Rq0*
Try it Here!
Note: whenever q or output is referred to here, it doesn't pop as popping output (any of oOpP) are unavailable or output a prepending newline.
Explanation (outdated, what's changed is that the "H" is printed using the alphabets letters):
$ push "$"
R_ convert to an array of ordinals, then push all the contents to the stack
0II push 0+1+1 = 2
* multiply by that
R convert to character
q output
z push the lowercase alphabet
{} iterate over it, pushing each char, and do nothing. Stack: ["H","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
stack manipulation:
xxxx ["H","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r"]
≥ ["r","H","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q"]
x ["r","H","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o"]
≥ ["o","r","H","a","b","c","d","e","f","g","h","i","j","k","l","m","n"]
x ["o","r","H","a","b","c","d","e","f","g","h","i","j","k","l"]
≥ ["l","o","r","H","a","b","c","d","e","f","g","h","i","j","k"]
xxx ["l","o","r","H","a","b","c","d","e"]
q output the "e"
≤ ["o","r","H","a","b","c","d","e","l"]
qq output the "l" twice
≤ ["r","H","a","b","c","d","e","l","o"]
q output the "o"
* push "*",
R_ convert to an array of ordinals, then push all to stack
II increase by 2
R convert back to character
q output
q push a space, then output
* push "*"
R_ convert to an array of ordinals, then push all to stack
I increase that
0II push 0+1+1 = 2
* multiply
I increase
Rq output as character
stack manipulation: (starting stack: ["r","H","a","b","c","d","e","l","o",","," ","W"])
x ["r","H","a","b","c","d","e","l","o",","]
X ["r","H","a","b","c","d","e","l","o"]
q output the "o"
≤ ["H","a","b","c","d","e","l","o","r"]
q output the "r"
x ["H","a","b","c","d","e","l"]
q output the "l"
x ["H","a","b","c","d"]
q output the "d"
C push "C"
R_ convert to ordinal as before
0II÷ floor divide by 2
Rq output as character
0* multiply by 0 so nothing extra would be outputted
Fun fact: all of the characters from the allowed characters are in SOGLs codepage :D
-
\$\begingroup\$ So... You have a good stable job as a professional developer right? Because dang, this is a cool language... Also nice JS interpreter, you finished it last night :)? Can you start posting documentation for some of the language? Or private-chat message me the location of such documentation? SOGL kills it. \$\endgroup\$Magic Octopus Urn– Magic Octopus Urn2017年08月01日 22:28:05 +00:00Commented Aug 1, 2017 at 22:28
-
\$\begingroup\$ @MagicOctopusUrn 1) no lol I'm 15 2) I personally don't like it as the way it's made is the most bodgy thing I've made 3) The JS interpreter has been there for a while 4) the latest docs on SOGL (if you can call them that) are here, trough some stuff (like the
palenChars.txt) are more updated here \$\endgroup\$dzaima– dzaima2017年08月02日 03:35:07 +00:00Commented Aug 2, 2017 at 3:35 -
\$\begingroup\$ Congrats on reducing byte count again! I honestly don't think I can get mine any lower!! \$\endgroup\$Dom Hastings– Dom Hastings2018年03月09日 06:01:49 +00:00Commented Mar 9, 2018 at 6:01
Glypho, 480 bytes
AABCABABABBAABABAABCABBAABABABBCABBAABABABABABABABBAABBAABABABABABABABBAABBAAABCABBAABABAABCAABCABBAABABABBCABABABBAABBAABABAABCAABCABBAAABCABBAABABABBAABBAABABAABCABCAABABABABABBAABBAABBAABABAABCABAAABABAABAABBAABCAABABABBAABBAAABCAABCABBAABABABBCABABABBCABABABBAABAAABABAABAABABABBAABABABBAABABABAAABABAABAABBAABABABBAAABCABBAABABAABCABCAABABABABABBAABBAABBAABABAABCABCAABAAABABAABAABBAABABABBCAABCABBAAABCAABCABBAAABCABBAABABABBAABABABBCABABABBAABAAABABABCAABBAAABAABACABBBABCB
Double JavaScript, 318 bytes
I'm not sure if that's allowed, I couldn't do it using the JavaScript interpreter once. It's similar to use eval() but instead I'm using the interpreter twice: (Try it in the console to get the result printed back)
`\`\\x${0xA*0xA&0xC}${0xA&0xC}\\x${0xA*0xF&0xF}${0xB*0xF&0xF}\\x${0xA*0xF&0xF}C\\x${0xA*0xF&0xF}C\\x${0xA*0xF&0xF}F\\x${0xE*0xF&0xF}C\\x${0xE*0xF&0xF}${0}\\x${0xB*0xF&0xF}${0xB*0xB*0xF&0xF}\\x${0xA*0xF&0xF}F\\x${0xB*0xB*0xF&0xF}${0xE*0xF&0xF}\\x${0xA*0xF&0xF}C\\x${0xA*0xF&0xF}${0xA*0xA&0xC}\\x${0xE*0xF&0xF}${0**0}\``
Evaluates to:
`\x48\x65\x6C\x6C\x6F\x2C\x20\x57\x6F\x72\x6C\x64\x21`
Which evaluates to Hello, World!
Smallf**k, 266 bytes:
zJ$NJ`ZZx*gQYQQ{zqyKKUkUR?AS`zB`JB&UCKCIxQ_G0*000FzzJ&?YwkC\qqgZ`xYQyC}DgY_&_S}KPZ\&?SGAE&{Gw_w} GAgA{qT{gC&`qI?xwCNQwgR}?{*QEwQUj&BT&jR__IJJIqUqAPF0yICXESL?AYR QIAFU& yYwE&$\Njj B0T*F j$?kCzQk*}U}UgI$}Ew_yDL`qYI*E_G}SCjXDFNJKGNIGyIwA\BzLP`*zCILGCNqyYZyq? GwN{q{gKSj
Actually, the characters are kinda irrelevant. It's just a matter of whether or not each character has an even codepoint or an odd codepoint. Thus, I've made an effort to use every character available (except the multibyte characters) (though since it was randomised, I didn't make an effort to guarantee that).
-
1\$\begingroup\$ @totallyhuman You're right; I will change that. I'll just remove the multibyte characters. It doesn't have a codepage really; it just needs to be stored as 1s and 0s (1 for odd
ordand 0 for evenord) so you could say this is 33.25 bytes xD \$\endgroup\$2017年07月31日 22:53:47 +00:00Commented Jul 31, 2017 at 22:53 -
\$\begingroup\$ Your usage of the character should be based on its appearance in a normal program, not based on its code point or byte value. \$\endgroup\$KSmarts– KSmarts2017年08月01日 14:24:56 +00:00Commented Aug 1, 2017 at 14:24
-
\$\begingroup\$ @KSmarts I will ask the OP about that. \$\endgroup\$2017年08月01日 14:27:06 +00:00Commented Aug 1, 2017 at 14:27
-
\$\begingroup\$ @KSmarts What that means is that if a language has a different codepage and for example
'5'occupies the codepoint of regular'A', you're not allowed to use'5'. \$\endgroup\$2017年08月01日 14:29:34 +00:00Commented Aug 1, 2017 at 14:29 -
\$\begingroup\$ @KSmarts that just means that if you have a non-standard codepage, these characters move around on that codepage. You can still use their codepoint as part of your program. \$\endgroup\$Stephen– Stephen2017年08月01日 14:30:06 +00:00Commented Aug 1, 2017 at 14:30
Pyke, (削除) 133 (削除ここまで) 144 bytes
? BXKKKKRKRKRK\CkJ00q}}}XEjTX}G_E\E\L\LkJjRT}}XRGREkJjR 00q}R? B_RE\ \wkJjRT}}XRGRE\R\L\DkJjRZ0q}}R? B_RER? JR? KREZjZ0q}AREkJjRT}}RG_RE00q}}RAA
A horrible mess of code that can almost certainly be shortened... Constructs it one character at a time.
? BXKKKKRKRKRK\CkJ - ".C" - A string that when evaled, gets the character at the point
00q}}}XEj - Construct 64 by doing `((0==0)*2*2*2)**2` and then eval, getting the "@" character and store it in `j`
TX}G_E - Get "h" using `@` by looking it up in the alphabet
\E\L\LkJ - "hELL"
jRT}}XRGREkJ - "hELLo"
jR 00q}R? B_RE - ","
\ \wkJ - "hELLo, w"
jRT}}XRGRE\R\L\DkJ - "hELLo, woRLD"
jRZ0q}}R? B_RER? JR? KREZjZ0q}AREkJ - "hELLo, woRLD!"
jRT}}RG_RE00q}}RAA - "Hello, World!"
Vyxal, 33 bytes
`gDKKN`\*kP*JkP*` w`J`NQKCZ`kP*JN
As I've golfed this, it's become a lot more straightforward. For reference, the original looked something like this.
For convenience, the string is constructed swapcase'd, then fixed at the end.
This program makes heavy use of kP* - * in this context is ring translate, and kP printable ASCII, which is arranged a bit weirdly.
\*kP* # The character `+`, made by ring translating `*`
`gDKKN` J # Append that to `gDKKN`
kP* # Ring translate again, producing `hELLO,`
` w`J # Append ` w`
`NQKCZ`kP* # The string `NQKCD` ring translated to `ORLD!`
# Don't ask why Z wraps to `!`
JN # Append that and swap the case.
dc, (削除) 164 (削除ここまで) 162 bytes
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzS zzS?zzzzzzzzzzzzS$zzzzzzzzzzzzzzzzzzzzzzzzzzzzzPzzzzzzzzzzzzzzzzSwzzzzzzzzzzzzzzzPzzzzzzzzSLzPzPzzzzPL$PL PLwPzPzzzzPLLPAI*PL?P
There's likely a better/more interesting approach. I tried using the ASCII+256 trick that dc has, but that outputs additional characters as well (even if they're non-printing), and once I got to 'o', the wonderfully prime 111, I ran into trouble even getting a value of 111+(multiple of 256) that factored cleanly. So here's a fairly straightforward (albeit golfed where possible) solution:
In dc, z is a command that pushes the stack depth onto the stack. That means we can use it as an increment. This is how I create most of my ASCII values for this challenge (printed with P), which I push onto named stacks with S and pop back onto the main stack with L.
dc lets you use the hex values A-F even when the input radix is decimal (default). (削除) Luckily, our first letter, 72, is a multiple of 12, so I save a byte or two here by multiplying 6*12 and printing immediately ( My 164-byte version used multiplication early on to get 72 ('H'), which was mildly clever but a holdover from an earlier attempt, and a waste of bytes. Now, I start by incrementing and saving the space, the exclamation point, and the comma, which are out of order, and therefore can't be printed yet. Next, I come to the 'H', which I print immediately, before I get to 'W', which I must save for later.zzzzzzzC*P). (削除ここまで)
I simply print when I hit the 'e', then I increment up to 'l'. I print two of those and save one. When I make it to 'o', I first thought I'd have to save one of those for later, but everything is kind of in order at this point. I print an 'o', retrieve my comma, space, and 'W' from earlier, and now I'm right back to 'o'. I print this, and increment a few up to the highest necessary value, 'r' (114), which I print before loading and printing the 'l' I tucked away earlier.
Almost done! 'd' is ASCII value 100, which is easily made by multiplying 10*10 (fewer bytes than having stored it earlier and loading it now). Hex value A is 10, as is our input radix which we can retrieve with the command I. Multiply those, print, and then load and print our exclamation point from earlier. Hello, World!
Deadfish~
w
Honestly, the other answers are way more impressive.
Explore related questions
See similar questions with these tags.