So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with , and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of Wikipedia (the Wikipedia entry has been deleted but there is a copy at archive.org ), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

  • Each submission must be a full program.
  • The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.
  • The program must not write anything to STDERR.
  • If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

    Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

  • Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.
  • This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".
  • If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:

## [><>](https://esolangs.org/wiki/Fish), 121 bytes

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();
    
    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">
<div id="language-list">
  <h2>Shortest Solution by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

  • 1
    @isaacg No it doesn't. I think there would be some interesting languages where it's not obvious whether primality testing is possible. – Martin Ender Aug 28 '15 at 13:56
  • 4
    If the same program, such as "Hello, World!", is the shortest in many different and unrelated languages, should it be posted separately? – aditsu Aug 28 '15 at 15:33
  • 1
    @aditsu Yes, because there's no way anyone to find to the shortest version in an answer of an unrelated language. – Martin Ender Aug 28 '15 at 15:39
  • 1
    @mbomb007 Well it's hidden by default because the three code blocks take up a lot of space. I could minify them so that they are a single line each, but I'd rather keep the code maintainable in case bugs come up. – Martin Ender Aug 28 '15 at 19:34
  • 7
    @ETHproductions "Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge." Publishing the language and an implementation before posting it would definitely be helpful though. – Martin Ender Aug 29 '15 at 23:01

718 Answers 718

Stuck, 0 bytes

Well, can't get shorter than that... An empty program will output Hello, World! in Stuck.

  • 51
    Damn, i was 20 minutes late! :P – Kade Aug 28 '15 at 12:55
  • 27
    Noooo c'mon fastest gun in the west effect ;) – Beta Decay Aug 28 '15 at 16:32
  • 26
    @Zuck Well yes, Stuck was made for code-golfing, just like CJam/GolfScript/Pyth. The Hello, World! thing was just something I had put in as a placeholder early in development. I didn't intend to leave it in so long, just never got around to removing it. – Kade Sep 8 '15 at 20:34
  • 113
    I've been trying to come up with a shorter solution, but I'm stuck. – Cyoce Dec 24 '15 at 3:40
  • 30
    -1 bytes in jQuery. Have you tried jQuery? – 10 Replies Dec 31 '16 at 19:36
up vote 228 down vote
+1500

Brainfuck, 78 bytes

Open-ended bounty: If anyone can improve this score, I will pass the bounty (+500) on to them. @KSab has found a 76 72 byte solution!

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

Try it online!

The first 28 bytes --<-<<+[+[<+>--->->->-<<<]>] initialize the tape with the following recurrence relation (mod 256):

fn = 171·(-fn-1 - fn-2 - fn-3 + 1), with f0 = 57, f1 = 123, and f2 = 167.

The factor of 171 arises because 3-1 ≡ 171 (mod 256). When the current value is translated one cell back (via <+>---) subtracting 3 each time effectively multiplies the value by 171.

At n = 220 the value to be translated is zero, and the iteration stops. The ten bytes preceding the stop point are the following:

[130, 7, 43, 111, 32, 109, 87, 95, 74, 0]

This contains all of the components necessary to produce Hello, World!, in hunt-and-peck fashion, with minor adjustments.

I've also found an alternative 78 byte solution:

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

Try it online!

I consider this one to be better than the first for several reasons: it uses less cells left of home, it modifies less cells in total, and terminates more quickly.


More Detail

Recurrence relations have surprisingly terse representations in Brainfuck. The general layout is the following:

{...s3}<{s2}<{s1}[[<+>->{c1}>{c2}>{c3...}<<<]>{k}]

which represents:

fn = c1·fn-1 + c2·fn-2 + c3·fn-3 + ... + k

with

f0 = s1, f1 = s2 + c1·f0 + k, f2 = s3 + c2·f0 + c1·f1 + k, etc.

Additionally, the <+> may be changed to multiply the range by a constant without affecting the stop point, and a term may be added before the >{k} to shift the range by a constant, again without affecting the stop point.


Other Examples

Fibonacci Sequence

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

N-gonal Numbers

Triangular Numbers

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

Defined as fn = 2·fn-1 - fn-2 + 1, with f0 = 0, f1 = 1.

Square Numbers

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

Pentagonal Numbers

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

etc.


BF Crunch

I've published the code I used to find some of this solutions on github. Requires .NET 4.0 or higher.

Usage: bfcrunch [--options] text [limit]

Arguments
------------------------------------------------------------
  text              The text to produce.
  limit             The maximum BF program length to search for. If zero, the length of the
                    shortest program found so far will be used (-r). Default = 0

Options
------------------------------------------------------------
  -i, --max-init=#  The maximum length of the initialization segment. If excluded, the
                    program will run indefinitely.
  -I, --min-init=#  The minimum length of the initialization segment. Default = 14
  -t, --max-tape=#  The maximum tape size to consider. Programs that utilize more tape than
                    this will be ignored. Default = 1250
  -T, --min-tape=#  The minimum tape size to consider. Programs that utilize less tape than
                    this will be ignored. Default = 1
  -r, --rolling-limit
                    If set, the limit will be adjusted whenever a shorter program is found.
  -?, --help        Display this help text.

Output is given in three lines:

  1. Total length of the program found, and the initialization segment.
  2. Path taken, starting with the current tape pointer. Each node corresponds to one character of output, represented as (pointer, cost).
  3. Utilized tape segment.

For example, the final result for bfcrunch "hello world" 70 -r -i23 is:

64: ++++[[<+>->+++++>+<<]>]
49, (45, 5), (44, 3), (45, 6), (45, 1), (45, 4), (42, 4), (43, 5), (45, 3), (45, 4), (46, 2), (44, 4)
32, 116, 100, 104, 108, 132, 0, 0, 132, 0

This corresponds to the full program:

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

Other Records

Hello, World!

Wrapping, 78 bytes:

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

or

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

Non-wrapping, 87 bytes (previously 92 bytes (mitchs)):

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

Hello, world!

Wrapping, 80 bytes:

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

Non-wrapping, 81 bytes (previously 92 bytes (hirose)):

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

hello, world!

Wrapping, 74 bytes:

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

Non-wrapping, 84 bytes:

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

Esolangs Version

Hello World!\n

Wrapping, 76 bytes:

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

This uses one cell left of home, and thus would be considered 77.

Non-wrapping, 83 bytes:

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

Rdebath approved. profilebf output:

Hello World!
Program size 83
Final tape contents:
 :   0   0  73 101 109 115 112  88  33  10   0
                                         ^
Tape pointer maximum 10
Hard wrapping would occur for unsigned cells.
Counts:     +: 720          -: 79           >: 221          <: 212
Counts:     [: 9            ]: 84           .: 13           ,: 0
Total:         1338

inversed.ru (Peter Karpov)

Hello World!

Wrapping, 70 bytes (previously 781):

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

Non-wrapping, 77 bytes (previously 89?):

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

The author claims that the shortest hand-coded "Hello World!" is 89 bytes, but provides no reference. I hereby claim the record for this, too.

hello world!

Wrapping, 65 bytes (previously 66 bytes):

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

This is actually hand-coded as well (the best I could find by crunching is 68 bytes). The first cell is initialized to 259 (3), and decremented by 7 each iteration, looping 37 times. The next cell is decremented by 6, resulting in 256 - 6·37 = 34. The rest of the cells are decremented by 4 each time, adding one cell each iteration, with each new cell inialized to 252 (-4). The result is the following:

[  3,   0,   0,   0,   0,   0,   0, ...]
[252, 250, 248,   0,   0,   0,   0, ...]
[245, 244, 244, 248,   0,   0,   0, ...]
[238, 238, 240, 244, 248,   0,   0, ...]
[231, 232, 236, 240, 244, 248,   0, ...]
[224, 226, 232, 236, 240, 244, 248, ...]
...
[ 35,  64, 124, 128, 132, 136, 140, ...]
[ 28,  58, 120, 124, 128, 132, 136, ...]
[ 21,  52, 116, 120, 124, 128, 132, ...]
[ 14,  46, 112, 116, 120, 124, 128, ...]
[  7,  40, 108, 112, 116, 120, 124, ...]
[  0,  34, 104, 108, 112, 116, 120, ...]

1 The solution given (79 bytes) can be trivially reduced by one:

-[>>+>+[++>-<<]-<+<+]>---.<<<<++.<<----..+++.>------.<<++.>.+++.------.>>-.<+.
  • 37
    This is nuts. One of you should submit the 82-byte version to anarchy golf. – Martin Ender Jan 3 '16 at 17:43
  • 109
    The best Java solution to this question is 76 bytes. Only 9 more bytes to go to prove Java developers should switch to Brainfuck. – Level River St Jan 3 '16 at 21:51
  • 9
    @LevelRiverSt The small-letters one is 2 bytes shorter than Java. The endtimes have come. – Conor O'Brien Apr 13 '16 at 13:59
  • 11
    "Only 9 more bytes to go to prove Java developers should switch to Brainfuck." interface a{static void main(String[]A){System.out.print("No!");}} – dorukayhan Jun 11 '16 at 1:10
  • 6
    @primo 76 bytes! codegolf.stackexchange.com/a/163590/15858 – KSab Apr 27 at 14:59

PHP, 13 bytes

Hello, World!

Yes. It works.

  • 236
    As usual with PHP, you always wonder how it can work – Fatalize Aug 28 '15 at 14:03
  • 87
    It works, of course, because there's no <?php in the code, causing it not to get interpreted by PHP at all :) – Lynn Aug 28 '15 at 19:54
  • 50
    That means this is just an HTML answer... – Nelson Aug 29 '15 at 11:42
  • 76
    @Nelson no, it doesn't. PHP doesn't necessarily have to be placed in to HTML. And plus, HTML doesn't print to the stdout – georgeunix Aug 29 '15 at 11:43
  • 19
    This is the most hilarious answer ever – Oliver Ni Oct 16 '15 at 17:10

ArnoldC, 71 bytes

IT'S SHOWTIME TALK TO THE HAND "Hello, World!" YOU HAVE BEEN TERMINATED

Just for lols..

  • 4
    Worked for me. Try putting it's showtime on the first line and you have been terminated on the last line – JelloDude Aug 28 '15 at 14:55
  • 67
    I really need to learn how to use this language. – Buzz Aug 31 '15 at 14:29
  • 3
    Doesn't a space and a newline take up the same number of bytes? And technically, IT'S SHOWTIME and TALK TO THE HAND should be on the first and last lines. – wizzwizz4 Dec 29 '15 at 10:33
  • 5
    @AlCode But it's more correct and takes up the same number of bytes and there is more compatibility and it looks nicer and why am I making a fuss this is a code golf challenge on PPCG and it is a surprise that your code is readable and well done you made a well golfed answer that was readable and +1. – wizzwizz4 Sep 6 '16 at 15:36
  • 11
    @wizzwizz4 thank your very much, I try to be as professional as possible with ArnoldC the language of the future! – AlCode Sep 8 '16 at 11:59
up vote 178 down vote
+500

Seed, 6016 4234 4203 bytes

20 854872453003476740699221564322673731945828554947586276010721089172712854441839676581917455319274850944955030258951339804246125714958815519550291630078076933441706558540342671975808828643360922071900333028778314875248417953197990571991784126564752005357199892690656368640420204822142316716413192024742766282266114842280731756458212469988291309261528542889299297601723286769284159107438930448971911102280330101196758384815655479640836157495863547199726234352265518586460633795171196315255736880028338460236768181141732764911402112878175632130129852788301009582463631290071329795384336617491655825493435803011947670180368458659271192428341035912236946048939139042310380278430049252171822721598175984923434205610723412240162418996808671543770639111617709604242882388664919702606792443015941265168129550718541372361144081848761690730764968771245566074501485020726368378675085908872608679630368472956274468410052703615106090238423979678950131481176272880569100533049143775921798055136871254424261001442543122666701145111965968366507060931708140304772342855064834334129143038575569044150428480231956133612367393837580345180691911525531699573096952433882387811884727975431823620782822755161559988205401134640722220804177812794328129589949692446031008866917615922944976151073653201316255518389496411696741029209242119521978920200314572718584995265523235225587228975886710511855501710470163649632761488899317729943053884132314641377747687975638119132094777769497069556255954031537245957811105217875011509899497752696062748928963281605780942517262774976217663461063680912331030221981433051827519906741285738915397005702326447635845195923640649166530310494885569783989508000344280715868581532826832242144647203531393142251025361866506821695860883605004105862208004440476654027574832078603305884731766236740069411566854496824754558761536201352147934963241039597221404341132342297870517293237489233057335406510464277610336142382379135365550299895416613763920950687921780736585299310706573253951966294045814905727514141733220565108490291792987304210662448111170752411153136765318541264632854767660676223663544921028492602135525959428999005153729028491208277493747933069008199074925710651071766675870081314909460661981433426167330215548196538791617762566403934129026219366764038390123622134753742930729751695349588862441999672547791630729398908283091638866715502470152431589429837867944760012419885615525232399584379209285060418518373512154801760060312646951597932345591416241634668119867158079946680321131213357200382937049485606706114467095019612014749723443159443363662563254359712162432143334612180576945072905749883870150120687696027984317320305291407322779803583395375616762530641605634303022155218169343410634115050596030685041633824154135240376022159918501703555881290333205131375705406831260759974112248490451605422031345264183102048614606636275942039438138959188478277971377232005036301145411215067576576667743288951344423152531417111852584846747428443123174595987315325304540564683047858415059703724263652136185848573853965992798725654430360647040362341567082462847275277303225817689141675391972818943419663764371222973269129542760661385278009266471167618553065823580448848795731295589715602705860758954890415040763604082216728159486423396295188510311881004469017351709060492844398219491990895826924575575549615118821417543037296628825303328056839433114519945243963946989899508355224823109677424196639930153649890175062456649384605721510239142861693109687536600667811037619175927995599388547421689316110236566026931360164495251160997857372500940728057700473763884480342708897319990346726967220426504612260565552531158509215849649565188655100774748485416791517853427613458459889062942881409801879085054494129489535044719193283409051007851153504224002807392992520076910314763705776345053922387355156981872691537772657428096384535960466923475731297217863371650154415835785630016335858514130863258775100537612371430357576913148500310344278511588325852376442503898849856566716198848377379400158332792027967216204970114516984638014129252882482309132898416484525230488700253065644547798869056136044415413099076332059572505138116227535024546891015836838323022822272664771489129085797354578016574544759934333471793

The resulting Befunge-98 program (based on this) is

"9!dlroW ,olleH"ck,@
  • 30
    Wow! How did you find this? – ETHproductions Oct 28 '16 at 15:04
  • 29
    What. That's insane. – Conor O'Brien Oct 31 '16 at 14:33
  • 36
    HOW DID YOU GOLF THIS? – Destructible Lemon Oct 31 '16 at 23:55
  • 31
    Did you reverse engineer the mersenne twister? And does this have any security implications? – primo Nov 1 '16 at 14:37
  • 60
    I'll give you another +500 for a detailed (theoretical) explanation. – primo Nov 14 '16 at 12:51

Mornington Crescent, 3614 3568 bytes

Thanks to NieDzejkob for saving 46 bytes by using shorter line names.

Take Northern Line to Hendon Central
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Gunnersbury
Take District Line to Victoria
Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Paddington
Take District Line to Acton Town
Take Piccadilly Line to Holloway Road
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Victoria
Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to Hammersmith
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminals 1, 2, 3
Take Piccadilly Line to Holborn
Take Central Line to Holborn
Take Central Line to Mile End
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Barking
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Barking
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Wood Lane
Take Circle Line to Victoria
Take Circle Line to Victoria
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take District Line to Mile End
Take Central Line to Fairlop
Take Central Line to Mile End
Take District Line to Barking
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Mile End
Take District Line to Richmond
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take District Line to Richmond
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Stepney Green
Take District Line to Hammersmith
Take District Line to Stepney Green
Take District Line to Upney
Take District Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Upney
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Bakerloo Line to Charing Cross
Take Bakerloo Line to Paddington
Take Circle Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent

Try it online!

This is most certainly suboptimal, but it's half the size of the solution on esolangs.

Hello, World is constructed via slicing the following station names and concatenating the results:

Hendon Central
▀▀
Holloway Road
  ▀▀▀
Heathrow Terminals 1, 2, 3
                       ▀▀
Wood Lane
▀▀
Fairlop
   ▀▀
Richmond
       ▀

Finally, I'm computing the character code of ! as (2<<4)+1 == 33. All these parts are concatenated in Paddington and finally printed in Mornington Crescent.

Note: The language doesn't specify whether it's possible to travel to same station twice in a row, but the interpreter does allow it, so I've made use of it.

  • 40
    This is absolutely brilliant :D – Beta Decay Sep 4 '15 at 18:03
  • 29
    I love this language. Excuse me, while I do systems programming in this language. – cat Dec 20 '15 at 3:46
  • 3
    Where on EARTH has this language been all my life? – ScottMcGready Jul 11 '17 at 23:04
  • 19
    @ScottMcGready between Camden Town and Euston. – Martin Ender Jul 12 '17 at 11:25
  • 2
    Mornington Crescent is on TIO now. tio.run/#mornington-crescent – Dennis Sep 13 '17 at 3:13

evil, 70 bytes

aeeeaeeewueuueweeueeuewwaaaweaaewaeaawueweeeaeeewaaawueeueweeaweeeueuw

It uses the following four commands:

a - increment the register
u - decrement the register
e - interweave the register's bits (01234567 -> 20416375)
w - write the value of the register as an ASCII character
  • 54
    That is evil... – David Grinberg Sep 1 '15 at 14:18
  • 55
    Especially since your avatar is Black Hat. – TheDoctor Sep 1 '15 at 23:47
  • 3
    can u explain me the interweave process. – Kishan Kumar Nov 4 '15 at 14:25
  • 4
    @KishanKumar yes – grc Nov 4 '15 at 16:12
  • 25
    If you read this program out loud, it sounds like a dubstep bass. – Joe Z. Jun 17 '16 at 15:04
up vote 87 down vote
+1000

brainfuck, 72 bytes

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

Try it online!

And the original non-wrapping 76 byte solution:

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

Try it online!

Other shortest known (to my knowledge) solutions I've found

'Hello, world!' 77 bytes:

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

Try it online!

'hello, world!' 70 bytes:

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

Try it online!

  • 28
    How on Earth did you find this? – Dennis Apr 27 at 18:50
  • 22
    Hey you beat Java. – Poke Apr 27 at 19:20
  • 17
    That's some device, it doesn't even require wrapping cells ó_Ò – primo Apr 28 at 12:08
  • 5
    Would love to see the algorithm behind this :) – musicman523 May 5 at 3:40
  • 19
    Holy shit, you golfed this more?? – Jo King May 9 at 1:32

Piet, 90 codels

enter image description here

This is a 30 by 3 image. Alternatively, at codel size 10:

enter image description here

The uses a 3-high layout so that I only need to pointer once. If this is still golfable I could probably shave at most another column, since there's a push-pop no-op in there.

Edit: @primo's 84 codel solution.

  • 5
    Trying to take your own bounty? I thought more of you Sp3000 ;) – Beta Decay Sep 2 '15 at 11:18
  • 7
    Hah, just because I set a bounty doesn't mean I can't join in the fun :P – Sp3000 Sep 2 '15 at 11:29
  • 8
    A push-pop isn't a no-op to me. It's this. – mbomb007 Feb 24 '16 at 19:46
  • 1
    What the hell is this "language"? I love it! – Zoltán Schmidt Oct 11 '16 at 12:50
  • 6
    "push-pop no-op" is now my favourite phrase – BobTheAwesome Jan 20 '17 at 22:27

Haystack, 17 Bytes

Haystack is a 2D programming language that executes until it finds the needle in the haystack |, all while performing stack-based operations. All programs start from the top left corner, and can use the directional characters ><^v to move around the program. Direction is inherited, so you do not need to keep using > to go right, direction will only change when it hits a different directional character.

By default, the interpreter reads from the top left going right, so we can just put "Hello, World!" onto the stack, use o to print it, then place the needle to finish executing.

"Hello, World!"o|

Bonus: A more exciting version:

v      >;+o|
v      "
v      !
v      d
v      l
v      r
>>"Hello, ">>>v
       W      v
       "      v
       ^<<<<<<<
  • Just out of curiosity, what happens if you include one of the characters in a string? – Random832 Aug 28 '15 at 16:34
  • @Random832 In a string, directional characters are treated as regular characters, i.e. you can include them in a string. – Kade Aug 28 '15 at 17:23
  • 35
    >;+o​​​​​​​​​​​ – bjb568 Sep 13 '15 at 0:10
  • 3
    I wish I was half as smart as everyone here, but in the "documentation" (read: some guy's forum post) it says o outputs as a number. Shouldn't it be c at the end? Is there proper documentation anywhere? This is super interesting! – Scott Beeson Jan 15 '16 at 15:49
  • 2
    @Scott Super late to reply to this, that forum post was probably me! o outputs the top stack item as-is, i.e. if a number is there it prints that. c would simply cast that to a char. So, if you have a string or char on the top of the stack o would be what you want :) Eventually these docs will be updated.. – Kade Oct 3 '16 at 13:17

Help, WarDoq!, 1 byte

H

Not only does Help, WarDoq! have a built-in for most common spellings of the phrase, it even satisfies our usual definition of programming language.

Try it in the official online interpreter (code goes in Input).

  • 6
    So, HQ9++, essentially, eh? ;-) – AdmBorkBork Aug 28 '15 at 13:52
  • 4
    @TimmyD Nope, not HQ9++. – Dennis Aug 28 '15 at 13:58
  • 27
    Oh for crying out loud. Is there anything that isn't an esolang at this point? :) – AdmBorkBork Aug 28 '15 at 14:22
  • 91
    "Space: Begin a comment. The next non-space character ends the comment and is interpreted as usual." So you can only have comments made of spaces then??? I suppose even the most useful language in the world has to have one unuseful feature +1, – Level River St Aug 29 '15 at 18:44
  • 24
    @steveverrill Maybe if tabs are also considered as comments, then we can have the comments written as Whitespace programs – Optimizer Sep 3 '15 at 19:12

MarioLANG, 259 249 242 240 235 bytes

+>+>)+)+)+++)++++((((-[!)>->.
+"+"===================#+".")
+++!((+++++++++)++++++)<.---+
++=#===================")---.
++((.-(.)).+++..+++++++.<---
 !+======================---
=#>++++++++++++++.).+++.-!>!
  =======================#=#

This has been tested in the Ruby implementation.

After obfuscating "Hello, World!" in MarioLANG I looked into golfing it a bit. The above is the shortest I have found so far.

As before I started from a Brainfuck solution which sets four cells to the nearest multiple of 10 to the characters He, and space and converted it to MarioLANG. You can then shorten the code a bit by making use of the auxiliary floor in the loop which almost halves the width of the loop. Note that the bottom is only executed one time less than the top, so you don't get exact multiples of the initial counter in all 4 cells any more.

Finally, I wanted to make use of the wasted space in front of the loop, so I added a bunch of elevators to make use of the vertical space there. And then I realised that I could fold the code after the loop (see previous revision) below the loop to make use of some more vertical space, which saved five more bytes.

This is likely still far from perfect, but it's a decent improvement over the naive solution, I think.

Metagolf

Time for some automation...

I have started setting up a solver in Mathematica to find an optimal solution. It currently assumes that the structure of the code is fixed: counter set to 12, 4 cells for printing, with the fixed assignment to He,<space> and the same order of those cells. What it varies is the number of +s in the loop as well as the necessary corrections afterwards:

n = 12;
Minimize[
 {
  3(*lines*)+
   12(*initialiser base*)+
   Ceiling[(n - 6)/2] 3(*additional initialiser*)+
   8(*loop ends*)+
   18(*cell moves*)+
   26(*printing*)+
   43*2(*steps between letters in one cell*)+
   -2(*edge golf*)+
   4 Max[4 + a + d + g + j + 2 Sign[Sign@g + Sign@j] + 2 Sign@j + 2,
     4 + b + e + h + k + 2 Sign[Sign@h + Sign@k] + 2 Sign@k] +
   2 (Abs@c + Abs@f + Abs@i + Abs@l),
  a >= 0 && d >= 0 && g >= 0 && j >= 0 &&
   b >= 0 && e >= 0 && h >= 0 && k >= 0 &&
   n*a + (n - 1) b + c == 72 &&
   n*d + (n - 1) e + f == 101 &&
   n*g + (n - 1) h + i == 44 &&
   n*j + (n - 1) k + l == 32
  },
 {a, b, c, d, e, f, g, h, i, j, k, l},
 Integers
 ]

It turns out, that for an initial counter of 12 my handcrafted solution is already optimal. However, using 11 instead saves two bytes. I tried all counter values from 6 to 20 (inclusive) with the following results:

6: {277,{a->7,b->6,c->0,d->16,e->1,f->0,g->0,h->9,i->-1,j->0,k->6,l->2}}
7: {266,{a->6,b->5,c->0,d->11,e->4,f->0,g->2,h->5,i->0,j->0,k->5,l->2}}
8: {258,{a->2,b->8,c->0,d->3,e->11,f->0,g->5,h->0,i->4,j->4,k->0,l->0}}
9: {253,{a->8,b->0,c->0,d->5,e->7,f->0,g->2,h->3,i->2,j->0,k->4,l->0}}
10: {251,{a->0,b->8,c->0,d->3,e->8,f->-1,g->4,h->0,i->4,j->3,k->0,l->2}}
11: {240,{a->1,b->6,c->1,d->1,e->9,f->0,g->4,h->0,i->0,j->3,k->0,l->-1}}
12: {242,{a->6,b->0,c->0,d->6,e->3,f->-4,g->0,h->4,i->0,j->0,k->3,l->-1}}
13: {257,{a->1,b->5,c->-1,d->6,e->2,f->-1,g->3,h->0,i->5,j->0,k->3,l->-4}}
14: {257,{a->1,b->4,c->6,d->0,e->8,f->-3,g->3,h->0,i->2,j->2,k->0,l->4}}
15: {242,{a->1,b->4,c->1,d->3,e->4,f->0,g->1,h->2,i->1,j->2,k->0,l->2}}
16: {252,{a->0,b->5,c->-3,d->4,e->2,f->7,g->0,h->3,i->-1,j->2,k->0,l->0}}
17: {245,{a->4,b->0,c->4,d->5,e->1,f->0,g->0,h->3,i->-4,j->0,k->2,l->0}}
18: {253,{a->4,b->0,c->0,d->1,e->5,f->-2,g->2,h->0,i->8,j->0,k->2,l->-2}}
19: {264,{a->0,b->4,c->0,d->5,e->0,f->6,g->2,h->0,i->6,j->0,k->2,l->-4}}
20: {262,{a->0,b->4,c->-4,d->5,e->0,f->1,g->2,h->0,i->4,j->0,k->2,l->-6}}

Note: This solver assumes that the linear code after the loop is all on the top line, and the above code is that solution folded up. There might be a shorter overall solution by making the solver aware of the folding, because now I get 3 more +s in the first part for free, and the next 4 instructions would cost only 1 byte instead of 2.

  • 2
    @justhalf You should see my Pada answer. :P – Martin Ender Aug 29 '15 at 14:49
  • Martin I love this answer. Would you consider making a post about this at our official forum ? We use the same as stackexchange editor. Our editorial would like to add it to Staff Picks. – Vitaliy Kaurov Sep 20 '17 at 15:24

Chef, 465 bytes

H.

Ingredients.
72 l h
101 l e
108 l l
111 l o
44 l C
32 l S
87 l w
114 l r
100 l d
33 l X

Method.
Put X into mixing bowl.Put d into mixing bowl.Put l into mixing bowl.Put r into mixing bowl.Put o into mixing bowl.Put w into mixing bowl.Put S into mixing bowl.Put C into mixing bowl.Put o into mixing bowl.Put l into mixing bowl.Put l into mixing bowl.Put e into mixing bowl.Put h into mixing bowl.Pour contents of the mixing bowl into the baking dish.

Serves 1.

Tested with the Ruby interpreter. Makes alphabet soup.

I tried to be as compliant to the original spec as I could, so even though the interpreter I used lets you drop the thes in the Pour contents instruction, I haven't done so.

The mixing bowl is pretty expensive, so there might be a better approach. I tried using base conversion to encode the message, but unfortunately the spec doesn't clarify whether Divide uses integer or floating point division, and the interpreter I have uses the latter. There's also no modulo operator, which doesn't help either.

  • 19
    If anyone could golf in Chef it's Sp. – Alex A. Aug 28 '15 at 16:47
  • 10
    Now try golfing recipes in real life. :D – mbomb007 Jan 15 '16 at 19:24
  • 1
    Lol, this is not only not good to eat, but also uses non-standard measuring units. XD – thepiercingarrow Jun 29 '16 at 20:28

Dark, 106 bytes

+h hell
h$twist sign s
s$scrawl " Hello, World!
s$read
h$twist stalker o
o$stalk
o$personal
o$echo
h$empty

I'll just let some quotes from the language specification speak for the brilliance of this esolang:

Dark is a language based on manipulating entire worlds and dimensions to achieve goals and to build the best torturous reality possible.

Whenever a syntax error occurs, the program's sanity decreases by 1. [...] If the program's sanity reaches zero, the interpreter goes insane.

Corruption flips a single bit in the variable when it occurs.

When the master dies, all servant variables attached to that master also die. This is useful for grouping and mass killing variables.

Forces a variable to kill itself, freeing it (remember though that it will leave decay).

Sets a variable to a random value. Uses the Global Chaos Generator.

If a stalker is not initialized, any attempts to perform IO will result in depressing error messages to be written to the console.

  • 34
    This language is so metal. – Alex A. Sep 2 '15 at 19:53
  • 6
    If we had to list programming languages in order of evilness, Dark would top evil. – LukStorms Oct 2 '15 at 11:21
  • 29
    there is hell in hello – Khaled.K Dec 13 '15 at 8:13
  • super evil, you can even raise an army of walking gotos – bobrobbob Jun 11 at 12:48

Homespring, 58 bytes

Universe net hatchery Hello,. World!  powers a b snowmelt 

The trailing space is significant.

Let me tell you a story. There was once a power plant which powered a nearby salmon hatchery. The salmon hatchery hatched a young homeless salmon which embarked on a journey upriver to find a spring. It did find such a spring, with the poetic name "Hello, World!", where it matured and spawned a new young salmon. Both fish now swam downstream, in search of the wide ocean. But just short of the mouth of the river, there was a net in the river - the mature fish was caught and only the young one managed to slip through and reached the ocean and the rest of the universe. In the meantime, the hatchery had hatched more salmon which had travelled upstream as well and spawned and so on and so on.

However, vast amounts of melting snow had been travelling down a different arm of the river. And just after our first young salmon from the springs of "Hello, World!" has reached the ocean, the snowmelt hit the universe and... uh... destroyed it. And they lived happily ever after... or I guess they didn't.

Those were actually the semantics of the above program. Homespring is weird.

  • 14
    This is...weird... – kirbyfan64sos Sep 3 '15 at 22:35
  • 10
    I haz found a new favorite salmon-powered universe destroyer...uh...I mean "Hello, World!" program. +1 – ETHproductions Nov 21 '15 at 18:58
  • 7
    Every time I come back to this, I have a good laugh. Thanks for creating possibly the most entertaining Hello, World! program of all time. – ETHproductions Mar 14 '16 at 16:18
  • 2
    This is my new favorite language. – Mega Man Jul 8 '17 at 12:23
  • tio.run/#homespring – Dennis Apr 28 at 4:47
up vote 49 down vote
+200

Piet, 84 codels

Piet Hello World

28x3, here shown with codel width 10.

Created with PietDev, tested with npiet. The layout of the program is the following:

Piet Layout

Yellow fill indicates codels where the path overlaps, orange fill indicates codels which must be the same color, for purposes of control flow.

To aid in the creation of this, I wrote a rudimentary interpreter for a stack-based language with piet-like commands, which I have dubbed "pasm" (source). The output from this interpreter (with this input) is the following:

    1 nop     blu1 []
    4 push 3  blu2 [3]
    5 dup     grn2 [3, 3]
    6 add     cyn2 [6]
    7 dup     ylw2 [6, 6]
    8 mul     grn1 [36]
    9 dup     red1 [36, 36]
   10 dup     blu1 [36, 36, 36]
   11 add     mgn1 [36, 72]
H  12 putc    blu0 [36]
   15 push 3  blu1 [36, 3]
   16 sub     mgn2 [33]
   17 dup     cyn2 [33, 33]
   20 push 3  cyn0 [33, 33, 3]
   21 mul     blu2 [33, 99]
   22 push 1  blu0 [33, 99, 1]
   23 add     mgn0 [33, 100]
   24 dup     cyn0 [33, 100, 100]
   25 push 1  cyn1 [33, 100, 100, 1]
   26 add     blu1 [33, 100, 101]
e  27 putc    cyn0 [33, 100]
   28 dup     ylw0 [33, 100, 100]
   32 push 4  ylw1 [33, 100, 100, 4]
   33 dup     mgn1 [33, 100, 100, 4, 4]
   34 add     red1 [33, 100, 100, 8]
   35 add     ylw1 [33, 100, 108]
   36 dup     mgn1 [33, 100, 108, 108]
l  37 putc    blu0 [33, 100, 108]
   38 dup     grn0 [33, 100, 108, 108]
l  39 putc    ylw2 [33, 100, 108]
   40 dup     mgn2 [33, 100, 108, 108]
   43 push 3  mgn0 [33, 100, 108, 108, 3]
   44 add     red0 [33, 100, 108, 111]
   45 dup     blu0 [33, 100, 108, 111, 111]
o  46 putc    cyn2 [33, 100, 108, 111]
   47 dup     ylw2 [33, 100, 108, 111, 111]
   48 dup     mgn2 [33, 100, 108, 111, 111, 111]
   53 push 5  mgn0 [33, 100, 108, 111, 111, 111, 5]
   54 div     ylw0 [33, 100, 108, 111, 111, 22]
   55 dup     mgn0 [33, 100, 108, 111, 111, 22, 22]
   56 add     red0 [33, 100, 108, 111, 111, 44]
   57 dup     blu0 [33, 100, 108, 111, 111, 44, 44]
,  58 putc    cyn2 [33, 100, 108, 111, 111, 44]
   59 dup     ylw2 [33, 100, 108, 111, 111, 44, 44]
   60 add     grn2 [33, 100, 108, 111, 111, 88]
   64 push 4  grn0 [33, 100, 108, 111, 111, 88, 4]
   65 dup     red0 [33, 100, 108, 111, 111, 88, 4, 4]
   66 mul     ylw2 [33, 100, 108, 111, 111, 88, 16]
   67 dup     mgn2 [33, 100, 108, 111, 111, 88, 16, 16]
   68 add     red2 [33, 100, 108, 111, 111, 88, 32]
   69 putc    mgn1 [33, 100, 108, 111, 111, 88]
   70 push 1  mgn2 [33, 100, 108, 111, 111, 88, 1]
   71 sub     red0 [33, 100, 108, 111, 111, 87]
W  72 putc    mgn2 [33, 100, 108, 111, 111]
o  73 putc    blu1 [33, 100, 108, 111]
   76 push 3  blu2 [33, 100, 108, 111, 3]
   77 add     mgn2 [33, 100, 108, 114]
r  78 putc    blu1 [33, 100, 108]
l  79 putc    cyn0 [33, 100]
d  80 putc    grn2 [33]
!  81 putc    ylw1 []

No pointer, switch, or roll commands are used. No codels are wasted either; in fact two are reused.

  • Congrats, you got my bounty :) – LegionMammal978 Dec 25 '15 at 12:19
  • @LegionMammal978 Thanks, it was fun to work on. And merry christmas :) – primo Dec 25 '15 at 12:25
  • 2
    This is what hollywood should show on "hacker" screens. – Hubert Grzeskowiak May 29 '17 at 16:09

Whitespace, 192 150 146 bytes

Whitespace only needs spaces, tabs and linefeeds while other characters are ignored.
Which can be troublesome to display on here.
So in the code below the spaces & tabs were replaced.
And a ';' was put in front of the linefeeds for clarity.
To run the code, first replace . and > by spaces and tabs.

...;
..>>..>.>.;
..>>>>;
...>;
...>>>;
...>..;
..>>.>..;
..>>..>.>>;
..>>>>>>>;
...>..;
...>;
.;
...>>>.;
..>>...>>;
;
..;
.;
.;
>.>;
...>>.>.>>;
>...>;
..;
.;
;
;
..>;
;
;
;

Hexdump of code

00000000: 2020 200a 2020 0909 2020 0920 0920 0a20
00000010: 2009 0909 090a 2020 2009 0a20 2020 0909
00000020: 090a 2020 2009 2020 0a20 2009 0920 0920
00000030: 200a 2020 0909 2020 0920 0909 0a20 2009
00000040: 0909 0909 0909 0a20 2020 0920 200a 2020
00000050: 2009 0a20 0a20 2020 0909 0920 0a20 2009
00000060: 0920 2020 0909 0a0a 2020 0a20 0a20 0a09
00000070: 2009 0a20 2020 0909 2009 2009 090a 0920
00000080: 2020 090a 2020 0a20 0a0a 0a20 2009 0a0a
00000090: 0a0a

Whitespace assembly code:

push 0      ;null
push -74    ;! chr(33)
push -7     ;d chr(100)
push 1      ;l chr(108)
push 7      ;r chr(114)
push 4      ;o chr(111)
push -20    ;W chr(87)
push -75    ;  chr(32)
push -63    ;, chr(44)
push 4      ;o
push 1      ;l
dup         ;l
push -6     ;e chr(101)
push -35    ;H chr(72)
p:
 dup jumpz e
 push 107 add printc
 jump p
e:
 exit

Remarks:

I had to write a program just to calculate that adding 107 gives the optimal golf for the sentence. Since the bytesize that an integer takes in the code changes. : 4+int(abs(log2($n)))
The code will still run without the "e:" label & exit part on whitespace.kauaveel.ee. But that could make the whitespace code invalid on other whitespace compilers. So those bytes weren't golfed out from the solution.

It Should Be Noted That

As Kevin Cruijssen pointed out in the comments, by allowing an "exit by error" as per meta, the Whitespace can be golfcoded more to 126 characters.

..>>..>.>.;
..>>>>;
...>;
...>>>;
...>..;
..>>.>..;
..>>..>.>>;
..>>>>>>>;
...>..;
...>;
.;
...>>>.;
..>>...>>;
;
..;
...>>.>.>>;
>...>;
..;
.;
;

Assembly:

push -74
push -7
push 1
push 7
push 4
push -20
push -75
push -63
push 4
push 1
dup
push -6
push -35
label_0:
push 107
add 
printc
jmp label_0
  • I know it's been a while, and I see you're mentioning it does run without the exit-label on most compilers, but you can lower it to 129 bytes by exiting with an error using an SSN (error value) instead of SSSN (push 0), which is allowed according to the meta. Try it online (with added highlighting and explanation), or try it online raw. – Kevin Cruijssen Mar 16 at 15:44
  • @KevinCruijssen I finally checked your version. It's basically the old version with the assembly dup jumpz e and the e: exit removed. But at least on whitespace.kauaveel.ee it keeps on looping till the browser complains. I'd rather not change my version to that, despite the lower golf and the meta allowing "exit by error". But you're free to submit your version as a new answer. – LukStorms Mar 27 at 19:49
  • Nah, I won't post a separated answer. It's basically the same as yours, just a tiny bit shorter due to exit by error. I also just realized I can lower it to 126 instead of 129 by removing the SSN at the start, in which case it errors with Can't do Infix Plus when it only has a single item on the stack (the 107). (Try it online.) I'll just leave my comment here when anyone has the same suggestion. And I've already +1-ed your answer about a year ago I think. ;) – Kevin Cruijssen Mar 27 at 20:08
  • 1
    @KevinCruijssen In that case, your solution has now been noted in the answer. Whitespace is one of the most unlikely languages to golf in. But for the sake of saving bytes your findings are worth mentioning. – LukStorms Mar 27 at 20:35

HTML, 13 bytes

Hello, World!

The text is automatically inserted into the <body>, and is displayed.

  • 152
    Wow. That's some really hardcore coding skills – BlueWizard Aug 28 '15 at 22:06
  • 41
    HTML is not a programming language, but a markup language (that's why it ends with ML). – CoDEmanX Sep 3 '15 at 0:17
  • 28
    But HTML isn't printed in STDOUT. – Harshil Sharma Sep 4 '15 at 5:44
  • 23
    -1 HTML Doesn't meet the requirements for a valid language – Downgoat Sep 8 '15 at 0:25
  • 105
    -1 not enough jQuery – Valentin Lorentz Jun 1 '16 at 19:40

Java, 79

class H{public static void main(String[]a){System.out.print("Hello, World!");}}

Earlier versions of Java may allow you to use a static block (51 bytes), but currently I don't know of a way to bypass the main method.

  • 7
    Use enum instead of class. – Thomas Eding Aug 29 '15 at 7:41
  • 6
    @ThomasEding What compiler does that actually work on? I've tried this tip on several, and have never been able to save bytes with it. – Geobits Aug 29 '15 at 15:57
  • 4
    @Luminous Ah, it might have worked for 1.5. I'm not going to install it to find out, though, but stick to something released in the last 10 years. If I never see Java 5 again it'll be a nice life :) – Geobits Sep 1 '15 at 13:34
  • 2
    @TheDoctor From what I've seen, Processing is usually seen as a separate language here. You should post it as an answer, or at least ask for clarification from the OP. – Geobits Sep 2 '15 at 0:41
  • 5
    User OptiFine suggested saving 3 bytes by using an interface and ditching the public specifier. I've rejected the edit following policy but since they can't comment, I thought I'd let you know so you can use it if you like. – Martin Ender Apr 7 '16 at 9:09

CSS, 30 bytes

:after{content:"Hello, World!"

Cascading Style Sheets (CSS) isn't a typical programming language, but it can do fixed output fairly well. This is done by creating a pseudo-element after every element with the content Hello, World!. So only one element (<html>) is selected, this assumes that we're using the most basic HTML document, i.e.

<html><style>:after{content:"Hello, World!"</style></html>

This works in most major browsers, with the notable exception of Firefox, which applies the selector to the <html> and <body> elements. This is also why Stack snippets don't work, because there is always a body element that gets styled as well. Below is a slightly modified version to test.

* :after{content:"Hello, World!"

  • 3
    You can also use * * to select body. – jimmy23013 Aug 31 '15 at 7:50
  • 17
    @jimmy23013 That sounds gloriously inefficient. Thanks – NinjaBearMonkey Aug 31 '15 at 18:09
  • 1
    For whatever reasons * :after also seemed to work. – jimmy23013 Sep 1 '15 at 2:20
  • 10
    I'm asking my self which of the letters in CSS is the abrreviation for "language". – Zaibis Sep 7 '15 at 14:27
  • 8
    @zaibis the same letter for PHP probably :) – fcalderan Feb 2 '17 at 22:55

x86_64 machine code for Linux, 32 bytes

When Linux starts a new process, all the registers (except RSP) are zero, so we can get RAX=1 by only modifying the low byte. The x86-64 System V ABI doesn't guarantee this, but it's what Linux actually does. This code only works as _start in a static executable.

0000000000000000 <_start>:
   0:   e8 0d 00 00 00          call   12 <hello>
   5:   48 65 6c 6c 6f
   a:   2c 20 57 6f 72
   f:   6c 64 21 5e 40

0000000000000012 <hello>:
  12:   5e                      pop    rsi
  13:   40 b7 01                mov    dil,0x1
  16:   b2 0d                   mov    dl,0xd
  18:   b0 01                   mov    al,0x1
  1a:   0f 05                   syscall
  1c:   b0 3c                   mov    al,0x3c
  1e:   0f 05                   syscall

The call instruction pushes the next address, which contains the hello world string, onto the stack. We pop the address of the string into rsi.

Then the other arguments are set up for a syscall to sys_write, which prints the string.

The program terminates with a syscall to sys_exit. sys_write returns the number of bytes written, so the upper bytes of RAX are zero after the first syscall (unless it returned an error), so mov al, 60 gives us RAX = __NR_exit in only 2 bytes.

You can make this program segfault by closing its stdout (./a.out >&-), so sys_write() will return -EBADF, the second syscall will return -ENOSYS, and then execution will fall off the end. But we don't need to handle write() errors gracefully.

  • Specifically this only works on Linux, where __NR_write is 1. This is not standard across different x86-64 Unix systems. You're also depending on the Linux behaviour of zeroing all registers except RSP before entry into a fresh process (so this only works if you build it as a static executable, otherwise the dynamic linker will leave garbage in the upper bytes of rax and you'll get -ENOSYS). The x86-64 System V ABI says registers can hold arbitrary garbage values on entry to _start, the Linux kernel itself chooses zero them to avoid info leaks. – Peter Cordes Apr 13 at 3:40
  • You can save a byte with mov al, 1 / mov edi, eax (2 bytes), instead of needing a REX prefix for DIL, because __NR_write == STDOUT_FILENO = 1 – Peter Cordes Apr 13 at 3:43
  • This only works in a Linux static executable, so the address of your string is guaranteed to be in the low 2G of virtual address space (the default memory model for non-PIE executables puts all symbols where they can be used as zero or sign-extended 32-bit immediates). Thus you can use 5-byte mov esi, msg (NASM) aka mov esi, OFFSET msg (GAS .intel_syntax). Put your string after the last syscall. call/pop is 1 byte shorter than 64-bit RIP-relative LEA, but mov is best. – Peter Cordes Apr 13 at 3:48
  • NASM source for 30 byte version (checked size on my desktop), tio.run/##TY8/… – Peter Cordes Apr 13 at 4:11

Hexagony, 37 32 bytes

Notice: I'll be giving a bounty of 500 rep to the first person who finds a valid solution in a hexagon of side-length 3 or a provably optimal solution of side-length 4. If you can't find such a solution but manage to beat my score in a side-length 4 hexagon (by getting more no-ops at the end of the program, which can be omitted from the source code), I'm willing to give out a smaller bounty for that as well.

H;e;P1;@/;W;o;/l;;o;Q/r;l;d;2;P0

Try it online!

I proudly present my second 2D programming language, and (to my knowledge) the first ever 2D language on a hexagonal grid.

The source code doesn't look very 2D, does it? Well, whitespace is optional in Hexagony. First, the source code is padded to the next centred hexagonal number with no-ops (.). The next such number is 37, so we insert five no-ops at the end. Then the source code is rearranged into regular hexagon:

   H ; e ;
  P 1 ; @ /
 ; W ; o ; /
l ; ; o ; Q /
 r ; l ; d ;
  2 ; P 0 .
   . . . .

This is also runnable. Try it online!

Hexagony has a bunch of pretty funky features, including 6 different instruction pointers and a memory layout which is the line graph of a hexagonal grid, but this code uses only one IP and one memory edge, so let's not worry about that for now.

Here is an overview over the relevant commands:

  • Letters just set the current memory edge to their ASCII value
  • ; prints the current value, modulo 256, as a byte to STDOUT.
  • / is a mirror which behaves as you'd expect (causing the IP to take a 120 degree turn).
  • Digits work as they do in Labyrinth: they multiply the current cell by 10 and then add themselves.
  • @ terminates the program.

Now the final catch is that the source wraps around all 3 pairs of edges. Furthermore, if the IP leaves the grid through one of the six corners, there are two possible rows to jump to. Which one is chosen depends on whether the current value is positive or non-positive. The following annotated version shows where the IP re-enters each time it leaves the grid:

         H ; e ;     -> 1
5 ->    P 1 ; @ /    -> 4
3 ->   ; W ; o ; /   -> 2
1 ->  l ; ; o ; Q /
4 ->   r ; l ; d ;   -> 5
2 ->    2 ; P 0 .    -> 3
         . . . .

So if we remove all the direction changes, this program boils down to the following linear code:

H;e;l;;o;Q2;P0;W;o;r;l;d;P1;@

What's with Q2, P0 and P1? Letters are printed easily because we can just set the edge to the corresponding value. For the comma, the space and the exclamation mark, that doesn't work. We also can't just set their value with 44, 32, 33, respectively, because the memory edge is non-zero to begin with, and due to the semantics of individual digits that would wreak all sorts of havoc. If we wanted to do that, we'd have to reset the edge value to zero with something like *, +, -, & or ^ first. However, since the value is taken modulo 256 before being printed we don't have to set the values exactly to 44, 32, or 33. For instance, Q2 will set the edge value to 81*10 + 2 = 812, which is 44 when taken modulo 256. This way we can save a byte on each of those three characters. (Unfortunately, it's never possible to get there with a single digit from the value the cell already has. Amusingly, where it does work is the o in World, because that can also be obtained from W9.)

You can use this CJam script to find all letter-digit combinations that result in a given character.

I'm not sure whether this is optimal. I doubt it's possible to do it in a hexagon of side-length 3 (where you'd only have 19 characters available), but it might be possible to solve it in a hexagon with side-length 4 with less than 32 commands, such that there are more no-ops at the end of the grid.

  • 1
    Dammit, you beat me to it. I myself am working on a hexagonal language kind of similar to Cardinal. – M L Sep 14 '15 at 16:49
  • How did you find this solution? By hand or brute-force? Anyway, +1 :) – Adnan Jan 25 '16 at 15:19
  • 1
    The Q2, P0 and P1 is very clever. I didn't know the modulo 256 part. – Adnan Jan 25 '16 at 15:27
  • 1
    @Adnan The person who suggested the mod-256 part on GitHub actually did so along with the example that linefeeds could then be printed as M8; (or g4;), which I've used a couple of times since then. It just never occurred to me until now to revisit this answer after I made that change. – Martin Ender Jan 25 '16 at 15:29
  • 2
    Note: This was reduced to 31 a while ago. H;e;P;2Q/d;l;r/l;$@;o];o;W;03&; – Mitch Schwartz Oct 24 '16 at 10:00

Malbolge, 112 bytes

('&%:9]!~}|z2Vxwv-,POqponl$Hjihf|B@@>,=<M:9&7Y#VV2TSn.Oe*c;(I&%$#"mCBA?zxxv*Pb8`qo42mZF.{Iy*@dD'<;_?!\}}|z2VxSSQ

I'm going to see if there's a shorter one. Got a better computer since last time, so I can generate quite a bit faster.

For show, here's "Hello World!" without the comma.

(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc

Fourier, 15 bytes

BIG CHANGES to Fourier!

`Hello, World!`

Try it on FourIDE!

Yes, the days of typing out the ASCII code of each character are gone forever: Fourier now kind of supports strings. When you enclose a string in backticks, that string will be outputted.

Note that you can't do anything other than output that string: you cannot store it in a variable, it is not stored in the accumulator and there are no string manipulation tools.


Here, you can find the train wreck that was old Fourier. ;)

72a101a+7aa+3a44a32a87a111a+3a-6a-8a33a

Try it online!

Now, some of you will probably have met Fourier before and may be fairly familiar with the language. The whole language is based upon an accumulator: a global variable which pretty much all operators use.

The most important part of the code is the a operator. This takes the numerical value of the accumulator and converts it to a character using the Python code chr(accumulator). This is then printed to STDOUT.

Unfortunately, I haven't had the chance to use Fourier yet (nudge nudge, wink wink), mainly because of its lack of strings and string operators. Even so, it's still usuable for many other challenges (see the examples section of its EsoLangs page).

Note that this is shorter than my entry into the Esolangs list because I didn't actually think that I could golf it any more. And then, when writing the Fourier string golfing challenge, I realised I could go quite a bit shorter.

Note

If you were wondering about variable syntax, Geobits wrote a program which uses variables and is the same length:

72a101a+7aa+3~za44a32a87aza+3a-6a-8a/3a

Try it online!

  • What's a usuable? Is it like a usable? – CalculatorFeline Mar 25 '16 at 23:59

C--, 155 bytes

target byteorder little;import puts;export main;section"data"{s:bits8[]"Hello, World!\0";}foreign"C"main(){foreign"C"puts("address"s);foreign"C"return(0);}

Unfortunately, the only known C-- compiler, Quick C-- is no longer maintained. It's a pain in a neck to build, but it is possible...

  • 8
    Really fascinating language - I'd never heard of it before, and it's certainly an ambitious project that they (were/are) doing. But in terms of code golf, I don't think it'll be a contender. I mean ... dang, this thing loses to Java ... – AdmBorkBork Aug 28 '15 at 20:20
  • 10
    @TimmyD It's really an assembler. There's a reason it loses to Java... :) – kirbyfan64sos Aug 28 '15 at 20:21

C, 30 Bytes

main(){puts("Hello, World!");}

Fairly vanilla, but I can't think of a commonly compilable way to do it any shorter (unless maybe some kind of raw asm trick might work?). Still, beats most esolangs!

  • 3
    It's not worth a separate answer, but the fully ISO compliant C89 and C99 answers are 39 main(){puts("Hello, World!");return 0;} and 53 #include <stdio.h> int main(){puts("Hello, World!");} bytes respectively. Slightly more if you think main(void) is required. – Random832 Aug 28 '15 at 16:29
  • 20
    @Random832: for the former, main(){return!puts("Hello, World!");} is two bytes shorter. – Lynn Aug 28 '15 at 19:56
  • 13
    The program h is 29 bytes shorter. Note: you'll have to compile it with -Dh='main(){puts("Hello, World!");}' I'm half trolling, half amusing myself with compiler abuse. – matega Aug 29 '15 at 19:54
  • 16
    @matega That is clearly cheating. For it not to be cheating you'd have to make the file contain only __FILE__ (8 bytes) and name the file main(){puts("Hello, World!");}. Then it is totally not cheating ;) – C0deH4cker Sep 3 '15 at 8:12
  • Actually, by 2017 rules those would be 34 and 38 bytes respectively. – CalculatorFeline Jun 20 '17 at 21:23

Befunge 98, 19 18 Bytes

New answer (from undergroundmonorail)

"ck,@!dlroW ,olleH

Explanation

  • " starts string mode
  • Everything that follows is pushed to the stack. The stack is now Hello, World!@,kc
  • After hitting the end, interpreter go back to the start
  • It encounters " again, ending string mode
  • 12 is pushed to the stack (c)
  • k takes the top value of stack and executes the next command the instruction pointer can see that many times
  • , pops a value from stack and outputs it as a char. It has been executed 12 times by last k instruction, and one time more when the interpreter actually reads the , instruction
  • @ ends the program

The difference with the old answer is that we cleverly reuse the " character by using Befunge's looping behavior when it hits the end of the line. Since it might be less intuitive, I'm letting the old one as well. Also, you may have noticed that the stack will still contains some characters (ck,@) because of this nice trick, leaving some mess if we ever wanted to do something after that.

Old Answer

"!dlroW ,olleH"ck,@

This works for funge and befunge 98

Explanation

  • Everything between "" is pushed to the stack. ('H' is now on top.)
  • c (12) is pushed to the stack
  • k takes the top value of stack and executes the next command the instruction pointer can see that many times.
  • , pops a value from stack and outputs it as a char. It has been executed 12 times by last k instruction, and one time more when the interpreter actually reads the , instruction
  • @ ends the program
  • 2
    I don't think 93 has k – Sp3000 Aug 28 '15 at 14:30
  • 1
    Well, now that it's 98 only you can use c for 93+. – Pietu1998 Aug 28 '15 at 19:52
  • 3
    In 18: "ck,@!dlroW ,olleH – undergroundmonorail Sep 25 '15 at 19:07
  • 1
    It hits the " to start the string, adds the entire rest of the line to that string, wraps around and hits the same " to end the string. Now the whole program except that " has been pushed to the stack, with !dlroW ,olleH on top. Then it prints the top 12 characters the same way yours does and stops at @. – undergroundmonorail Sep 28 '15 at 17:40
  • 1
    For the 18 byte solution, my interpreter produces ` Hello, World` (leading space, no exclamation). The Anarchy Golf interpreter (use form, select Befunge-98, paste code, submit) does the same. – primo Sep 29 '15 at 12:14

Pada, 83 68 bytes

~.O~Ow~q~Owo~O~Oww~Q~qwo~q~O~wQ~q~w~q~q~Q~Ow~Q~Q~wo~q~w.~q~w.~.wO~qw

I believe this is optimal for a linear program (i.e. one which doesn't use the control flow operators ? and *). It might be optimal overall, but I don't know how to go about making use of those additional operators in such a small amount of code (or how to explore the possibilities programmatically).

The language has recently undergone some changes after I started discussing it with the author by email. However, I have written a reference implementation for the current state of the language spec last week, so the above code is actually runnable.

Metagolf

Originally, I had used the output of my reference implementation to this challenge and created a hand-crafted solution based on that. However, that was just a heuristic approach.

So instead I wrote a solver in Mathematica which actually knows about the Pada data structures and operators to find an optimal solution. On average, it grows linearly with the length of the string (although some character combinations are a bit slower than others) and took about 1.5 hours for Hello, World!.

So how did I go about writing the solver. First, we notice that we only need to consider 6 operators: ~.oOqQ (plus the necessary w for each of the printed characters). Using the stacks or the bit locks isn't useful in linear code, and I don't believe that ? and * can be used effectively in less than 68 bytes.

Pada's state (ignoring the stacks and locks) consists of 7 switches and 8 bits, arranged like this:

       /
   /       \
 /   \   /   /
0 1 0 0 1 0 0 0

So that's 215 = 32768 possible states. My first preprocessing step was to set up a directed graph of states where each edge corresponds to a single operation. That is, the graph has 32768 vertices, each with out-degree 6 (one outgoing edge for each of the 6 operations under consideration). We can use this graph to find the shortest path between any two states (this graph alone can be quite useful for golfing Pada).

Now for each character, we want to reach a state where w prints that character. How many such states are there? w reads the byte from the bit it is dropped on (cyclically). So there are 8 possible rotations of the bits of the character which can all print that character. For each of those rotations, three switches are fixed (in order to make w drop in the correct position). This leaves 4 arbitrary switches. So we've got 8 * 24 = 128 possible states for each w in our code.

With those we can solve another graph problem: construct a graph which has a source vertex, then one "layer" for each character, and a sink vertex. The layers consist of the 128 states for each vertex, the source node corresponds to the initial state of the program (all switches to the left and all bits are zero). The sink node corresponds to no state in particular. We've got directed edges from every vertex in one layer to every vertex in the next layer, where the edge weight is the distance between the two states in our earlier graph. The weights of the edges from the last layer to the sink are all 0. That is, we can precompute all those edge weights. This is the most expensive step of the computation and took 1.5 hours for Hello, World!.

With this graph set up, we can find the shortest path from the source to the sink quite quickly (it took 0.05s on my machine). For Hello, World! the desired states are:

0, 16960, 22052, 13828, 13828, 30389, 12487, 8307, 27299, 23450, 18922, 22778, 18682, 18459

where the least significant 7 bits correspond to the switches and the most significant 8 bits to Pada's bits.

Now we go back to the first graph and find the actual edges (i.e. operations) corresponding to the shortest path between each pair of subsequent states, and end each of them with a w. Voilà, an optimal solution (based on the above assumptions).

Here is the full Mathematica if anyone ever wants to metagolf a different string in Pada:

string = "Hello, World!";
width = StringLength@string;
getState[letter_, state_] := (
  {shift, switchState} = IntegerDigits[state - 1, 16, 2];
  bits = RotateRight[
    IntegerDigits[ToCharacterCode[letter][[1]], 2, 8], shift];
  switchState = IntegerDigits[switchState, 2, 4];
  switches = {-1, -1, -1, -1, -1, -1, -1};
  {top, middle, bottom} = IntegerDigits[shift, 2, 3];
  switches[[1]] = top;
  If[top < 1,
   switches[[2]] = middle;
   If[middle < 1,
    switches[[4]] = bottom,
    switches[[5]] = bottom
    ],
   switches[[3]] = middle;
   If[middle < 1,
    switches[[6]] = bottom,
    switches[[7]] = bottom
    ]
   ];
  For[i = 1, i <= 7, ++i,
   If[switches[[i]] < 0,
    switches[[i]] = First@switchState;
    switchState = Rest@switchState
    ]
   ];
  {bits, switches}
  )
encode[state_] := FromDigits[Join @@ state, 2]
decode[id_] := Partition[IntegerDigits[id, 2, 15], 8, 8, 1, {}]
getBitFromSwitches[switches_] := (
  If[switches[[1]] < 1,
   If[switches[[2]] < 1,
    1 + switches[[4]],
    3 + switches[[5]]
    ],
   If[switches[[3]] < 1,
    5 + switches[[6]],
    7 + switches[[7]]
    ]
   ]
  )
toggle[list_, index_] := ReplacePart[list, index -> 1 - list[[index]]]
stateEdges = Flatten@Table[
    {bits, switches} = decode@id;
    bit = getBitFromSwitches@switches;
    {
     Labeled[id \[DirectedEdge] encode@{bits~toggle~bit, switches}, 
      "~"],
     Labeled[id \[DirectedEdge] encode@{bits, switches~toggle~1}, "."],
     If[switches[[1]] < 1,
      {
       Labeled[id \[DirectedEdge] encode@{bits, switches~toggle~2}, 
        "o"],
       Labeled[
        id \[DirectedEdge] encode@{bits, switches~toggle~1~toggle~3}, 
        "q"],
       If[switches[[2]] < 1,
        Labeled[id \[DirectedEdge] encode@{bits, switches~toggle~4}, 
         "O"],
        Labeled[id \[DirectedEdge] encode@{bits, switches~toggle~5}, 
         "O"]
        ],
       If[switches[[3]] < 1,
        Labeled[
         id \[DirectedEdge] 
          encode@{bits, switches~toggle~1~toggle~3~toggle~7}, "Q"],
        Labeled[
         id \[DirectedEdge] 
          encode@{bits, switches~toggle~1~toggle~3~toggle~6}, "Q"]
        ]
       },
      {
       Labeled[id \[DirectedEdge] encode@{bits, switches~toggle~3}, 
        "o"],
       Labeled[
        id \[DirectedEdge] encode@{bits, switches~toggle~1~toggle~2}, 
        "q"],
       If[switches[[3]] < 1,
        Labeled[id \[DirectedEdge] encode@{bits, switches~toggle~6}, 
         "O"],
        Labeled[id \[DirectedEdge] encode@{bits, switches~toggle~7}, 
         "O"]
        ],
       If[switches[[2]] < 1,
        Labeled[
         id \[DirectedEdge] 
          encode@{bits, switches~toggle~1~toggle~2~toggle~5}, "Q"],
        Labeled[
         id \[DirectedEdge] 
          encode@{bits, switches~toggle~1~toggle~2~toggle~4}, "Q"]
        ]
       }
      ]
     }
    ,
    {id, 0, 2^15 - 1}];
stateGraph = 
  Graph[# & @@@ stateEdges, EdgeLabels -> Rule @@@ stateEdges];
uid = 0;
layers = Join[{{{uid++, 0}}}, 
   Table[{uid++, encode@getState[#, i]}, {i, 128}] & /@ 
    Characters@string, {{{uid++, -1}}}];
edges = Flatten[Table[
      from \[DirectedEdge] to
      ,
      {from, #},
      {to, #2}
      ] & @@@ Partition[layers, 2, 1], 2];
Timing[weights = (
     {from, to} = Last /@ List @@ #;
     If[to < 0,
      0,
      GraphDistance[stateGraph, from, to]
      ]
     ) & /@ edges;]
characterGraph = Graph[edges, EdgeWeight -> weights];
Timing[path = 
  Last /@ Most@
    FindShortestPath[characterGraph, {0, 0}, layers[[-1]][[1]]]]
(PropertyValue[{stateGraph, #}, EdgeLabels] & /@ 
      DirectedEdge @@@ 
       Partition[FindShortestPath[stateGraph, ##], 2, 1] <> "w" & @@@ 
   Partition[path, 2, 1]) <> ""
  • An interesting language to do metagolf on =). This makes me wonder, what's your day job? o.O – justhalf Aug 29 '15 at 15:08
  • 4
    @justhalf I'm currently in limbo between a master's degree and PhD studies (so I've definitely got too much time on my hands if that was your implication ;)). (This is generally more of a discussion for chat though :)) – Martin Ender Aug 29 '15 at 16:00
  • Pada means when in bahasa Indonesia/Malay. Is that relevant? – XiKuuKy Oct 28 '16 at 15:28
  • @XiKuuKy afaik, the language is called Pada, because it means "falling" in Croatian. – Martin Ender Oct 28 '16 at 19:41
  • And this answer to (see here ). You probably can combine 2 answers in one to describe this wonderful Hello World problem in general. – Vitaliy Kaurov Sep 20 '17 at 15:30

Brainfuck, 92 (hirose)

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

This is a slight modification of hirose's 92-byte solution for the lowercase-w version of the problem on Anarchy Golf.

Changing ++ to -- conveniently subtracts 32 from the cell that holds w, turning it into W.

Brainfuck, 95

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

For this solution, I used code that I wrote for this problem on SPOJ and touched up the output a bit by hand.

Note: Both solutions are compatible with Alex Pankratov's bff (brainfuck interpreter used on SPOJ and ideone) and Thomas Cort's BFI (used on Anarchy Golf).

  • Here's the variant for a brainfuck derivative, oOo code: pastebin.com/BqNcDnm7 I'm not sure if it deserves its own answer. (It's based on the 92-char one you posted) – JNV Aug 30 '15 at 8:41
  • What is the advantage of the 95-byte solution? Why mention it at all? – anatolyg Aug 31 '15 at 14:29
  • 2
    @anatolyg The 92 is my modification of hirose's solution. The 95 is another solution that I developed from scratch. If you can't see the value of mentioning alternative approaches, or of distinguishing your own work from (trivial or non-trivial) modifications of someone else's code, I don't know what to say. This type of thing is standard practice on Anarchy Golf, and I'd be happy to see it catch on here as well. Incidentally, I've been informed that the 95 translates to 97 in ???, while the 92 translates to 98. – Mitch Schwartz Aug 31 '15 at 16:04
  • (I was misinformed; it's 95 -> 96 and 92 -> 97 for ???.) – Mitch Schwartz Aug 31 '15 at 20:29

Unreadable, 843 755 732 666 645 629 577 bytes

'"'""'""'""'"'"'""""""'""'"""'""'""'""'""'""'""'""'"'""'""""""'""'""'""'"""'""'""'""'""'""'""'""'""'""'""'""'""'""'""""""'""'""'"""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'"'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""""""'""""""""'"""'""'""'""'""'""'""'""'""'""'""'""'""'""""""'"""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'"""'"'"""""""'""""""""'"""'"'"""""""'"""'"'"""""""'""'""'"""'"'""'""'""'"'""'""'""'"""""""'""'"""'"'"""""""'""'"""'"'"""""""'""'""'""'"""'"'""'"""""""'"""

Unreadable programs are supposed to be displayed with a variable-width font, so they honor the language's name. I'm slightly disappointed that my more sophisticated approaches turned out to be a lot longer. Loops are insanely expensive in Unreadable...

Try it online!

How it works

Unreadable has only ten functions; six of these are used in this code:

'"        p Print.
'""       + Increment.
'"""      1 Return 1.
'""""""   : Set.
'"""""""  = Get.
'"""""""" - Decrement.

After using my single-character notation and adding some whitespace and comments, the above code looks like the following. Multi-line statements are executed from bottom to top.

p+++                                        Print 3 + variable 2 (o).
 pp                                         Print variable 2 two times (l).
  :+1+++++++                                Save 8 + variable 3 in variable 2.
   p+                                       Print 1 + variable 3 (e).
    :++1+++++++++++++                       Save 13 + variable 4 in variable 3.
     :+++1+++++++++++++++                   Save 43 + variable 0 in variable 4.
      p++++++++++++++++++++++++++++         Print 28 + variable 0 (H).
       :-1++++++++++++                      Save 44 in variable 0.
        :1+++++++++++++++++++++++++++++++1  Save 32 in variable 1.
p=-1                                        Print variable 0 (,).
p=1                                         Print variable 1 ( ).
p=+++1                                      Print variable 4 (W).
p+++                                        Print 6 + variable 2 (r).
 p+++=+1                                    Print 3 + variable 2 (o).
p=+1                                        Print variable 2 (l).
p=++1                                       Print variable 3 (d).
p+=1                                        Print 1 + variable 1 (!).

I've generated the actual source code by running the uncommented version of the above pseudocode through this CJam program.

  • 3
    What are you talking about? Its pretty readable! – Optimizer Sep 3 '15 at 19:03
  • 18
    @Optimizer Fixed. – Dennis Sep 3 '15 at 19:06
  • 4
    Still readable! (of course I am telling the truth. Why won't you believe me?) – Optimizer Sep 3 '15 at 19:10
  • 5
    Feels like this language would benefit from a better huffman coding - both in terms of size, and unreadability. – primo Sep 29 '15 at 9:05

protected by Community Oct 6 at 10:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.