474
\$\begingroup\$

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>

\$\endgroup\$
21
  • 3
    \$\begingroup\$ @isaacg No it doesn't. I think there would be some interesting languages where it's not obvious whether primality testing is possible. \$\endgroup\$ – Martin Ender Aug 28 '15 at 13:56
  • 6
    \$\begingroup\$ If the same program, such as "Hello, World!", is the shortest in many different and unrelated languages, should it be posted separately? \$\endgroup\$ – aditsu quit because SE is EVIL Aug 28 '15 at 15:33
  • 2
    \$\begingroup\$ @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. \$\endgroup\$ – Martin Ender Aug 28 '15 at 19:34
  • 8
    \$\begingroup\$ @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. \$\endgroup\$ – Martin Ender Aug 29 '15 at 23:01
  • 2
    \$\begingroup\$ @MartinEnder ... Almost. If two BF solutions have the same size, the one with smaller lexicographical order will take smaller number of bytes in Unary. Of course the smallest Unary solution translated to BF is guaranteed to be smallest. \$\endgroup\$ – user202729 May 20 '18 at 10:20

857 Answers 857

1
3 4
5
6 7
29
7
\$\begingroup\$

Plumber, 1606 445 bytes

[]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
[[]=]=]=]=]=]=]
]
[[]=]=]=]=]=]=]=]=]=]=]=]=]
]
]
]
]
]
]
]
]
]
]
]
[[]=]=]=]=]=]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
[[]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
[[]=]=]=]=]=]=]=]
]
]
]
]
]
]
]
]
]
]
]
]
]
[[]=]=]=]=]=]=]=]=]=]=]=]
]
[[]=]
]
]
]
]
]
]
]
]
[[]=]=[[[[]=]=]=]=]=]=[]
]
]
]
[[]=]=]=]=[[]=]=]=[]
]
]
]
][]=]=]=]=]=]=]=]=]=[]
]]]]]]]]]]]]]]]]]]]]]]]]]]]]
][[=

With some modifications of an idea by @dzaima, I've golfed 1161 bytes off of this. This one uses a single falling packet, incrementing each time it falls, and forks it off each time it reaches the right value to be outputted.

Old version

[]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
[[[[[[[[[[[[[[[[[[[[[[[[[[
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ] ]   ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
] ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
  ] ] ] ]     ]
              [[[[[[[[[]]
  ] ] ] ]     [ ]
    ] ] ]     [ ]
    ] ] ]     [ ]
    ] ] ]     [ ]
    ] ] ]     [ ]
    ] ] ]     [ ]
    ] ] ]     [ ]
    ] ] ]     [ ]
                [[[[[[
        ]     [ ] ]
        ]     [ ] ]
        ]     [ ] ]
              [   ]
              [   ]
              [   ]
              [
              [
              ]
              ]
              ]
]]]]]]]]]]]]]]]]]]]]]]]]]]
][[=

It's a little long. I could probably steal some tricks from a BF solution, maybe.

In Plumber, the program is divided into units, each of which are 2 characters wide. Each line is padded to the length of the longest line with spaces, which can be used to shorten programs. Each ] unit is an increment operator on a falling packet of information, which is dropped by the [] at the top. Chains of [[ can be used to duplicate packets and drop them one by one in different columns.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ @downvoter Please explain? I worked pretty hard to golf this down from over 2500 bytes. It's a new language, but according to the challenge spec, Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge. \$\endgroup\$ – Redwolf Programs Dec 9 '19 at 23:50
  • 2
    \$\begingroup\$ Wish I could vote this up a second time; sweet golf! \$\endgroup\$ – squid Dec 11 '19 at 11:36
7
\$\begingroup\$

evil, 62 58 bytes

no I haven't read through the over 500 other answers to make sure I'm adding something new
Found via computer search within a restricted subset of evil.

aeeaeayekeulaaaweevuewpuuuwwlweaaewguwuewpaaawaaawpweeawgw

Uses the instructions:

a increment the accumulator
u decrement the accumulator
z accumulator = 0
e weave operator (bitwise 01234567 to 20416375 on the accumulator)
w write character
k set the first pental cell to the accumulator
g set the accumulator to the first pental cell
v swap the accumulator and the first pental cell
y set the first wheel cell to the accumulator
l set the accumulator to the first wheel cell
p swap the accumulator and the first wheel cell

The pental is a thingy that stores 5 bytes and can be rotated; I don't rotate it though. The wheel is a circular list that starts at 1 element; I don't add/remove to/from it.

Try it online!

\$\endgroup\$
7
\$\begingroup\$

Mornington Crescent, 3328 3271 bytes

Take Northern Line to Leicester Square
Take Piccadilly Line to Heathrow Terminals 1, 2, 3
Take Piccadilly Line to Holborn
Take Central Line to Holborn
Take Central Line to Bank
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Parsons Green
Take District Line to Bank
Take District Line to Hammersmith
Take District Line to Bow Road
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Parsons Green
Take District Line to Parsons Green
Take District Line to Gunnersbury
Take District Line to Paddington
Take District Line to Hammersmith
Take District Line to Parsons Green
Take District Line to Bank
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Barking
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 District Line to Parsons Green
Take District Line to Elm Park
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminal 5
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green
Take District Line to Bank
Take District Line to Hammersmith
Take District Line to Plaistow
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to Elm Park
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Hammersmith & City Line to Barking
Take Hammersmith & City Line to Paddington
Take Circle Line to Paddington
Take Bakerloo Line to Piccadilly Circus
Take Bakerloo Line to Piccadilly Circus
Take Piccadilly Line to Turnpike Lane
Take Piccadilly Line to Turnpike Lane
Take Piccadilly Line to Leicester Square
Take Northern Line to Leicester Square
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Westminster
Take District Line to Gunnersbury
Take District Line to Bow Road
Take District Line to Bank
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Aldgate
Take Metropolitan Line to Chorleywood
Take Metropolitan Line to Aldgate
Take Circle Line to Aldgate
Take Circle Line to Bank
Take District Line to Bow Road
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Plaistow
Take District Line to Gunnersbury
Take District Line to Mile End
Take Hammersmith & City Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Mile End
Take District Line to Bow Road
Take District Line to Mile End
Take Hammersmith & City Line to Paddington
Take Circle Line to Paddington
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!

-57 bytes by using shorter lines and transfer stations

Short explanation: I extract following strings:

Heathrow Terminals 1, 2, 3 (also extracting the numbers for some operations)
--                     --

Holloway Road
  ---

Westminster
-

Chorleywood
  ---     -

The strings are cut in pieces, using the left and right substring functions of Gunnersbury and Mile End with the integers of "Heathrow Terminals 1, 2, 3" and "Heathrow Terminal 5" (which can be extracted using Parsons Green).

Then I concatenate them in Paddington and append a "!" by using the char code of (space)+1.

Source:

// ### Milestone: Extract "He", 1, 2, ", " from "Heathrow Terminals 1, 2, 3"

// Get "Heathrow Terminals 1, 2, 3"
Take Northern Line to Leicester Square
Take Piccadilly Line to Heathrow Terminals 1, 2, 3

// Copy that string
Take Piccadilly Line to Holborn
Take Central Line to Holborn
Take Central Line to Bank // Hammersmith = "Heathrow Terminals 1, 2, 3"

// Prepare for left substring
Take District Line to Hammersmith
Take District Line to Gunnersbury // Gunnersbury = "Heathrow Terminals 1, 2, 3"

// Extract 1 from "Heathrow Terminals 1, 2, 3"
Take District Line to Hammersmith
Take District Line to Parsons Green // Acc = 1, Parsons Green = ", 2, 3"

// Copy and store it somewhere (Parsons Green only returns its stored value if it gets a number)
Take District Line to Bank // Hammersmith = 1
Take District Line to Hammersmith
Take District Line to Bow Road // Bow Road = 1

// Store it in Upminster for later calculations
Take District Line to Hammersmith
Take District Line to Upminster

// Store 2
Take District Line to Hammersmith
Take District Line to Parsons Green // Acc = ", 2, 3"
Take District Line to Parsons Green // Acc = 2, Parsons Green = ", 3"

// Get "He"
Take District Line to Gunnersbury

// Store it in Paddington for concatenation
Take District Line to Paddington // Paddington = "He"

// Extract ", " from ", 3"
Take District Line to Hammersmith
Take District Line to Parsons Green
Take District Line to Bank
Take District Line to Hammersmith
Take District Line to Gunnersbury // 2 was still stored in Gunnersbury

// Store it somewhere
Take District Line to Barking // Barking = ", "

// ### Milestone: Extract "llo" from "Holloway Road"

// Get "Holloway Road"
Take District Line to Acton Town
Take Piccadilly Line to Holloway Road

// Prepare for left substring
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Gunnersbury // Gunnersbury = "Holloway Road"

// Store 3
Take District Line to Hammersmith
Take District Line to Parsons Green // Acc = 3
Take District Line to Elm Park // Elm Park = 3

// Get 5 from "Heathrow Terminal 5"
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminal 5
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green // Acc = 5

// Copy and Store it somewhere
Take District Line to Bank
Take District Line to Hammersmith
Take District Line to Plaistow // Plaistow = 5

// Get "Hollo" from "Holloway Road"
Take District Line to Hammersmith
Take District Line to Gunnersbury // Gunnersbury = 5

// Prepare for right substring
Take District Line to Mile End // Mile End = "Hollo"

// Get "llo" from "Hollo"
Take District Line to Elm Park
Take District Line to Mile End

// Append it to "He"
Take District Line to Paddington
Take Circle Line to Paddington

// Append ", "
Take Hammersmith & City Line to Barking
Take Hammersmith & City Line to Paddington
Take Circle Line to Paddington // Paddington = "Hello, ", Acc = ", Hello, "

// ### Milestone: Get "!" by adding 1 to char value of " "
// Reverse acc
Take Bakerloo Line to Piccadilly Circus
Take Bakerloo Line to Piccadilly Circus
Take Piccadilly Line to Turnpike Lane
Take Piccadilly Line to Turnpike Lane

// Get ASCII value of " "
Take Piccadilly Line to Leicester Square
Take Northern Line to Leicester Square
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross // Acc = 32

// Add 1
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Upminster // 1 was stored in Upminster earlier
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross // Charing Cross = 33

// ### Milestone: Append "W" from "Westminster"
// Get "Westminster"
Take Northern Line to Bank
Take Circle Line to Westminster

// Get "W"
Take District Line to Gunnersbury // Gunnersbury = "Westminster"
Take District Line to Bow Road
Take District Line to Bank
Take District Line to Hammersmith
Take District Line to Gunnersbury

// Append it to "Hello, "
Take District Line to Paddington
Take Circle Line to Paddington

// ### Milestone: Append "orl" and "d" from "Chorleywood"
// Get "Chorleywood"
Take Circle Line to Aldgate
Take Metropolitan Line to Chorleywood

// Save it for copy
Take Metropolitan Line to Aldgate
Take Circle Line to Aldgate
Take Circle Line to Bank

// Bank had 1 in it, so save it for later
Take District Line to Bow Road

// prepare left substring
Take District Line to Hammersmith
Take District Line to Gunnersbury

// get "Chorl"
Take District Line to Plaistow
Take District Line to Gunnersbury

// get "orl"
Take District Line to Mile End // 3 is still stored in Mile End

// append it to "Hello, W"
Take Hammersmith & City Line to Paddington
Take Circle Line to Paddington

// get "d"
Take Circle Line to Hammersmith
Take District Line to Mile End
Take District Line to Bow Road
Take District Line to Mile End

// append it to "Hello, Worl"
Take Hammersmith & City Line to Paddington
Take Circle Line to Paddington

// get "!" and append it to "Hello, World"
Take Bakerloo Line to Charing Cross
Take Bakerloo Line to Paddington

// go home
Take Circle Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent
\$\endgroup\$
7
\$\begingroup\$

ARM (Thumb), 29 bytes

Assembly:

.section .text
.global _main
.thumb
_main:
    mov r7, #4         // 2704   syscall #4 (write)
    mov r0, #1         // 2001   fd #1 = stdout
    add r1, pc, #8     // a102   string address = (pc+4) + 8 (msg)
    mov r2, #13        // 220d   string length = 13
    svc #0             // df00   write(1, msg, 13)

    mov r7, #1         // 2701   syscall #1 (exit)
    mov r0, #0         // 2000   exit code 0
    svc #0             // df00   exit(0)

msg: .ascii "Hello, World!" // 13 bytes, without trailing newline

How to run this on Ubuntu:

sudo apt-get install qemu-user qemu-user-static build-essential gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf binutils-arm-linux-gnueabihf-dbg
# build and run as Thumb executable
arm-linux-gnueabihf-as main.as -o main.o
arm-linux-gnueabihf-ld --thumb-entry=_main main.o -o main
qemu-arm -L /usr/arm-linux-gnueabihf ./main
# see disassembly and calculate machine code size
arm-linux-gnueabihf-objdump -d main

Most parts of the instructions and the code structure are from this guide. A full Thumb instruction set reference can be found in this pdf, but I couldn't find any easier-to-lookup reference.

25 bytes (exits by segfault)

.section .text
.global _main
.thumb
_main:
    mov r7, #4         // 2704   syscall #4 (write)
    mov r0, #1         // 2001   fd #1 = stdout
    add r1, pc, #4     // a102   string address = (pc+4) + 4 (msg)
    mov r2, #13        // 220d   string length = 13
    svc #0             // df00   syscall
    nop                // 46c0   for 4-byte alignment of msg

msg: .ascii "Hello, World!"

While it is possible to call puts and similar by dynamically linking to libc, I don't think it's fair to discount the glue code generated by the linker (single puts call adds 36 bytes as section .plt).

\$\endgroup\$
6
\$\begingroup\$

J, 15 bytes

'Hello, World!'

No call to any write function needed.

\$\endgroup\$
6
\$\begingroup\$

APL, 17 bytes

⎕←'Hello, World!'

This is the portable way of printing from a full program.

In the ngn/apl demo, you can omit the ⎕← for 15 bytes.

\$\endgroup\$
6
\$\begingroup\$

Pascal, 32 bytes

begin write('Hello, World!')end.
\$\endgroup\$
6
\$\begingroup\$

Beatnik, 148 Bytes

It could probably be done better, but this is one of the first times I used a stack based language.

Beatnik determines commands and values based in the scrabble score for the words, but it (thankfully) doesn't check them against a dictionary.

K QQQQQQQG ZD XO K QQJA KD ZD XO K KG KD ZD ZD ZD XO XO K B KD ZD XO K QQQQF ZD ZD XO K QQQD XO K A Z KD XO ZD XO K B KD XO ZD XO K J Z XO K QQQB XO

Python interpreter can be found here

A breakdown of what I've done

K QQQQQQQG  # push 72         72
ZD          # duplicate       72 72
XO          # output H        72            
K QQJA      # push 29         29 72
KD          # add             101
ZD          # duplicate       101 101
XO          # output e        101           
K KG        # push 7          7 101
KD          # add             108
ZD          # duplicate       108 108
ZD          # duplicate       108 108 108
ZD          # duplicate       108 108 108 108
XO          # output l        108 108 108   
XO          # output l        108 108       
K B         # push 3          3 108 108
KD          # add             111 108
ZD          # duplicate       111 111 108
XO          # output o        111 108       
K QQQQF     # push 44         44 111 108    
ZD          # duplicate       44 44 111 108
ZD          # duplicate       44 44 44 111 108
XO          # output ,        44 44 111 108
K QQQD      # push 32         32 44 44 111 108    
XO          # output <space>  44 44 111 108              
K A         # push 1          1 44 44 111 108
Z           # subtract        43 44 111 108
KD          # add             87 111 108
XO          # output W        111 108    
ZD          # duplicate       111 111 108
XO          # output o        111 108       
K B         # push 3          3 111 108
KD          # add             114 108
XO          # output r        108           
ZD          # duplicate       108 108
XO          # output l        108           
K J         # push 8          8 108
Z           # subtract        100           
XO          # output d                      
K QQQB      # push 33         33
XO          # output                        
\$\endgroup\$
2
  • \$\begingroup\$ Can you add Scrabble scores to the explanation? \$\endgroup\$ – CalculatorFeline Jun 5 '17 at 4:34
  • \$\begingroup\$ The version using valid scrabble words is only 100 bytes longer. \$\endgroup\$ – The Fourth Marshal Aug 2 '17 at 0:44
6
\$\begingroup\$

Prolog, 23 bytes

write('Hello, World!').
\$\endgroup\$
5
  • \$\begingroup\$ What did you use to define a string if you didn't use "? \$\endgroup\$ – Beta Decay Aug 28 '15 at 12:57
  • 1
    \$\begingroup\$ @BetaDecay Nothing, strings didn't exist as far as I know. So using " to create strings would create an array of character codes (ie ascii/unicode codes) representing the string. Character codes strings is created with backquotes in SWI-Prolog now. \$\endgroup\$ – Fatalize Aug 28 '15 at 13:01
  • \$\begingroup\$ You can use single quotes to turn this into an atom, and thus make the program completely portable: write('Hello, World!'). More declaratively, I would simply define a a fact like: msg('Hello, World!').. Usage example: ?- msg(M)., succeeding with M = 'Hello, World!'.. \$\endgroup\$ – mat Sep 1 '15 at 12:18
  • \$\begingroup\$ @mat Good suggestion that I use atoms instead of strings. For the msg('Hello, World!') though, I don't think it's valid in this challenge because it outputs M = 'Hello, World!'. instead of just Hello, World! (granted, it also outputs true after in my answer but I assume this is acceptable because Prolog really likes to output true or false :)) \$\endgroup\$ – Fatalize Sep 1 '15 at 12:25
  • \$\begingroup\$ I know, the way this challenge is formulated kind of forces you to use impure langauge elements. Too bad! (BTW: The last sentence of your post is no longer applicable.) \$\endgroup\$ – mat Sep 1 '15 at 12:27
6
\$\begingroup\$

C++, 48 bytes

(must be compiled with g++)

puts is slightly more concise than std::cout, shaving 6 bytes off of the other c++ answer.

#include<cstdio>
main(){puts("Hello, World!");}
\$\endgroup\$
11
  • 1
    \$\begingroup\$ With g++, you can eliminate the space on line 1 and the int on line 2. \$\endgroup\$ – Dennis Aug 29 '15 at 3:56
  • \$\begingroup\$ @Dennis, done. I think this is the shortest possible in C++. \$\endgroup\$ – DJMcMayhem Aug 29 '15 at 7:02
  • 4
    \$\begingroup\$ This is not legal C++ code. The return type of main must be int and cannot be empty. \$\endgroup\$ – Hubi Aug 31 '15 at 9:34
  • 1
    \$\begingroup\$ @DJMcMayhem The fact, that compiler compiles something, does not mean, that it is correct. C++ does not support default int. \$\endgroup\$ – Zereges Oct 25 '15 at 11:20
  • 1
    \$\begingroup\$ It's 47 bytes, not 48 \$\endgroup\$ – ASCII-only Aug 18 '17 at 12:14
6
\$\begingroup\$

NULL, 91 bytes

int("8bxyd2qvpj6uq6gh9u8hlrjfwqkx8i2pvid5auhrsrbpp8gsczv6ye26ew0pkx05wem94m9zqkn8prqir",36)

This number represents a program, and it has 126 digits in decimal representation. I use base-36 here to shorten the number. It seems acceptable because the interpreter of NULL uses the python eval on the program before executing it (presumably to allow specifying the program as a product of prime numbers). The prime factorization (used while executing the program) is

3*3*3*17*31*73*127*139*151*157*167*197*239*241*307*367*367*419*479*499*
547*599*619*677*751*839*919*947*947*1019*1039*1097*1129*1217*1249*1301*
1303*1327*1433*1499*1543*1613*1709*1777*1873*1951*1993*2063

I found this program by using something like A* search. It tracks the state of the NULL interpreter and two additional values:

  • print - number of characters in the Hello, World! message it managed to output so far
  • length - natural logarithm of the number that represents the program

For each state, it picks 10 possible commands the language has (there are 14, but the rest are too uncomfortable to search), and calculates 10 new states. To find the shortest program, it holds the states in a priority_queue, arranged by the following cost function:

print - length / 25

If I use a fudge factor much different from 25, it either keeps searching forever (until it eats all RAM) or finds sub-optimal solutions.


BTW there is a bug in the interpreter in the generation of prime numbers. I fixed it by simplifying the code this way:

def factor_g(include_builtin_list = True):
    if include_builtin_list:
        for x in plist: yield x
    k = plist[-1] + 2
    while True:
        yield k
        k += 2
\$\endgroup\$
0
6
\$\begingroup\$

Mascarpone, 29 bytes

[!dlroW ,olleH]$.............

The esolangs page notes that

from a typical programmer's point of view, it is not obvious how to program in it

In fact, although the language's designer believes it to be Turing complete, and I personally respect his expertise in esoteric languages enough to take it on trust that it's at the very least a non-trivial language, I haven't figured out how to write a loop. So what this does is to push the characters [!dlroW ,olleH] onto the stack (the [] delimiters are necessary, and do for some reason end up on the stack too), pop the ] with $, and then print everything except the [, one character at a time.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ I know this is way late, but you can loop by having an operation call itself [!dlroW ,olleH]$[/.:!]v*:! \$\endgroup\$ – BlackCap Jul 21 '17 at 14:57
6
\$\begingroup\$

Shtriped, 199 bytes

e n
e b
i b
+ x y
 +
  i x
  d y
  +
 +
 d x
0
 + b b b
1
 + b n n
 0
A
 1
 0
B
 0
 1
1
1
1
A
0
0
B
1
1
A
0
A
0
0
B
1
A
0
B
A
0
B
1
A
A
A
0
0
B
A
A
1
A
B
A
A
1
1
1
A
A
B
1
A
B
1
A
A
1
A
A
A
1
A
B
s n

(Tested in v1.0.0. Does not output trailing newline.)

Shtriped has no strings, only non-negative arbitrary precision integers. But you can print strings by encoding them as integers.

The integer that encodes Hello, World is 46758282851806618588827407. Every two digits essentially encodes one character in offset ASCII order, 82 is l, 85 is o, etc. The program basically declares the variable n to 0, and increments it one by one until it is 46758282851806618588827407, then prints it as a string. (In Shtriped, any integer larger than 0 needs to be incremented one by one to get there.)

Incrementing that high is obviously impossible in any reasonable amount of time, (a 3Ghz processor could maybe do it in 500 million years) so don't run this program, you will never see it finish! However, I am certain that it would finish, it if had the time. It should never run out of memory or have a stack overflow thanks to tail recursion optimization.

To explain what's really happening, here's a nearly identical program that will finish in a few seconds, outputting Hel. Everything is the same except the large column of 01AB's above the last line.

e n \ declare n to 0, this is the variable that will be incremented to that huge number 
e b \ declare b to 0, this is the binary place value that will keep getting doubled
i b \ increment b, making it 1

+ x y \ define a function called "+" that returns x + y
 +    \ define a nested function also called "+"
  i x \ increment x
  d y \ decrement y unless y is 0, in that case return the last statement's value
  +   \ recursively call self
 +    \ call nested "+"
 d x  \ decrement (and return) x, since we will have over counted by 1

0 \ define a function called "0" that adds b to itself, doubling it
 + b b b
1 \ define a function called "1" that adds b to n, then calls 0
 + b n n
 0

\ at this point we could set n to be any number by calling 0 and 1
\ according to the desired number's reversed binary representation
\ but these A and B helper functions help golf that part
A \ calls 1 then 0
 1
 0
B \ calls 0 then 1
 0
 1

\ call functions 0 1 A B to increment n to the desired number
B
1
1
1
1
A
0
A
0
0
A
B
1
1
\ expanding the B's and A's, this becomes 0111111001000100111
\ which reverses to 1110010001001111110 in binary
\ which is 467582 in decimal
\ which is the encoding of the string "Hel"

s n \ finally, print n as a string

Note that I'm very doubtful this answer is optimal for Shtriped. Printing each character of Hello, World! or some combinations of its substrings could be much shorter, but doing that would require lots of trial and error and mathematical calisthenics (or at least a better golfer). For now, I like this elegant, if suboptimal solution.

\$\endgroup\$
6
\$\begingroup\$

Brain-Flak, 180, 176, 170 + 3 = 173 bytes

((()()())((((((((({})){}{}){}){}){})(((()()()){}()){}){}())([])[]{})))((((([][]()){}){})[[][]])<>)<>((((((({}))[]{}[][]())[][][])()()())[[]]()()()())[[]]()()())(<>{}()<>)

Try it online!

This code is 170 bytes long, but adds three bytes for the -A flag, which is required to force brain-flak to input and output in ASCII. One little detail is that this also requires the -r flag, but it did not when I first wrote this answer, so I am not adding one byte for it.

I'd post a detailed explanation, but this language hurts my brain...

Thanks to @Wheatwizard for saving 4 10 bytes!


Crossed out 4 is still regular 4... :(

\$\endgroup\$
6
  • 1
    \$\begingroup\$ You can save two bytes by moving the last 3 in the first push portion to the beginning and popping it for the first 3. (Since that is probably confusing here is a try it online) \$\endgroup\$ – Wheat Wizard Sep 6 '16 at 17:49
  • \$\begingroup\$ You can also change ([]){} to [][]. (try it online) \$\endgroup\$ – Wheat Wizard Sep 6 '16 at 17:51
  • \$\begingroup\$ @WheatWizard Good tips, thankyou! \$\endgroup\$ – DJMcMayhem Sep 6 '16 at 17:53
  • \$\begingroup\$ You can change (({})){}([])[](){} to (({}))[]{}[][](). (try it online) \$\endgroup\$ – Wheat Wizard Sep 6 '16 at 18:11
  • \$\begingroup\$ Ok, two more: try it online \$\endgroup\$ – Wheat Wizard Sep 6 '16 at 18:19
6
\$\begingroup\$

V, 14 bytes

iHello, World!

Try it online! This enters insert mode, then inserts Hello, World! into the field.

\$\endgroup\$
6
\$\begingroup\$

Parenthetic, 766 698 630 bytes

((()()())(()())((()())((()()())(()()()()))((()(())(())())((()(()))((()()(()))(()()())((())()()()()()()()()()()()()()))((()()(()))((())()()()()()())((())()()()()()))(()()()())))))((()(()))((()())((())()()())((())()()()))((()())((())()()()()())((())()()()()()()))((()())((())()()()()()())((())))((()())((())()()()()()())((())))((()())((())()()()()()())((())()()()))((()())((())())((())()))((()())((()))((())()()))((()())((())()()()())((())()()()()()))((()())((())()()()()()())((())()()()))((()())((())()()()()()())((())()()()()()()))((()())((())()()()()()())((())))((()())((())()()()()())((())()()()()()))((()())((()))((())()()())))

Try it online!

Still got a lot to golf. This version uses a single definition

(define f (lambda (a b) (char (+ (* a 13) 30 b))))

In other words, each char is encoded by two numbers a and b, for which 30 + 13*a + b is calculated (e.g. H = 73 = 30 + 3*13 + 3) .

\$\endgroup\$
3
  • \$\begingroup\$ nice work ... I thought it could be done better \$\endgroup\$ – MickyT Sep 4 '15 at 1:01
  • \$\begingroup\$ 608 bytes using (define f (lambda (a b) (char (- (* 6 19) (* a 13) b)))) \$\endgroup\$ – Leaky Nun Aug 23 '17 at 11:00
  • \$\begingroup\$ 604 bytes after golfing Leaky Nun's answer slightly \$\endgroup\$ – Sherlock9 Aug 23 '17 at 13:07
6
\$\begingroup\$

Casio Basic, 15 Bytes

"Hello, World!"

I think it explaines itself well enough...

\$\endgroup\$
3
  • \$\begingroup\$ Hello, and welcome to PPCG! This is a good answer; the downvote was an automatic Community downvote (AFAIK), and I cancelled it with an upvote. \$\endgroup\$ – NoOneIsHere May 30 '17 at 20:16
  • \$\begingroup\$ Thanks and sorry that I messed up the formatting, I'm not really used to yet... \$\endgroup\$ – ADDB May 30 '17 at 20:17
  • \$\begingroup\$ Perfectly OK! Just use four spaces before code, and a pound sign (#) or two before your header. \$\endgroup\$ – NoOneIsHere May 30 '17 at 20:18
6
\$\begingroup\$

Pyramid Scheme, 857 bytes

  ^      ^      ^     ^      ^      ^      ^      ^      ^      ^      ^      ^      ^
 / \    / \    / \   / \    / \    / \    / \    / \    / \    / \    / \    / \    / \
/out\  /out\  /out\ /out\  /out\  /out\  /out\  /out\  /out\  /out\  /out\  /out\  /out\
-----^ -----^ -----^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^-----
    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \
   /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\  /chr\
  ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^----- ^-----
 / \    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \    / \
/72 \  /101\  /108\  /111\  /44 \  /32 \  /87 \  /111\  /114\  /108\  /100\  /33 \
-----  -----  -----  -----  -----  -----  -----  -----  -----  -----  -----  -----

Try it online!

Wow. At least it's kinda clear how this works...

\$\endgroup\$
6
\$\begingroup\$

Windows Portable Executable (PE), 1175 bytes

By using the following Assembly code instead of C code (which inevitable imports unecessary libraries and whatnot), we can cut down the executable size from 261591 bytes (compiled C answer) to a measily 1536 bytes.

extern ExitProcess, GetStdHandle, WriteConsoleA

section .n
    msg db "Hello, World!",10

; <entry point>
Start:
    ; GetStdHandle(in A1)
    push -11           ; A1 - STD_OUTPUT_HANDLE
    call GetStdHandle  ; Puts in eax

    ; WriteConsole(in A1, in A2, in A3, out A4, reserved A5 )
    push 0             ; A5 - Don't care (reserved argument)
                       ; A4 - Don't care ("number of chars written")
    push 14            ; A3 - Length ("number of chars to write")
    push msg           ; A2 - String (buffer pointer)
    push eax           ; A1 - Console output handle (from GetStdHandle)
    call WriteConsoleA

    ; ExitProcess(in A1)
    push 0             ; A1 - Exit code
    call ExitProcess

However, that is still way too large. So I installed HxD, a hex editor, and went on to try and remove unecessary parts.

Apparently, Windows' executables are filled with padding (hex indication) for no apparent reason. So I removed the tailing block of zeroes at the end of the file, messed around a bit, and managed to cut it down to 1175 bytes. Here's the pastebin hexdump of the executable.

Unfortunately, at my every attempt to remove the other paddings (0x1A8-0x1FF, 0x22B-0x3FF), the program would simply not run. I've been doing this for a few days to no success. Thus, I'm posting this beaten, at the still staggering 1KB of size.

I am sure this can be golfed even further, so if anyone manages to cut down the size, feel free to edit this answer or perhaps even post another one.


As a bonus, this executable also works on DOS.

\$\endgroup\$
2
  • \$\begingroup\$ If anyone wants to try golfing this down some more, they may find this answer on SO and the material it references helpful. \$\endgroup\$ – 3D1T0R May 29 '18 at 19:53
  • 1
    \$\begingroup\$ github.com/pts/pts-tinype Some smaller Hello World .exes, not mine. I couldn't get the 268-byte ones to run at all, and the 402-byte one would only run with my antivirus shut off. \$\endgroup\$ – Nnnes Jul 23 '18 at 11:19
6
\$\begingroup\$

Sad-Flak, 199+3 bytes = 202 bytes

3 bytes for the -A arg. This lang uses a "codepage", where ≤≥ are one byte each (that is, I have a thing that replaces ` and ~ with those chars and runs it)

32
({}≤()≥)
(≤()≥)
99
({}≤()≥)
((<>[≤()≥]))
7
({}≤()≥)
((<>))≤()≥
5
({}≤()≥)
(≤()≥)
109
({}≤()≥)
(<>)(≤()≥)
85
({}≤()≥)
(≤()≥)
30
({}≤()≥)
(≤()≥)
42
({}≤()≥)
({≤()≥})(({()}))({()})(())
70
({}≤()≥)
≤≥

Try it online!

Explanation:

The main idea behind this is that the way Sad-Flak works, you can easily get it to repeat a line a constant number of times.

in Sad-Flak, there is a line pointer. The line pointer starts at the beginning

-> 32
   ({}≤()≥)
   (≤()≥)
   99
   ({}≤()≥)
   ((<>[≤()≥]))
   7
   ({}≤()≥)
   ((<>))≤()≥
   5
   ({}≤()≥)
   (≤()≥)
   109
   ({}≤()≥)
   (<>)(≤()≥)
   85
   ({}≤()≥)
   (≤()≥)
   30
   ({}≤()≥)
   (≤()≥)
   42
   ({}≤()≥)
   ({≤()≥})(({()}))({()})(())
   70
   ({}≤()≥)
   ≤≥

however, the 32 is not actually a command. it is a simple way to express 32 blank lines. I could expand them for the demonstration, but then it would be unreadable. anyway.

So, the line pointer points at the first of 32 blank lines. When the line pointer points at a non-blank line, it will execute that line. when the line pointer points at a blank line, it will execute the first non-blank line after that line. that means we execute ({}≤()≥). What does this line do? This lang is a brainflak derivative, btw, so some of the brackets do the same thing, but not all

(        push...
 {}      pop off the main stack and evaluate to that value, plus
   ≤     jump by the amount inside, evaluate to that value for the purpose of other commands
    ()   1
      ≥
       )

so, this pops off the stack, adds one to it while jumping one forward, then pushes back on the stack. What is jumping? why are we jumping in the middle of a line?

Jumping in Sad-Flak is rather different to most other langs. Jumping does not take immediate effect, but rather moves the line pointer. when the line pointer is moved, nothing happens until the current line is finished executing. when it is finished, we see which line the line pointer points at, and execute that. If the line pointer didn't get moved, the same line gets executed again, and again, until it gets moved. however, all lines in this program either are blank, or they jump or halt. So, this line moves the line pointer one forward and increments top of stack.

What is the line pointer pointing at now? it's still on a blank line, so it does the same thing again, and again, until it gets to the line that it keeps executing

   32
-> ({}≤()≥)
   (≤()≥)
   99
   ({}≤()≥)
   ((<>[≤()≥]))
   7
   ({}≤()≥)
   ((<>))≤()≥
   5
   ({}≤()≥)
   (≤()≥)
   109
   ({}≤()≥)
   (<>)(≤()≥)
   85
   ({}≤()≥)
   (≤()≥)
   30
   ({}≤()≥)
   (≤()≥)
   42
   ({}≤()≥)
   ({≤()≥})(({()}))({()})(())
   70
   ({}≤()≥)
   ≤≥

Then, it executes it one last time, before moving to the next line. this end up with the charcode of ! on the stack (32 blanks + 1 actual line)

   32
   ({}≤()≥)
-> (≤()≥)
   99
   ({}≤()≥)
   ((<>[≤()≥]))
   7
   ({}≤()≥)
   ((<>))≤()≥
   5
   ({}≤()≥)
   (≤()≥)
   109
   ({}≤()≥)
   (<>)(≤()≥)
   85
   ({}≤()≥)
   (≤()≥)
   30
   ({}≤()≥)
   (≤()≥)
   42
   ({}≤()≥)
   ({≤()≥})(({()}))({()})(())
   70
   ({}≤()≥)
   ≤≥

this line ((≤()≥)) pushes a new 1 to the stack, and moves the line pointer one forward, onto a new blank line, to do basically the same thing as it did before. however it puts charcode of e. and also the next line is this: ((<>[≤()≥])). What is this complex line? well:

((        push twice...
  <>      value popped from stack, and pushed onto the offstack for later retrieval
    [     minus ...
     ≤    (jump but eval to the argument still)
      ()  1
        ≥
         ]
          ))

so, this pops the e off the stack, and replaces it with two ds, while leaving an e on the off stack for later retrieval, and also jumping the line pointer to the next line. we have two, because one will be changed into l, because it saves bytes from pushing a 1 and incrementing it up to the next letter. we don't do this for all of them because it also cost bytes popping and pushing back onto the stack, as well as fitting the jump in there.

from now on, I'm skipping the blank lines and the increment top of stack lines, because this explanation is long enough already.

after adding 8 to yield l

((          push twice...
  <>        a value popped from stack, also pushed to offstack
    ))
      ≤     jump ...
       ()   1
         ≥

add 6 to yield r: this one again: (≤()≥) new value at 111 (o):

(           push...
 <>         popped value, also pushed to offstack.
   )
    (       push...
     ≤      (jump and eval to same as...)
      ()    1
        ≥
         )

so this pushes to the off stack while keeping it on the stack, and pushing another 1 on the stack.

new 87 (W): this again: (≤()≥)

new 32 (space): same again: (≤()≥)

new 44 (,): ({≤()≥})(({()}))({()})(()) woah, what is that? put simply, it is just pushing onto the main stack what we pushed on to the offstack, then a 1 to make into a H:

(             push...
 {            pop from the off stack, evaluate to that multiplied by...
  ≤           jump and eval to...
   ()         1
     ≥
      }
       )         this pushes o

        ((         push twice...
          {        multiply an offstack popped value by...
           ()      1
             }
              ))     this pushes l twice

                (        push...   
                 {       offstack popped value times...
                  ()     1 
                    }
                     )      this pushes e

                      (    push...
                       ()  1
                         )

new 72 (H): ≤≥: this is the halt command and it stops the program

That pushed !dlroW ,olleH char codes, which then gets printed, but backwards because it is a stack. "Hello, World!"

\$\endgroup\$
6
\$\begingroup\$

Cubically, 124 123 111 99 78 bytes

-11 bytes thanks to TehPers, -12 thanks to language updates, -21 thanks to user202729

RU+432@6+50-4@6+3-4@6@6+1-00@6-331@6-00@6+4110@6+0000@6+1-00@6-0@6-2+4@6-331@6

Generated via this amazing algorithm.

There is a good explanation of Cubically in this question.

Cubically, the Rubik's Cube Programming Language, is the most complex language I have ever written, or dealt with, for that matter. It entirely comprises of operations on a single 3x3 Rubik's Cube in its memory, and one extra value, the "notepad".

The only way to perform mathematical operations is to take values from a certain cube face and add/subtract/multiply/divide it with the scratch pad value, replacing said value.

For example, performing /0 divides the notepad value by the sum of all integers on the 0-indexed face, or the first face.

The cube starts out initialized like this:

   000
   000
   000
111222333444
111222333444
111222333444
   555
   555
   555

Performing a 90-degree clockwise turn on the right face will make the cube look like this:

   002
   002
   002
111225333044
111225333044
111225333044
   554
   554
   554

Version from TehPers:

Here's a run-down of how the program works: (Note that I have replaced @6 with @ in the code, but changing each instance in the rest of this answer would be too tedious and I need to get back to real life.)

  • +53 adds the DOWN face and RIGHT faces into the notepad, in this case, 45 and then 27. This results in 72, the ASCII code for H.
  • @6 prints the notepad value as ASCII.
  • :2 sets the notepad to the value of the FRONT face (18).
  • /1 divides the notepad by the LEFT face (9), resulting in 2.
  • +551 Adds the DOWN face (45) twice, then the LEFT face (9). As you can see, without rotating the cube, the faces will contain a total value equal to 9 times the index. For example, face index 5 has a value of 45, face index 1 has a value of 9, and so forth. After rotating the cube, this no longer applies.
  • @6 again prints the notepad value, or e.
  • :5 sets the notepad to the value of the DOWN face (45).
  • +52 adds the DOWN face (45) and the FRONT face (18) to the notepad.
  • @66 prints the current notepad value as a character twice. At this point Hell has been printed, which should be good enough for this language. :P
  • :3/1 sets the notepad to the value of the RIGHT face (27), then divides the notepad by the value of the LEFT face (9), resulting in 3. Do you see the pattern yet?
  • +552 adds 108 to the notepad, or 9*(5+5+2). Remember, if you rotate the cube, then the faces will not necessarily be multiples of 9!
  • @6 prints the notepad value as a character, finishing the word "Hello".
  • From this point there is nothing interesting. The program follows the pattern of setting the notepad value to whatever c % 9 is (where c is the target character), then adding multiples of 9 to the notepad get to the target character. The faces are not rotated, so this isn't exactly the best showcase program for Cubically, but it's certainly simpler than what could be accomplished with rotating the faces. There may be a shorter way to write this program using rotations, though.

Original (written by hand >.<)

+53@6+1F2L2+0@6L2F2U3R3F1L1+2@66L3F3R1U1B3+0@6:4U1R1+00@6-000@6+50000@6+000000@6+2-000000@6-5+4000@6-00@6/0+00@6:0+0/0+00@6

The above Hello World program uses arbitrary turns that I fiddled with until they got some desired values. Eventually, I got the top face to add up to 4 and made do with that.

Here's a run-down of how the program works:

  • +5+3 adds the DOWN face and RIGHT faces into the notepad, in this case, 45 and then 27. This results in 72, the ASCII code for H.
  • @6 prints the notepad value as ASCII.
  • +1 adds the LEFT face to the notepad value, resulting in 81.
  • F2 turns the FRONT face to look like this.
  • L2 turns the LEFT face to look like this.
  • +0 adds the UP face to the notepad, resulting in 101.
  • @6 prints memory as ASCII e.
  • L2F2U3R3F1L1 turns the cube to look like this.
  • +2 adds the FRONT face to the notepad, resulting in 108. @66 prints as ASCII twice ll. At this point Hell has been printed, which should be good enough for this language. :P
  • L3F3R1U1B3 turns the cube to look like this.
  • +0 adds the UP face to the notepad (resulting in 111), @6 prints it as ASCII o.
  • :4 sets the notepad to the BACK face 36.
  • U1R1 turns the cube to look like this. The cube is not turned again 'cause this was about as good of a setup I could get.
  • +0+0 adds the UP face to the notepad twice, resulting in 44.
  • @6 prints as ASCII ,.
  • -000 subtracts 12 from the notepad (32). @6 prints as ASCII .
  • From this point there is nothing interesting except messing with the existing faces, particularly the top face (which has a convenient value 4), to print the remaining characters.
\$\endgroup\$
7
  • \$\begingroup\$ It's not complex, just insanely difficult :o \$\endgroup\$ – hyper-neutrino Jun 15 '17 at 0:45
  • \$\begingroup\$ @HyperNeutrino It's rather complex. Wait for the explanation :P \$\endgroup\$ – MD XF Jun 15 '17 at 0:46
  • \$\begingroup\$ you should change the title on this \$\endgroup\$ – Destructible Lemon Jun 15 '17 at 1:32
  • \$\begingroup\$ Also that is not postfix \$\endgroup\$ – Destructible Lemon Jun 15 '17 at 1:32
  • \$\begingroup\$ @DestructibleLemon oh duh \$\endgroup\$ – MD XF Jun 15 '17 at 1:38
6
\$\begingroup\$

Folders (pure), 195 folders

Some languages, like Folders, are a bit tricky to score

I'm not sure how it translates to bytes, but we can just count the number of folders: (src)

$ ls -l -R . | grep -c ^d
195
$ ls -l -R . | grep :$
./New folder:
./New folder/New folder:
./New folder/New folder/New folder:
./New folder/New folder/New folder (2):
./New folder/New folder/New folder (3):
./New folder/New folder/New folder (4):
./New folder/New folder (2):
./New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder/New folder (2):
./New folder/New folder (2)/New folder/New folder (3):
./New folder/New folder (2)/New folder/New folder (4):
./New folder/New folder (2)/New folder/New folder (5):
./New folder/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy/New folder (2)/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (10)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (11):
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (11)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (12):
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (12)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (2)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (3)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (4)/New folder (2)/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (5)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (6)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (7)/New folder (2)/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (8)/New folder (2)/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (3):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (3)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (4):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder/New folder (4)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder (2):
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder (2)/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder (2)/New folder/New folder:
./New folder/New folder (2)/New folder (3)/New folder - Copy (9)/New folder (2)/New folder (2):

Folders (concise), 2 folders + (5 + 13) bytes

./Setup
./Setup/Hello, World!
\$\endgroup\$
6
  • 1
    \$\begingroup\$ Welcome to PPCG! / Using inline code formatting can be quite hard to read, I edited the answer. \$\endgroup\$ – user202729 Feb 2 '18 at 10:29
  • \$\begingroup\$ Does this include the comma? I don't see one in your concise version but I don't have a folders installation to check. \$\endgroup\$ – Potato44 Feb 6 '18 at 22:21
  • \$\begingroup\$ According to the original site, (and by the number of folders) it is with the comma. I fixed my concise example. \$\endgroup\$ – Eran W Feb 7 '18 at 0:44
  • 1
    \$\begingroup\$ Easier way to count: find * -type f | wc -l (counts lines of output) \$\endgroup\$ – Peter Cordes Apr 13 '18 at 2:57
  • \$\begingroup\$ Right, It is shorter by one character... But I could use -lR \$\endgroup\$ – Eran W Apr 14 '18 at 8:21
6
\$\begingroup\$

Pepe, 122 120 bytes

Pepe is my brand new programming language, which is horrible.

reeEeeEeeereeEEeeEeErEeEEeEEeereeereeeREeEEeEEEEReeereeeEeEEeereeeEeeeeereeEeEeEEEReeereeEEEeeEereeereeEEeeEeereeeEeeeeE

Try it online!

There might be shorter solutions, but that's not task for my brain .-.

That's why I'd offer a 50 100 bounty to anyone who can make it shorter, if it's possible. I don't really believe it is, but maybe you can change my mind?

This solution is quite simple, but better to explain it ungolfed and commented:

reeEeeEeee   # H > print H
reeEEeeEeE   # e > print e
rEeEEeEEee   # l > push l to r
reee reee    #     print it twice
REeEEeEEEE   # o > push o to R
Reee         #     print it
reeeEeEEee   # , > print ,
reeeEeeeee   #   > print a space
reeEeEeEEE   # W > print W
Reee         # o > print active value in R (o)
reeEEEeeEe   # r > print r
reee         # l > print active value in r (l)
reeEEeeEee   # d > print d
reeeEeeeeE   # ! > print !

The first line prints Hello, and a space, the second prints World!. Most of this program are character functions, ex. reeEeeEeee which prints H. By letter:

  • r - Stack r
  • e - Print
  • eEeeEeee - 01001000 (72), the ASCII character for H

As said, most of the program consists of similar commands, but, to golf it a bit, in first occurrence of l, I replaced the first e with E, so instead of printing, it pushed the charcode to the stack. Thanks to this, we can later print l using reee, the command for printing. Edit: Now, I've done the same with o, thanks to the existence of the second stack (notice the R letter).

\$\endgroup\$
6
\$\begingroup\$

Symbolic Python, 175 157 147 136 bytes

_=-~(_==_)
_*=_-~_
__=_*_+~-~-_
_=('%'+`''`[~_/_])*-~-~_%(~-_*~-~-_,_*_+_/_,__,__,_*_-~_,',',' ',__-_+~_,_*_-~_,`_==_`[_/_],__,_*_)+'!'

Try it online!

I'm not sure this is optimal, but it sure was fun.

Explanation:

_=-~(_==_)           # Set _ to 2
_*=_-~_              # Set _ to 2*(2+2+1) = 10
__=_*_+~-~-_         # Set __ to 10*10+(10-1-1) = 108
_=                   # Set _ to
  ('%'+`''`[~_/_])      # %c, where c is coming from the character \x0c
  *-~-~_                # Repeated 12 times
  %(...                 # Then format into that format string
  ~-_*~-~-_,              # (10-1)*(10-1-1) = 72  = 'H'
  _*_+_/_,                # 10*10+1         = 101 = 'e'
  __,                     #                   108 = 'l'
  __,                     #                   108 = 'l'
  _*_-~_,                 # 10*10+10+1      = 111 = 'o'
  ',',                    #                         ','
  ' ',                    #                         ' '
  __-_+~_,                # 108-10-(10+1)   = 87  = 'W'
  _*_-~_,                 # 10*10+10+1      = 111 = 'o'
  `_==_`[_/_],            # second letter of True = 'r'
  __,                     #                   108 = 'l'
  _*_                     # 10*10           = 100 = 'd'
)+'!'                   # Then add the last char    '!'
                     # And implicitly print _
\$\endgroup\$
0
6
\$\begingroup\$

C++ (gcc), 40 bytes

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

Try it online!

Using builtins are shorter since #include takes up a lot of bytes. I believe this solution is optimal.

\$\endgroup\$
1
  • \$\begingroup\$ "Optimal?" A bold claim. Ken Thompson: "Last year I taught at University of Sydney I gave that to my class, the shortest self-reproducing program in C, and I got a surprise. I didn't think there was a surprise there to be had. But, I got somebody who has the shortest one I've ever seen, which is a record breaker, by about four characters of what I had proved to myself was the shortest program, and they did it by a totally different mechanism which of course nullified the proof." princeton.edu/~hos/mike/transcripts/thompson.htm \$\endgroup\$ – roblogic Aug 27 '19 at 1:53
6
\$\begingroup\$

Cubically, 48 46 bytes

The previous best answer seems to have been 78 bytes long. I consider this a victory.

+35@⊕5@⊕1L@@|4U@-53@-0@R+43@+4@B'⊕3@-0@F-0@:5@

Found via computer search within a restricted subset of Cubically. Corresponding Most efficient cubifier answer by me.

Try it online!

\$\endgroup\$
6
\$\begingroup\$

Integral, 13 bytes

÷Hello, W╗ld!

Try it!

Sadly, Integral cannot yet compress capital letters, so it could not do much compression.

÷ means start compressed string.

Ignoring punctuation and capitalization yields

Integral, 9 bytes

÷▓llo═╗ld

Try it!

See also: Showcase

\$\endgroup\$
13
  • 1
    \$\begingroup\$ Can you put Integral on GitHub? \$\endgroup\$ – user96495 Aug 3 '20 at 0:38
  • \$\begingroup\$ Also, how do loops work? I tried using e but it froze the interpreter. \$\endgroup\$ – lyxal Aug 3 '20 at 0:38
  • \$\begingroup\$ @Lyxal You would push the string to eval, then push the number of times to loop. Example: ⌡[Code to eval]⌡;[Encoded number of times];e \$\endgroup\$ – nph Aug 3 '20 at 12:59
  • 1
    \$\begingroup\$ @petStorm GitHub repository. For some reason the code is not working. For now keep using the old interpreter. \$\endgroup\$ – nph Aug 3 '20 at 13:19
  • 1
    \$\begingroup\$ Anyway, I created a GitHub pages online interpreter. \$\endgroup\$ – user96495 Aug 3 '20 at 13:53
6
\$\begingroup\$

PowerShell, 15 Bytes

Likely in Foo (among others) as well, but I'll let someone with more knowledge of those languages post.

"Hello, World!"

or, alternatively,

'Hello, World!'

In PowerShell, both ' and " denote string literals. The difference is the double-quotes will expand variables (e.g., $myString) and escape characters (e.g., `n), while the single-quote will treat everything literally.

PowerShell does an implicit Write of anything that's on a line by itself in a program (the relative merits of Write-Host vs Write-Output are left as an exercise to the reader) -- variable, literal string (as this is), result of a one-line command, etc. This stems from the fact that every line gets executed, and the way to execute a string is to print it. For other data types, if they have a way to convert to a string, the execution silently does the conversion in the background and then prints the resultant string. If there's no way to get a string, you'll wind up printing a description of the datatype. This is one of the ways that PowerShell, as ... verbose clear ... as it is, can wind up somewhat competing with other languages.

A short article on the topic, not written by me, though the author and I have a similar name.

\$\endgroup\$
6
\$\begingroup\$

vJASS (Warcraft 3), 78 58 bytes

Using //! import zinc "<code_path>" command to exclude //! zinc and //! endzinc.

library a{function onInit(){BJDebugMsg("Hello, World!");}}

Explanation:

  • BJDebugMsg() prints the text on your in-game screen.
\$\endgroup\$
6
\$\begingroup\$

Windows Portable Executable 32 bit, 268 bytes

xxd:

00000000: 4d5a 0000 5045 0000 4c01 0100 0000 0000  MZ..PE..L.......
00000010: 0000 0000 0000 0000 7000 0301 0b01 0000  ........p.......
00000020: 0000 0000 0000 0000 0000 0000 b400 0000  ................
00000030: 0000 0000 0000 0000 0000 4000 0400 0000  ..........@.....
00000040: 0400 0000 0000 0000 0000 0000 0400 0000  ................
00000050: 0000 0000 0004 0000 0100 0000 0000 0000  ................
00000060: 0300 0000 0000 0000 0000 0000 0000 0000  ................
00000070: 0000 0000 0000 0000 0200 0000 0000 0000  ................
00000080: 0000 0000 e600 0000 0000 0000 2e74 6578  .............tex
00000090: 7400 0000 4600 0000 b400 0000 4600 0000  t...F.......F...
000000a0: b400 0000 0000 0000 0000 0000 0000 0000  ................
000000b0: 0000 0000 68c5 0040 00ff 15da 0040 00ff  ....h..@.....@..
000000c0: 15de 0040 0048 656c 6c6f 2c20 576f 726c  ...@.Hello, Worl
000000d0: 6421 0063 7274 646c 6c00 bb01 0080 6701  d!.crtdll.....g.
000000e0: 0080 0000 0000 0000 0000 0000 0000 0000  ................
000000f0: 0000 d300 0000 da00 0000 0000 0000 0000  ................
00000100: 0000 0000 0000 0000 0000 0000            ............

source:

; nasm

BITS 32
base equ 0x400000

;
; DOS header
;
; The only two fields that matter are e_magic and e_lfanew

mzhdr:
    dw "MZ"       ; DOS e_magic
    dw 0

;
; NT headers
;

    dd "PE"       ; PE signature

;
; NT file header
;

filehdr:
    dw 0x014C            ; Machine (Intel 386)
    dw 1                 ; NumberOfSections
    dd 0                 ; TimeDateStamp UNUSED
    dd 0                 ; PointerToSymbolTable UNUSED
    dd 0                 ; NumberOfSymbols UNUSED
    dw opthdrsize        ; SizeOfOptionalHeader
    dw 0x103             ; Characteristics

;
; NT optional header
;

opthdr:
    dw 0x10B                    ; Magic (PE32)
    db 0                        ; MajorLinkerVersion UNUSED
    db 0                        ; MinorLinkerVersion UNUSED
    dd 0                        ; SizeOfCode UNUSED
    dd 0                        ; SizeOfInitializedData UNUSED
    dd 0                        ; SizeOfUninitializedData UNUSED
    dd start                    ; AddressOfEntryPoint
    dd 0                        ; BaseOfCode UNUSED
    dd 0                        ; BaseOfData UNUSED
    dd base                     ; ImageBase
    dd 4        ; DOS e_lfanew  ; SectionAlignment
    dd 4                        ; FileAlignment
    dw 0                        ; MajorOperatingSystemVersion UNUSED
    dw 0                        ; MinorOperatingSystemVersion UNUSED
    dw 0                        ; MajorImageVersion UNUSED
    dw 0                        ; MinorImageVersion UNUSED
    dw 4                        ; MajorSubsystemVersion
    dw 0                        ; MinorSubsystemVersion UNUSED
    dd 0                        ; Win32VersionValue UNUSED
    dd 1024                     ; SizeOfImage
    dd 1                        ; SizeOfHeaders          nonzero for Windows XP
    dd 0                        ; CheckSum UNUSED
    dw 3                        ; Subsystem (Console)
    dw 0                        ; DllCharacteristics UNUSED
    dd 0                        ; SizeOfStackReserve
    dd 0                        ; SizeOfStackCommit
    dd 0                        ; SizeOfHeapReserve
    dd 0                        ; SizeOfHeapCommit UNUSED
    dd 0                        ; LoaderFlags UNUSED
    dd 2                        ; NumberOfRvaAndSizes    for Windows 10; UNUSED in Windows XP

;
; Data directories (part of optional header)
;
    dd 0, 0                     ; Export Table UNUSED
    dd idata, 0                 ; Import Table

opthdrsize equ $ - opthdr

;
; Code section header
;

    db ".text", 0, 0, 0         ; Name
    dd codesize                 ; VirtualSize
    dd code                     ; VirtualAddress
    dd codesize                 ; SizeOfRawData
    dd code                     ; PointerToRawData
    dd 0                        ; PointerToRelocations UNUSED
    dd 0                        ; PointerToLinenumbers UNUSED
    dw 0                        ; NumberOfRelocations UNUSED
    dw 0                        ; NumberOfLinenumbers UNUSED
    dd 0                        ; Characteristics UNUSED

;
; Code section data
;

align 4, db 0

code:

;
; Entry point
;

start:
    push base + msg
    call [base + puts]
    call [base + exit]

msg:
    db "Hello, World!",0

crt:
    db "crtdll",0

;
; Import address table (array of IMAGE_THUNK_DATA structures)
;

iat:
puts:   dd 0x800001BB           ; Import puts by ordinal
exit:   dd 0x80000167           ; Import exit by ordinal
        dd 0                    ; terminator

;
; Import table (array of IMAGE_IMPORT_DESCRIPTOR structures)
;

idata:
    dd 0                        ; OriginalFirstThunk UNUSED
    dd 0                        ; TimeDateStamp UNUSED
    dd 0                        ; ForwarderChain UNUSED
    dd crt                      ; Name
    dd iat                      ; FirstThunk

    ; terminator
;    times 5 dd 0 ; too big, padding serves as terminator

codesize equ $ - code

;
; Padding for Windows 10
;
    times 268 - ($-$$) db 0

Previous PE answer: 1175 bytes.

This program was tested on Windows 10 2004 64-bit and Windows XP SP3.

The answer is based on this article, which creates the smallest PE file on Windows XP. I took the smallest file that works on Windows 10 from tinype.zip, which is tiny.296, and added imports using tiny.import.209. Other useful articles: one two.

Quirks:

Windows 10:

  • 268 byte size limit (link)
  • imports must be in a section (link), that's why codesize includes imports

Windows XP:

  • ignores NumberOfRvaAndSizes, it's not a problem because Debug Directory size happens to be 0 (Characteristics field of .text section header) (link)
  • SizeOfHeaders must be nonzero

I think 268 = 4 + 264, where 4 is the minimal offset of NT headers from the start of the file and 264 is the minimal distance between the start of NT headers and end of file. 264 is probably sizeof(IMAGE_NT_HEADERS32)+16 or sizeof(IMAGE_NT_HEADERS64). Because Windows 10 imposes hard limit on minimal PE size, there is no need to cram section header, code and imports into NT headers.

Of the four CRT libraries that are available on both XP and 10 (crtdll.dll, msvcrt.dll, msvcrt20.dll, msvcrt40.dll), I use crtdll.dll because it has a shorter name and has not been updated since 1995, so (it feels like) it's safe to import by ordinals from it. There is no big problem to import by names, but then those names must be inside headers, which is a bit messier.

The program sometimes hangs if puts is imported and ret is used to exit the program (this is true for both crtdll and msvcrt), so I use exit.

\$\endgroup\$
1
3 4
5
6 7
29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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