133
\$\begingroup\$

Create the shortest possible obfuscated program that displays the text "Hello World".

In order to be considered an obfuscated program, it must meet at least two of the following requirements:

  • Does not contain the characters: h, l, w and d in any case
  • Does not contain the characters: e, o, r, 0, and 1 in any case
  • Does not contain the characters: 2 or 7

Input:
none

Output:
Hello World

Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 307; // 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 = 48934; // 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,]*[^\s,]),.*?(\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,
      });
    
  });
  
  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;
    if (/<a/.test(lang)) lang = jQuery(lang).text();
    
    languages[lang] = languages[lang] || {lang: a.language, 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 > b.lang) return 1;
    if (a.lang < b.lang) 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}

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

#language-list {
  padding: 10px;
  width: 290px;
  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="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<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>
<div id="language-list">
  <h2>Winners 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>
<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\$
14
  • 8
    \$\begingroup\$ I guess import in python is not permitted. \$\endgroup\$
    – Alexandru
    Feb 1, 2011 at 0:07
  • 28
    \$\begingroup\$ Does these rules apply to language keywords as well? \$\endgroup\$
    – hallvabo
    Feb 1, 2011 at 13:04
  • 9
    \$\begingroup\$ are those case insensitive restrictions? \$\endgroup\$
    – Rommudoh
    Aug 4, 2011 at 14:22
  • 23
    \$\begingroup\$ Could someone explain why 2 and 7 are not allowed? I'm just curious as I don't see why those were chosen in particular. \$\endgroup\$ Aug 5, 2011 at 23:01
  • 5
    \$\begingroup\$ @trinithis, and others, ASCII character 72 is "H" which is why I chose those two \$\endgroup\$ Sep 18, 2011 at 23:18

139 Answers 139

1
2 3 4 5
179
\$\begingroup\$

Perl

Since the obvious answer uses shifting of some kind, I feel obligated to post something using Acme::EyeDrops, however with the extra power I thought mine ought to be a little more fun.

                            ''=~('('."\?".
                        '{'.('`'|'%').('['^'-'
                    ).('`'|'!').  ("\`"|       ','
                 ).'"'.('['^'.').   (((           '['
              ))^'(').('`'|('%')).(                  '{'
            ^'[').('{'^'/').('`'|')')                  .+(
          '`'|'-').('`'|'%').':'.':'.(                   '`'
         ^'(').('`'|')').('{'^')').(                      '`'
       |((  '%'))).('['^'(').'\\'.'"'                       .+(
      '['   ^'.').('['^'(').("\`"|                           ','
     ).(    '`'|'%').('`'|"\%").(                             '['
    ^((      '+'))).'\\'.'"'.';'.                              (((
   (((        '\\')))))).('$').                                 '|'
   .((         '+')).'+'.(';').                                 (((
  (((           '\\'))))      )                                  ).+
  '$'            .'\\'.                                          '"'
 .((               '=')    ). "'".                                "'"
 .((                (';'))).       '\\'                           .((
'@'                   )).('`'|                                     '#'
).+                        '='                                     .+(
'`'                          |+    "\-").(                         '`'
|((                            '!'))).("\["^                       '+'
).+                              '\\'.'{'."\[".                    (((
(((                              '\\'))))))."\$".                  '_'
.((                             ',')).'\\'.'$'.('`'|               '*'
).+                             ','.('^'^('`'|('+'))).(            '^'
^+(                              '`'|'.')).'+'.('^'^('`'           |((
'+'                               )))).'*'.'\\'.('$').(            '`'
 |((                               '*'))).'+'.'+'.']'.            (((
 (((                                '\\'))))))."\}".(             '['
  ^((                                '('))).('['^'+')            .+(
  '`'                                |',').('`'|')')             .+(
   '['                                ^'/').('/').              '/'
   .((                                ',')).'\\'.               '"'
    .+(                               '`'^'(').                (((
     '`'                              ))|'%')                 .+(
      '`'                             |',').                 (((
       '`'                           ))|','                 ).(
         '`'                         |'/')                .+(
          '{'                        ^'['                ).(
            '{'                      ^((               ','
              )))                     .(  (          '`'
                 )|+                   ((         '/'
                    )))                        .+(
                        '['                ^((
                            ')'))).(('`')|

                            ',').('`'|'$')
                        .((        '\\')).'"'.
                    ';'       .  ('['^',').(('`')|
                 '('         ). ('`'|')').('`'|',').(
              '`'              |'%').'('.('^'^('`'|'/'))
            .((             ')')).'\\'.'{'.('`'|'-').('['^
          '"'             ).((   (  '\\'))).'$'.('`'|('*')).
         ';'             .+(      ( ( '`'))|'-').('['^('"')).
       '\\'              .+            '@'.('['^'(').'='.("\`"|
      '-').             ('`'|'!'           ).('['^'+').'\\'.'{'.
     "'".(             '{'^"\[").   ((     "'")).'\\'.'}'.('(').(
    '^'^(             '`'|'.')).'.'.'.'.('^'^('`'|'+')).('^'^('`'|
   '.'))            .')'.';'.('`'|'&').('`'|'/').('['^')').'('.'\\'
   .'@'            .('`'|'#').')'.'\\'.'{'.'\\'."\$".(   '['^"\(").
  '['              .'\\'.'$'.'_'.'-'.'>'.'['.('^'^('`'     |',') ).+
  ']'             .']'.'='.'\\'.'$'.'_'.'-'.'>'."\[".(      '^'^ (((
 '`'              ))|'.')).']'.('`'|')').('`'|('&')).        (((  (((
 (((             '\\'))))))))).'$'.'_'.'-'.'>'.'['.           +(  '^'
^+(              '`'|',')).']'.'<'.'='.('^'^('`'|         (    (   '+'
)))               ).('^'^('`'|'.')).';'.'\\'.'$'.'_'.     (    (   '-'
)).                '>'.'['.('^'^('`'|'/')).']'."\>".       (       (((
(((                  '\\')   )))))).'$'.'_'.'-'.'>'                .((
'['                           )).('^'^('`'|(','))).                ']'
.((                           '?')).'\\'.'$'.('`'|                 '*'
).((                          '+')).'+'.':'.'\\'.                  '$'
.('_').                        '-'.'>'.'['.('^'^                   (((
'`'))|','                       )).']'.'-'."\-".                   (((
'\\'))).+                       '}'.('['^'+').(                   '['^
 "\)").(                        '`'|')').("\`"|              (   '.')
 ).('['^                        '/').'\\'."\"".                   (((
  '\\'))                        ).'\\'.('['^')'    )             .((
  '\\')).                      '@'.('['^"\(").   ((              (((
   '\\'))                       ))).'"'.';'.(   '['        ^    '.'
   ).('['                        ^'(').('`'|    ((        (     ','
    )))).                         ('`'|'%')     .              (((
     '`')                         )|'%').(                    '['
      ^((                          '+')))                    .((
       '('                         )).                      (((
         '^'                                          )   )^(
          '`'                                         |  '/'
            )).                                       ('`'
              |((                                    '%'
                 )))                              .+(
                    '^'                        ^+(
                        '`'                |((
                            '+')))).(')').

                            ';'.('`'|',').
                        ('`'|'!').('['^    '('
                    ).('['^'/').(('{')^        '['
                 ).('`'|')').("\`"|    (          '&'
              )).'\\'.'$'.('`'|"\*").                '='
            .'='.'\\'.'@'.('`'|"\#").                  (((
          '\\'))).'}'.('['^'+').('['^  (                 ')'
         )).('`'|')').('`'|'.').('['^   (                 '/'
       )).'\\'.'"'.'\\'.'\\'.('`'      |+                   '.'
      ).'\\'.'"'.('!'^'+').'"'.'}'.   ')'                    );(
     $:)='.'^'~';$~='@'|'(';$^=')'^                           '['
    ;$/='`'|'.';$,='('^'}';$\="\`"|                            '!'
   ;$:=')'^'}';$~='*'|'`';$^=('+')^                             '_'
   ;($/)    ='&'|'@';$,='['&'~';$\                              =((
  "\,"))^    '|';$:  ='.'^'~'; $~                                =((
  '@'))|     "\(";    $^=')'^                                    '['
 ;($/)=      '`'|       '.';$,                                    =((
 '(')        )^+         '}';$\                                   =((
'`')          )|          "\!";      (           (                 $:)
)=')'         ^+        (   (         (                   (        '}'
))));          (           (          (                            $~)
))=(                    (   (    (        (                        '*'
))))                     )   |  ((      (                          '`'
)))                      ;     $^=         (                       '+'
)^+                       ((    ((  ((     '_'                     )))
)))                                          ;($/)                 =((
'&'                          ) )               |'@';               $,=
'['                                                                &((
 '~'                                      ))   ;                  $\=
 ','                                  ^"\|";  $:                  =((
  '.'                               ))^"\~"; $~=                 '@'
  |((                              '('));$^=')'^       (         '['
   );(                          $/)='`'|"\.";$,=    (           '('
   )^+                         '}';$\='`'|'!';$:                =((
    ')'                        ))^'}';$~='*'|'`'               ;$^
     =((                       '+'))^'_';$/='&'               |((
      '@'                      ));$,   =('[')&               '~'
       ;$\                              =','^               '|'
         ;$:                              =(      ((      '.'
          )))                                   ^+       '~'
            ;$~                               =(       '@'
              )|+                                    '('
                 ;$^                              =((
                    ')'                        ))^
                        '['                ;$/
                            ='`'|('.');#;#

Caveat

Since Perl version 5.18, the mechanism that allows this code to run has become so powerful that it has been disabled by default to prevent misuse. Therefore on versions 5.18+ you can either add use re 'eval'; to the top of the script or, if the script is named world.pl you can run it like perl -Mre=eval world.pl. It is unfortunate that these unsightly characters must be added, but c'est la vie. (Note: I want to emphasize that enabling this feature is not using some library or addon, the code displayed is valid Perl code, the mechanism is simply no longer enabled by default).

\$\endgroup\$
8
  • 1
    \$\begingroup\$ I tried it and it is just great! +1 \$\endgroup\$
    – Tomas
    Oct 10, 2011 at 17:55
  • 2
    \$\begingroup\$ @TomasT. thanks, it was fun to do, and it actually did take some golfing to get that to run in only 3 pictures! \$\endgroup\$ Oct 10, 2011 at 18:15
  • 1
    \$\begingroup\$ FYI It uses the Perl regexp feature (?{ code }) to evaluate custom Perl code while regexp matching. The custom Perl code prints the message. It's nice because it doesn't violate any of the rules. \$\endgroup\$
    – pts
    Aug 23, 2013 at 22:54
  • 5
    \$\begingroup\$ You sir, are the hello world king! \$\endgroup\$ Jan 4, 2014 at 15:27
  • 1
    \$\begingroup\$ Wow! Just wow! Now I need to learn Perl just to see how on earth you did that. \$\endgroup\$
    – Gryphon
    Jun 10, 2017 at 13:39
68
\$\begingroup\$

C# (175 chars)

It was quite a challenge to do this in C# because the restrictions preclude any use of quite a lot of the common keywords. It is possible in C# to use \uxxxx Unicode escape sequences in identifiers, but unfortunately not in keywords.

I suspect that this solution only works when compiled against .NET 4.0. See explanation for why.

using System;struct a{static int Main(){object[]c={"\u0048e\x6c\x6co "+(C\u0068ar)(86+1)+"or\x6c\x64"};typeof(Conso\u006ce).GetMet\u0068o\u0064s()[101].Invoke(c,c);return 0;}}

Explanation

// I won’t be able to get anywhere without using “System”.
// Even if I write it as “Syst\u0065m”, it still violates rule 2.
// Therefore, that is the rule we’ll violate.
using System;

// Thus, we can’t use: H L W D 2 7
// We can’t write “class”, so the Main type must be a struct.
struct a
{
    // We can’t write “void”, so Main needs to return an int.
    static int Main()
    {
        // We can’t write “new”, but we can instantiate an array
        // using the initialisation syntax.
        object[] c = {
            "\u0048e\x6c\x6co " + (C\u0068ar) (86 + 1) + "or\x6c\x64"
        };

        // We can use the character escape sequence to write “Console”, but not
        // “Write” because W is \u0057, which contains a 7. Therefore, we have to
        // use Reflection to get it. This relies on the fact that Console.Write(string)
        // is the 102nd method of the type Console in my copy of the framework.
        // Also, the first argument to Invoke can be anything for a static method
        // (needn’t be null). The second one is the actual argument to Console.Write.
        typeof(Conso\u006ce).GetMet\u0068o\u0064s()[101].Invoke(c, c);

        // Since Main returns int, we have to return something.
        return 0;
    }
}
\$\endgroup\$
5
  • \$\begingroup\$ You can use Uri instead of object for b. You can use \xHH in strings instead of \u00HH where it's unambiguous (\x is variable-length). On second thought, you don't need b at all and can just reuse c as the first argument to Invoke. MSDN states that for static methods the first argument is ignored. This brings it down to 175 for me. \$\endgroup\$
    – Joey
    Apr 4, 2011 at 12:58
  • \$\begingroup\$ @Joey: Whoa, thanks! Although if the first argument to Invoke can be anything, it needn’t even be c, it could be 0... :) \$\endgroup\$
    – Timwi
    Apr 4, 2011 at 13:27
  • \$\begingroup\$ Yes, noticed that when I tried to inline c (which sadly doesn't work since new requires an e and .Split('x') is too long (came out at 177). \$\endgroup\$
    – Joey
    Apr 4, 2011 at 13:31
  • \$\begingroup\$ I had no idea this was possible. +1 \$\endgroup\$ Jun 4, 2011 at 20:58
  • 1
    \$\begingroup\$ Very intelligent thing you did with GetMethods. +1 \$\endgroup\$ Apr 27, 2013 at 14:29
54
\$\begingroup\$

GolfScript, 17 chars

'·š““ß¨“›'{~}%

When testing this submission, please save the file as straight binary, not UTF-8. Having trouble recreating the file? Here's the hexdump of it:

00000000  27 b7 9a 93 93 90 df a8  90 8d 93 9b 27 7b 7e 7d  |'...........'{~}|
00000010  25                                                |%|
\$\endgroup\$
5
  • 1
    \$\begingroup\$ Although I'd like to think it's an obvious solution, if you're at all unclear about how this entry works, you can read this spoiler: chat.stackexchange.com/transcript/message/442257#442257 :-) \$\endgroup\$ Feb 1, 2011 at 0:08
  • 14
    \$\begingroup\$ It's not ISO-8859-1, it's actually Windows-1252. \$\endgroup\$ Apr 27, 2012 at 11:57
  • \$\begingroup\$ @GlitchMr: I'm actually pretty certain the submission contains characters that are outside of Windows-1252 too. ;-) \$\endgroup\$ Apr 27, 2012 at 12:40
  • \$\begingroup\$ @xfix It really isn't Windows-1252 either. Although Windows-1252 has more valid characters than ISO-8859-1, my entry contains characters, such as 0x8D and 0x90, that aren't valid in Windows-1252 either. \$\endgroup\$ Sep 25, 2015 at 0:45
  • \$\begingroup\$ Fair enough, forgot that some characters are disallowed in Windows-1252. \$\endgroup\$ Sep 26, 2015 at 8:36
53
\$\begingroup\$

BrainFuck, 106 strokes

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

Meets all the rules and it sure is obfuscated.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ I think I can still golf it down a bit, but that will have to wait until I get some sleep. \$\endgroup\$ Feb 2, 2011 at 1:25
  • 36
    \$\begingroup\$ Isn't BrainFuck obfuscated by its definition? \$\endgroup\$
    – mbx
    Jul 13, 2011 at 11:17
  • 20
    \$\begingroup\$ Any competent BF programmer would be able to recognize this... \$\endgroup\$
    – user541686
    Aug 5, 2011 at 4:10
  • 9
    \$\begingroup\$ Brah, Protected by community, whatever, ++++++++++[>++++++>+++<<-]>++++++++++++.---.+++++++..+++.>++.<++++++++.--------.+++.------.--------. is just 100 strokes, mine is better than yours \$\endgroup\$
    – OverCoder
    Aug 13, 2015 at 14:12
  • 2
    \$\begingroup\$ @OverCoder -[------->+<]>-.---.+++++++..+++.+[----->++<]>.---[->+++<]>.--------.+++.------.--------. - 89 bytes. \$\endgroup\$ Jan 21, 2020 at 10:24
52
\$\begingroup\$

Javascript, 2595

This only breaks rule 2.

゚ω゚ノ=/`m´)ノ~┻━┻//*´∇`*/['_'];o=(゚ー゚)=_=3;c=(゚Θ゚)=(゚ー゚)-(゚ー゚);(゚Д゚)=(゚Θ゚)=(o^_^o)/(o^_^o);(゚Д゚)={゚Θ゚:'_',゚ω゚ノ:((゚ω゚ノ==3)+'_')[゚Θ゚],゚ー゚ノ:(゚ω゚ノ+'_')[o^_^o-(゚Θ゚)],゚Д゚ノ:((゚ー゚==3)+'_')[゚ー゚]};(゚Д゚)[゚Θ゚]=((゚ω゚ノ==3)+'_')[c^_^o];(゚Д゚)['c']=((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)-(゚Θ゚)];(゚Д゚)['o']=((゚Д゚)+'_')[゚Θ゚];(゚o゚)=(゚Д゚)['c']+(゚Д゚)['o']+(゚ω゚ノ+'_')[゚Θ゚]+((゚ω゚ノ==3)+'_')[゚ー゚]+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+((゚ー゚==3)+'_')[゚Θ゚]+((゚ー゚==3)+'_')[(゚ー゚)-(゚Θ゚)]+(゚Д゚)['c']+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+(゚Д゚)['o']+((゚ー゚==3)+'_')[゚Θ゚];(゚Д゚)['_']=(o^_^o)[゚o゚][゚o゚];(゚ε゚)=((゚ー゚==3)+'_')[゚Θ゚]+(゚Д゚).゚Д゚ノ+((゚Д゚)+'_')[(゚ー゚)+(゚ー゚)]+((゚ー゚==3)+'_')[o^_^o-゚Θ゚]+((゚ー゚==3)+'_')[゚Θ゚]+(゚ω゚ノ+'_')[゚Θ゚];(゚ー゚)+=(゚Θ゚);(゚Д゚)[゚ε゚]='\\';(゚Д゚).゚Θ゚ノ=(゚Д゚+゚ー゚)[o^_^o-(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ+'_')[c^_^o];(゚Д゚)[゚o゚]='\"';(゚Д゚)['_']((゚Д゚)['_'](゚ε゚+(゚Д゚)[゚o゚]+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+(゚Θ゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+((゚ー゚)+(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)+(o^_^o))+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)+(o^_^o))+(゚ー゚)+(゚Д゚)[゚ε゚]+((゚ー゚)+(゚Θ゚))+(c^_^o)+(゚Д゚)[゚ε゚]+(゚ー゚)+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚Θ゚)+(c^_^o)+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+((゚ー゚)+(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+((゚ー゚)+(o^_^o))+(゚Д゚)[゚ε゚]+(゚ー゚)+(c^_^o)+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)-(゚Θ゚))+((゚ー゚)+(o^_^o))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+((゚ー゚)+(o^_^o))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((o^_^o)+(o^_^o))+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+(゚Θ゚)+((゚ー゚)+(゚Θ゚))+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚Θ゚)+(゚ー゚)+(゚ー゚)+(゚Д゚)[゚ε゚]+(゚ー゚)+((o^_^o)-(゚Θ゚))+(゚Д゚)[゚ε゚]+((゚ー゚)+(゚Θ゚))+(゚Θ゚)+(゚Д゚)[゚o゚])(゚Θ゚))('_');
\$\endgroup\$
6
  • 14
    \$\begingroup\$ I tried it on UglifyJS on it but it saved -2574 bytes. \$\endgroup\$ Apr 27, 2012 at 11:53
  • 16
    \$\begingroup\$ I have no idea what I'm looking at here. \$\endgroup\$
    – Bob
    Jan 13, 2014 at 5:59
  • 7
    \$\begingroup\$ @Bob = obfuscated Javascript. Hint: it starts by assigning a regular expression literal (namely '/`m´)ノ~┻━┻/') to a variable with the name ` ゚ω゚ノ. That's followed by a comment and the expression ['_']` in void context. Then the variable o (along with _ and (゚ー゚)) is assigned the value 3. It continues in that vein, doing lots of extra harmless work that is effectively no-ops, and using roundabout ways to do the intended work (calling alert("Hello world")) in a non-obvious fashion. \$\endgroup\$
    – Mark Reed
    Jan 21, 2014 at 3:15
  • 8
    \$\begingroup\$ Source: utf-8.jp/public/aaencode.html \$\endgroup\$
    – Jason C
    Mar 24, 2014 at 5:27
  • \$\begingroup\$ You can explore the AST here: astexplorer.net \$\endgroup\$ Jun 15, 2020 at 14:46
42
\$\begingroup\$

Befunge-93 - 10x9 block

va:)/v<>#<
9A:)."c:P^
>"iqwt\%"^
bv"Mjq"<.<
c>v<-"x^x]
(C:,3>>^:(
$,9^;)|:O]
>5-^-.--.-
^<_#?>@_@<

Sorry. :D

I wasn't going for small size here, I was trying to really OBFUSCATE the code by including as many smiley faces and noise as possible! :D

Should go with rules 2 and 3.

\$\endgroup\$
1
  • 19
    \$\begingroup\$ "@_@" I laughed. \$\endgroup\$
    – Wug
    Aug 3, 2012 at 15:06
35
\$\begingroup\$

Golfscript - 17 chars

Easier to copy/paste than Chris'

'Ifmmp!Xpsme'{(}%

Basically a caesar cipher shifting by 1 char

\$\endgroup\$
4
  • 5
    \$\begingroup\$ +1 Nice for being simpler to copy. Mine has the advantage of breaking none of the rules, and also (probably, depending on whether high-bit characters count as symbols) fulfilling symbol golf also. :-) \$\endgroup\$ Feb 1, 2011 at 3:30
  • \$\begingroup\$ How does this break a rule? \$\endgroup\$
    – d-_-b
    Feb 10, 2011 at 14:47
  • 11
    \$\begingroup\$ @sims, it has an e in it \$\endgroup\$
    – gnibbler
    Feb 10, 2011 at 20:05
  • 3
    \$\begingroup\$ TWO of the three. :D \$\endgroup\$
    – Rob
    Oct 4, 2011 at 14:08
32
\$\begingroup\$

Python

Rule I & III (34 chars)

print'Uryyb Jbeyq'.decode('rot13')

Rule I & III, alternative (39 chars)

print"\110e\154\154o %cor\154\144"%~-88

Rule II & III (37 chars)

input("H\x65ll\x64 W\x64%cld"%(3*38))

Rule I and II (50 chars)

input('\x48\x65\x6c\x6c\x6f \x57\x6f\x72\x6c\x64')

All three rules (58 chars)

input("\x48\x65\x6c\x6c\x6f %c\x6f%c\x6c\x64"%(84+3,3*38))
\$\endgroup\$
4
  • 1
    \$\begingroup\$ deleted my answer, i think yours is more comprehensive. \$\endgroup\$
    – st0le
    Feb 1, 2011 at 13:37
  • \$\begingroup\$ +1,great piece but no surprise I have seen you golfing :-) \$\endgroup\$
    – Quixotic
    Mar 8, 2011 at 23:05
  • \$\begingroup\$ You need to import codecs before you can codecs.decode \$\endgroup\$
    – cat
    Oct 22, 2015 at 23:45
  • \$\begingroup\$ You can remove the parens in the first solution \$\endgroup\$
    – Cyoce
    Oct 17, 2016 at 2:38
25
\$\begingroup\$

JavaScript, 366 chars

After seeing Joel Berger's Perl solution, I felt compelled to do some ASCII art prettiness myself... JavaScript, uses no alphanumerics, and contrary to JSFuck output it's actually reasonably sized.

                   $$
                  =-~-
                 ~[];$_
                =$$+ $$;
               _$=$$+$$+-
              ~[];_=-~[];$
             =!![]+[];__={}
            +[];$$_=/\\ /+[]
           _$$=(![]+[])[_]+(!
          []+[])[$$]+$[$_+~[]]
         +$[_]+$[+[]];$=__[_$]+
        __[_]+($[$]+[])[_]+(![]+
       [])[$_+~[]]+$[+[]]+$[_]+$[
      $$]+__[_$]+$[+[]]+__[_]+$[_]
     _=$$_[_]+-~[];$[$][$](_$$+'("'
    +_+-~[]+-[]+_+$_+_$+_+_$+$_+_+_$
   +$_+_+_$+[$$+_$]+$$_[-~[]]+$_+-[]+
  _+$$+[$$+_$]+_+_$+[$$+_$]+_+[$$+$_]+
                $$+ _+_$
                +$_+_+$_
                +$_+'")'
                  )($)
\$\endgroup\$
4
  • \$\begingroup\$ could you please display the number of characters in your code in the heading? I'm curious to see how many you got it to... \$\endgroup\$ Jan 20, 2014 at 22:32
  • \$\begingroup\$ @Eliseod'Annunzio there you go, I forgot that this was code-golf. Length is given with whitespace stripped and the last ($) turned into () (because I added $ for symmetry). \$\endgroup\$
    – FireFly
    Jan 20, 2014 at 22:53
  • \$\begingroup\$ Thanks for your tips... I had to resize my code out to account for the "W" and then shrunk it down using your advice... \$\endgroup\$ Jan 21, 2014 at 0:58
  • \$\begingroup\$ +1, do tell us how you obfuscated your JS like that! :0 \$\endgroup\$ Nov 19, 2020 at 9:43
24
\$\begingroup\$

rot13 - 11 chars

Uryyb Jbeyq

2019/2/12: This answer is being kept for historical reasons, and is no longer a valid answer under current site rules.

\$\endgroup\$
3
  • 3
    \$\begingroup\$ Is rot13 a language? :/ \$\endgroup\$ Nov 16, 2015 at 8:12
  • 3
    \$\begingroup\$ yes and I can create its interpreter :P \$\endgroup\$
    – u185619
    Mar 14, 2016 at 17:07
  • 7
    \$\begingroup\$ Technically, rot13 is just a cipher. It is as much a langauge as a Vigenère cipher. \$\endgroup\$
    – XiKuuKy
    Sep 14, 2016 at 10:47
21
\$\begingroup\$

Scala, 39

Solutions like print("Qnuux)`x{um"map(_-9 toChar)) (35 chars) fall foul of rules 1 and 2 ("toChar" contains both "h" and "r"), which makes this a bit tough.

Finally came up with this:

print("䠀攀氀氀漀 圀漀爀氀搀"map(_.reverseBytes))

Suggestions for improvement welcome

\$\endgroup\$
19
\$\begingroup\$

TeX, 95 Bytes

Breaks the third rule.

\^^5pp^^%^^2^^#^^!^^3^^%{^^(}^^%^^,^^,^^/
\^^5pp^^%^^2^^#^^!^^3^^%{^^7}^^/^^2^^,^^$!
\^^%^^.^^$

Run with tex filename.tex to get a dvi output, or pdftex filename.tex to get a pdf.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Wow, never knew TeX can be so obfuscated! \$\endgroup\$
    – gar
    Jun 2, 2014 at 18:04
19
\$\begingroup\$

Bash, 30 25 characters

tr G-t F-s<<<Ifmmp\ Xpsme

With thanks to Peter Taylor for the herestring usage.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ You can save 5 characters using a here string: tr G-t F-s<<<Ifmmp\ Xpsme \$\endgroup\$ Feb 5, 2011 at 20:35
14
\$\begingroup\$

><>, 2×20 = 40 characters

'mu{x`)xuunQ'>9-o?v;
            ;^?o-9< 

Violates Rule II, since I cannot output a character without using o.

\$\endgroup\$
13
\$\begingroup\$

Windows PowerShell, 91 95 97 98

($OFS='')+('Qnuux)`x{um'|% t*y|%{"[convert]::"+([convert]|gm -s t*r).name+"($($_-9))"|iex})

Violates only Rule II.

It's very evil that char violates two rules on its own already.

And yikes, this one was hard to get working.

  • The first line sets $OFS to '' so when casting an array to a string no spaces appear between items.

  • Casting to char actually was the hardest part of all and I spend around a day searching for a way. I got all the rest working nicely but once I do calculations on them I have ints, not chars. Putting those back in a string was kinda hard.

  • I found a way of invoking Invoke-Expression without needing the e as well:

      &(gcm i?x)
    

    but that still lacked the arguments. And I've thrown away my goal of satifying all three rules by then already. Also it didn't particularly help me in casting to char.

  • Shortened a bit with a newer PowerShell version. No useful different way of creating the result emerged, though, sadly.

\$\endgroup\$
3
  • \$\begingroup\$ There's still lots of "o"s and "e"s in here, and an "r". Not sure I'd have much better luck cleaning that out either, though. Might yet have to give it a shot sometime. \$\endgroup\$
    – Iszi
    Nov 17, 2013 at 5:01
  • \$\begingroup\$ Just re-read the rules - only needed two of the three rulesets met, and this does qualify. Good show! Would be uber-awesome if we could come up with one that takes 3/3, but I doubt that's very possible. \$\endgroup\$
    – Iszi
    Nov 17, 2013 at 8:03
  • \$\begingroup\$ Took me plenty of time to get to this point already, and I still doubt it's possible to follow all rules. \$\endgroup\$
    – Joey
    Nov 17, 2013 at 11:43
11
\$\begingroup\$

PHP (16 bytes)

I've noticed that my previous PHP example wasn't obfuscated enough, so let's see more blatantly obfuscated examples (warning, obfuscation!). Also, blatantly copying GolfScript example, except making it smaller (is it even possible?). This entry requires either PHP 5.4 or short_open_tag enabled. No rule was broken while making this. In fact, this entry doesn't contain any ASCII letters or digits.

This example doesn't break any of the rules. Have fun. To generate file, run following command.

printf "<?=~\xb7\x9a\x93\x93\x90\xdf\xa8\x90\x8d\x93\x9b;" > obfus.php

Or, in case you don't trust running printf command, I've prepared Base64 dump of the file.

PD89freak5OQ36iQjZObOw==

If you think that both methods to generate it break rules, I also have generated file on Dropbox.

And to run it.

php obfus.php

The resulting file should have 16 bytes. Have fun running it. Please note that if you have E_NOTICE warnings enabled, it will show notice. Just ignore it, fixing it would waste two characters one character (I can use @ operator, after all) and would make resulting Base64 look less awesome.

\$\endgroup\$
0
10
\$\begingroup\$

Whitespace (167 characters)

To obtain the WS program, substitute a Space, Tab, or Linefeed character for S, T, L, respectively, in the following string:

SSSTSSTSSSLTLSSSSSTTSSTSTLTLSSSSSTTSTTSSLTLSSSSSTTSTTSSLTLSSSSSTTSTTTTLTLSSSSSTSSSSSLTLSSSSSTSTSTTTLTLSSSSSTTSTTTTLTLSSSSSTTTSSTSLTLSSSSSTTSTTSSLTLSSSSSTTSSTSSLTLSSLLL

or download the "raw" whitespace-only program in the text-file hello.ws.

When executed by this WS interpreter, this program prints "Hello World".

Explanation (ignore the whitespace here!):

SSS TSSTSSSL TLSS  <-- output H (ascii code 72 in decimal, 1001000 in binary) 
SSS TTSSTSTL TLSS  <-- output e (ascii code 101 in decimal, 1100101 in binary) 
SSS TTSTTSSL TLSS  <-- etc
SSS TTSTTSSL TLSS
SSS TTSTTTTL TLSS
SSS TSSSSSL TLSS
SSS TSTSTTTL TLSS
SSS TTSTTTTL TLSS 
SSS TTTSSTSL TLSS 
SSS TTSTTSSL TLSS
SSS TTSSTSSL TLSS 
LLL                <-- end the program

The "middle" strings (e.g. TSSTSSSL) are the ascii codes (in binary, with S denoting 0, T denoting 1) for the successive letters in "Hello World". The prefix SSS pushes the number that follows it (terminated by an L) onto the stack. TLSS outputs the character whose ascii code is on top of the stack. Finally, according to this tutorial, a program must end with LLL for a clean exit by the interpreter.

NB: I'm entering this as a separate answer, because the other WS program entry is a 1287-character program that prints "Hello, world of spaces!" instead of the required "Hello World".

\$\endgroup\$
0
8
\$\begingroup\$

Ruby - 63 characters

puts [%w{G d k k n},%w{V n q k c}].map{|l|l.map(&:succ)*''}*' '
\$\endgroup\$
3
  • \$\begingroup\$ breaks #1, though \$\endgroup\$ Apr 29, 2013 at 5:54
  • \$\begingroup\$ And even shorter: puts "Gdkkn~Vnqkc".split("").map(&:succ)*'' - 43 \$\endgroup\$
    – Biketire
    Jul 7, 2015 at 13:59
  • \$\begingroup\$ I can only imagine what is going through this guy's head when he suggests a piece of code with the string succ in it. \$\endgroup\$ Mar 22, 2020 at 15:26
7
\$\begingroup\$

C (94)

On little Endian machines:

main(){int i[]={1819043144,((0x1bc5c81b|1<<0x14)*4)+3,0xa646c00|(0x39<<1),0};printf("%s",i);}

Violates rule II, but satisfies the rest.

\$\endgroup\$
1
  • \$\begingroup\$ 79 characters: i[]={1819043144,((0x1bc5c81b|1<<0x14)*4)+3,0x646c00|(0x39<<1)};main(){puts(i);} \$\endgroup\$ Jun 18, 2020 at 22:51
7
\$\begingroup\$

C, 160 chars

Works only on little-endian machines with 4-byte int:

main(){int a='a',b=a/a,c=b+b,f=c+c,g=f+f,i=g+g,j=i*i,k=j*j,m=a+g+b+c,n=m+b+c;int p[]={a+g-b+(a+f)*j+m*k*(j+b),n+i*c*j+k*(n+g+n*j),a+i+b+m*j+(a+f-b)*k};puts(p);}

Satisfies all three rules.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You could just use numeric constants without 0,1,2,7: p[];main(){p={(5*5*5*5*5*64+96696)*(443+5688),(5*3*4*3+4-3)*(66*45*6-6*6-4+3)*8‌​3*(3+4),6544494+36868};puts(p);} -- 111 chars. \$\endgroup\$
    – user21677
    Jun 13, 2015 at 3:44
  • 2
    \$\begingroup\$ Similar vein (actually tackled the problem in a few different ways before settling on this). x[]={45483*39994-3958,48465*38543-5584,6584695-3333};main(){puts(x);} - 69 characters. I'm sure I could shave a few more off given more time to mathify the literals some more. Was a fun way to spend a couple hours, anyway :) \$\endgroup\$ Jul 7, 2015 at 19:11
7
\$\begingroup\$

PHP, 28 bytes

Not exactly obfuscated, but very short and obvious :). Showing that even when limiting characters you can make very easy to follow programs. Constraints 1 and 3 followed. Constraint 2 was abused.

<?=str_rot13('Uryyb Jbeyq');

Note that this requires short_open_tag being set, unless you're using PHP 5.4 or higher. Maybe some examples are shorter, but I think that this example is pretty short.

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

Dis, 102 83 chars

Unrolled the code loop since the letters can be generated with less than five consecutive operations. Saved a few characters by reusing the accumulator value: two l are consecutive , SPACE can be generated from o and d can be generated from l.

*>|||{>|||{>||{{>|{|||{>||{>|{>|||{>||{||{!!>**_!!}|_}!^__}|__>*__}|_}|_>!!|_}!^__!

Old version

^}!>^^_^!__!>_^!^^**_^!^^**_
^_!{**_^__!{>_^__{>>!^_!{**_
^_!>^*_^!^^**_^_^^**_*______
___________>||||{^

With comments below. It is using a sequence of five identical operations to generate all the characters in Hello World: one rotation and four subtractions.

^     (move code pointer to data pointer value '^')
}!>^^ (store 'H' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
!__!> (store 'e' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
!^^** (store 'l' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
!^^** (store 'l' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
_!{** (store 'o' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
__!{> (store ' ' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
__{>> (store 'W' in accumulator)
!     (program termination)
^     (data pointer value used by code pointer jump)
_!{** (store 'o' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
_!>^* (store 'r' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
!^^** (store 'l' in accumulator)
_     (no-op)
^     (data pointer value used by code pointer jump)
_^^** (store 'd' in accumulator)
_     (no-op)
*     (data pointer value used by code pointer jump to reach '!' between 'W' and 'o')
________________ (no-ops)
_     (no-op, address '^')
>|||| (rotate data value and perform four subtractions)
{     (print value in accumulator)
^     (move code pointer to data pointer value '^' except for the last jump '*')
\$\endgroup\$
1
  • \$\begingroup\$ Which interpreter did you use? I tried with mine but it output diffrently. \$\endgroup\$
    – user100411
    Jun 21, 2021 at 13:57
7
\$\begingroup\$

bash 28 chars:

printf 'p|ɹ°M ο||ǝ%b'"\x48"

p|ɹοM ο||ǝH

alternatively with /bin/echo (18 chars) *) see discussion below.

/bin/echo -e 'p|ɹοM ο||ǝ\0110'

Selftest:

echo "printf 'p|ɹοM ο||ǝ%b' "\x48"" | egrep -i "[^hlwd27eor01]"

Harder than thougth! Tools, for turning Words upside down, the tools think an 'H' or 'o' turned upside down is best displayed as H or o. This would be in conflict with group 1 (Hlwd:27:eor01) respectively 3.

H can be displayed with

echo -e "\0127"

but 01 and 2 are poisoned too. Gee! But the bash-buildin echo has not only the option to display octal ascii values, but hexadecimal too:

echo -e "\x48"

But if we use bash as a programming language, the echo command is part of the program, which not only counts to the character count, but also contains the poisoned characters (hlwd:27:eor01) eho from groups 1 and 3.

So this is moment the echo died. Fortunately, there is printf, which knows "%b" to display .

The r is the only problematic character in printf, and belongs to group 3. Since 'o' is in the last group, we could leave it in Hello and in World, but we can use the omicron ο which looks like an o, or ° &deg;.

Links:

\$\endgroup\$
4
  • \$\begingroup\$ Would upvote this, but your reputation is too leet. \$\endgroup\$ Apr 28, 2012 at 7:18
  • \$\begingroup\$ @GlitchMr: Now you can - I voted something down, and should be seet 500N. :) \$\endgroup\$ Apr 28, 2012 at 9:20
  • \$\begingroup\$ dl.dropbox.com/u/63913412/stilltooleet.png. Also, downvoting questions doesn't decrease reputation. Downvoting answers does nevertheless. \$\endgroup\$ Apr 28, 2012 at 9:32
  • \$\begingroup\$ @GlitchMr: Ah, that's it! :) \$\endgroup\$ Apr 28, 2012 at 12:34
6
\$\begingroup\$

JavaScript - 132 characters

(_=(_=[][(f=!!(_='')+_)[3]+(b=({}+_)[(I=-~(z=_-_))])+($=(c=(d=!_+_)[I])+d[z])])())[f[I]+'l'+(a=d[3])+$]("H"+a+'ll'+b+' W'+b+c+'ld')

Breaks rule I

Usage:

  • Paste "javascript: [script]" into browser address bar
  • Make a blank html page, paste the script into a tag
\$\endgroup\$
8
  • \$\begingroup\$ Breaks both rule 1 and 2. You are using the number 1 for the arrays. \$\endgroup\$ Feb 4, 2011 at 20:30
  • \$\begingroup\$ You can replace 1 by !![]+![] and 0 by ""-"" to don't break rule #2. \$\endgroup\$
    – HoLyVieR
    Feb 15, 2011 at 21:13
  • \$\begingroup\$ Thanks @Bass5098 and @HoLyVieR, I kind of missed the 1 and 0 when minimizing the script. I replaced 0 with z=_-_ and 1 with I=-~z, I could also use ++z, but -~ looks nicer :) \$\endgroup\$
    – m0sa
    Feb 16, 2011 at 7:46
  • 3
    \$\begingroup\$ Huh? !![]+![]? Why not just 4-3? \$\endgroup\$
    – Timwi
    Mar 9, 2011 at 1:32
  • 4
    \$\begingroup\$ @Timwi: More obfuscation \$\endgroup\$ Aug 5, 2011 at 23:06
6
\$\begingroup\$

C: 162 characters (excluding unnecessary newlines)

I opted for readability and transparency when writing this.

a[3],b;main(){b=99
+9;b+=b<<8;b=b<<8|
97|4;b=b<<8|64|8;a
[3^3]=b;b=78+33<<8
;b+=87;b=b<<8|35^3
;b=b<<8|64|47;a[5^
4]=b;b=97+3<<8;b+=
99+9;b=b<<8|66|48;
a[6^4]=b;puts(a);}

It satisfies all three requirements.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I like this, but unfortunately it doesn't satisfy all the rules, because it contains the digit 7, violating rule #3. But it would be easy to get rid of 7. Also by adding a few ints, and adding a few extra parentheses, and adding int puts(int*); to the beginning, it compiles with gcc -ansi -W -Wall only with a single warning: control reaches end of non-void function. \$\endgroup\$
    – pts
    Aug 24, 2013 at 7:05
  • \$\begingroup\$ > I opted for readability and transparency when writing this. That's saying something :) \$\endgroup\$
    – nz_21
    Mar 29, 2020 at 20:17
5
\$\begingroup\$

Bash, 24 20 characters

You need to have the "bsdgames" package installed.

rot13<<<Uryyb\ Jbeyq

Thanks gnibbler :)

\$\endgroup\$
5
\$\begingroup\$

PostScript, 41 chars

<64><~+BNK%C]~><48656c6c6f>3{print}repeat

Usage: $ gs -q -dNOPROMPT -dNODISPLAY filename.ps

\$\endgroup\$
1
  • 1
    \$\begingroup\$ you could also run it like: gsnd -q -- filename.ps \$\endgroup\$ Nov 24, 2011 at 3:47
5
\$\begingroup\$

JavaScript, 66 chars

Another JavaScript solution, this time breaking rule #2.

top[(U=unescape)('a%6cert')](U('%48e%6c%6co %5'+(6+1)+'or%6c%64'))

The above follows the concept behind hallvabo's answer. Before I caught on to that approach, I had the arguably-more obfuscated version:

top[8680439[n='toString'](30)]((16+1)[n](z=8*4)[u='toUpperCase']()
+15960[n](33)+'o '+z[n](33)[u]()+1155505[n](36))

which also breaks rule #2 and comes in at 114 chars. (Remove the carriage return in this second solution as it is just there for readability.)

\$\endgroup\$
2
  • 5
    \$\begingroup\$ I read that as Runescape. \$\endgroup\$ Nov 1, 2011 at 23:43
  • \$\begingroup\$ @MateenUlhaq I always read it as Runescape, and I only played for a year over a decade ago... What's wrong with me? \$\endgroup\$
    – Mwr247
    Sep 16, 2015 at 16:30
5
\$\begingroup\$

Haskell, 38

Constraints 1 and 3 followed.

main=putStr$map succ"G\x64kkn\USVnqkc"
\$\endgroup\$
5
\$\begingroup\$

C (79*12=948)

Using no strings or characters, and only the number one.
I was a little creative with the bitshifts and subtractions to make them fit onto at 80x12 console. Ask me in the comments if you can't figure it out.

int i[(1+1)+1],*I=i;main(){*I++=(((1<<((1<<(1+1))*(1<<(1+1))))+((1<<((((1<<(1<<
(1+1)))-1)^(1<<1+1))-1))-(1<<1)-1+((1<<1)*(1<<1)*(1<<1)*(111-(((1<<(1<<(1+1)))-
1)^(1<<1+1))))))*(((((1<<(1+1))*(1<<(1+1)))*(1<<1)-((1<<(1+1))|1))*(((((1<<(1<<
(1+1)))-1)^(1<<1+1))*((((1<<(1<<(1+1)))-1)^(1<<1+1))-1)*((((1<<(1<<(1+1)))-1)^(
1<<1+1))-1)+(((1<<(1<<(1+1)))-1)^(1<<1+1)))-((((1<<(1<<(1+1)))-1)^(1<<1+1))*(((
(1<<(1<<(1+1)))-1)^(1<<1+1))-1)+1)))+((1<<1)|(1<<(1+1))))+(1<<1));*I++=i[1-(1<<
(1-1))]+(((1<<((((1<<(1<<(1+1)))-1)^(1<<1+1))+(1<<1)))+((1<<(((1<<(1<<(1+1)))-1
)^(1<<1+1)))-(1<<(1+1))*(1<<(1<<1))*((1<<(1<<1))-1)-(1<<1)-1))*(((1<<2)*(1<<2)*
((1<<(1+(1<<(1-1))))-1))*((((1<<(1<<(1+1)))-1)^(1<<1+1))-1)*((((1<<(1<<(1+1)))-
1)^(1<<1+1))-1)+(1<<1)+1));*I++=(((1<<(1<<(1<<(1<<1))))+(1<<(1<<((1<<1)+1)))+((
(((1<<(1<<(1+1)))-1)^(1<<1+1))-1)*(1<<1)+1))*((((1<<(1<<(1+1)))-1)^(1<<1+1))-1)
*((((1<<(1<<(1+1)))-1)^(1<<1<<1))-1)+(1<<((1<<1)*((1<<1)+1)))-(1<<1));puts(i);}
\$\endgroup\$
1
2 3 4 5

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.