Hello, World! with semi-common characters

28

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 , so shortest answer in bytes wins.

JSFiddle to check if your answer is valid

Stephen

Posted 2017-07-31T20:12:26.913

Reputation: 12 293

may I output a space in the next line? – dzaima – 2017-08-01T14:56:15.137

@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 – Stephen – 2017-08-01T15:05:09.600

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... – brhfl – 2018-03-06T15:38:07.773

@brhfl not that I know of - the only norm is that trailing newlines are usually allowed, you could ask in chat – Stephen – 2018-03-06T23:03:47.470

Answers

6

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

dzaima

Posted 2017-07-31T20:12:26.913

Reputation: 19 048

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. – Magic Octopus Urn – 2017-08-01T22:28:05.347

@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

– dzaima – 2017-08-02T03:35:07.240

Congrats on reducing byte count again! I honestly don't think I can get mine any lower!! – Dom Hastings – 2018-03-09T06:01:49.610

23

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=}

Try it online!

Dom Hastings

Posted 2017-07-31T20:12:26.913

Reputation: 16 415

I didn't say anything about the content of flags, so -p is fine. Good job, this is what I was hoping for when I asked this :) – Stephen – 2017-08-01T15:51:33.330

1how... what... the... – Okx – 2017-08-01T15:53:58.733

@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! – Dom Hastings – 2017-08-01T17:48:51.797

@Okx I'm glad to have had that effect! – Dom Hastings – 2017-08-01T17:49:04.720

You sure you don't need to add 15 bytes <3? – Magic Octopus Urn – 2017-08-03T21:47:28.233

@MagicOctopusUrn I'm afraid not... but looks like you've managed to get very close anyway! Good going! – Dom Hastings – 2017-08-04T05:34:40.877

10

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.

Engineer Toast

Posted 2017-07-31T20:12:26.913

Reputation: 5 769

2"I don't know how much text SE allows" at least it's not 7*10¹⁸² which is waaaaaay larger than 65536. – Erik the Outgolfer – 2017-08-01T08:16:51.473

9

05AB1E, 137 106 95 bytes

X00X00DXX00DXX00XX0X0X00D0XXXX0X00X00XXX00XXX0XXXXXX00XXXXX0XXXX00D0X000DD00XXJC000gDD0000g***B

Try it online!

-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

Try it online!


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.

Magic Octopus Urn

Posted 2017-07-31T20:12:26.913

Reputation: 19 422

8

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

  • xU increments the TOS
  • ER puts a new zero on the stack.
  • XI decrements the TOS
  • KA duplicates the TOS
  • AA rolls the TOS to the bottom

We push each letter with sucessive applications of these operations.

Post Rock Garf Hunter

Posted 2017-07-31T20:12:26.913

Reputation: 55 382

5'The two operations' - I'm not well versed in esolangs but surely those are five operations? – boboquack – 2017-08-01T09:49:24.340

@boboquack fixed – Post Rock Garf Hunter – 2017-08-01T15:57:10.660

1link to language? – Leaky Nun – 2017-08-02T09:53:21.343

I think this is it. https://github.com/Wheatwizard/Moorhen

– recursive – 2018-03-05T18:54:50.753

8

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

Try it online!

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

totallyhuman

Posted 2017-07-31T20:12:26.913

Reputation: 15 378

5

Glypho, 480 bytes

AABCABABABBAABABAABCABBAABABABBCABBAABABABABABABABBAABBAABABABABABABABBAABBAAABCABBAABABAABCAABCABBAABABABBCABABABBAABBAABABAABCAABCABBAAABCABBAABABABBAABBAABABAABCABCAABABABABABBAABBAABBAABABAABCABAAABABAABAABBAABCAABABABBAABBAAABCAABCABBAABABABBCABABABBCABABABBAABAAABABAABAABABABBAABABABBAABABABAAABABAABAABBAABABABBAAABCABBAABABAABCABCAABABABABABBAABBAABBAABABAABCABCAABAAABABAABAABBAABABABBCAABCABBAAABCAABCABBAAABCABBAABABABBAABABABBCABABABBAABAAABABABCAABBAAABAABACABBBABCB

Try it online!

Okx

Posted 2017-07-31T20:12:26.913

Reputation: 15 025

4

Headsecks, 78 bytes

yyzyzzxNxNzx{yyy{y{y{yzzz_{_zzyy\zxxxxxx\zzy\\zz\zx\{{\{{\zzz\xxx\{{\{{y\zzzx\

Uriel

Posted 2017-07-31T20:12:26.913

Reputation: 11 708

4

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}\``

Try it online!

Evaluates to:

`\x48\x65\x6C\x6C\x6F\x2C\x20\x57\x6F\x72\x6C\x64\x21`

Try it online!

Which evaluates to Hello, World!

Ra8

Posted 2017-07-31T20:12:26.913

Reputation: 391

3

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).

HyperNeutrino

Posted 2017-07-31T20:12:26.913

Reputation: 26 575

1@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 ord and 0 for even ord) so you could say this is 33.25 bytes xD – HyperNeutrino – 2017-07-31T22:53:47.700

Your usage of the character should be based on its appearance in a normal program, not based on its code point or byte value. – KSmarts – 2017-08-01T14:24:56.273

@KSmarts I will ask the OP about that. – HyperNeutrino – 2017-08-01T14:27:06.407

@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'. – HyperNeutrino – 2017-08-01T14:29:34.090

@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. – Stephen – 2017-08-01T14:30:06.203

3

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

Try it online!

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!"

Blue

Posted 2017-07-31T20:12:26.913

Reputation: 26 661

2

dc, 164 162 bytes

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzS zzS?zzzzzzzzzzzzS$zzzzzzzzzzzzzzzzzzzzzzzzzzzzzPzzzzzzzzzzzzzzzzSwzzzzzzzzzzzzzzzPzzzzzzzzSLzPzPzzzzPL$PL PLwPzPzzzzPLLPAI*PL?P

Try it online!

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 (zzzzzzzC*P). 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.

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!

brhfl

Posted 2017-07-31T20:12:26.913

Reputation: 1 291