Hello World 0.0!

78

16

Dilbert is awesome
source: Dilbert, September 8, 1992

I'm hoping to add a new twist on the classic "Hello World!" program.

Code a program that outputs Hello World! without:

  • String/Character literals
  • Numbers (any base)
  • Pre-built functions that return "Hello World!"
  • RegEx literals

With the exceptions of "O" and 0.

†"O" is capitalized, "o" is not acceptable.

zzzzBov

Posted 2011-03-11T21:18:56.530

Reputation: 2 915

I hope by "numbers" you mean "numeric constants", because there probably wouldn't be much programming left without. – J B – 2011-03-11T21:42:35.623

Numeric literals/constants, yes. – zzzzBov – 2011-03-11T21:45:01.640

So stuff like ?! (character value of "!" in Ruby 1.8) would be allowed, then? – Ventero – 2011-03-11T21:53:14.860

I'm not familiar with Ruby's syntax, is ?! a special string literal? I consider RegEx literals like /Hello World/ to be too similar to string literals. – zzzzBov – 2011-03-11T21:55:59.273

In Ruby 1.8, ?x is the character value of the character x. So for example ?a is 97, ?A is 65 and ?! is 33. It's not a string, I'm just not sure if it fits your definition of a numeric literal. – Ventero – 2011-03-11T21:57:38.430

4One of [code-golf] and [code-challenge] please, not both. The point of these tags to to help people find questions with the rules they want to use. Essentially every question on this site should be a game of some kind or another. – dmckee --- ex-moderator kitten – 2011-03-11T22:29:15.550

4

-1 We've already had Obfuscated Hello World, and I think this challenge is too similar. I'd have cast a "close as duplicate" vote, if I weren't a mod.

– Chris Jester-Young – 2011-03-11T22:35:28.100

@Chris Jester-Young, I feel that this version of the hello world problem is different enough, if purely because it's more difficult. It'd be like saying this should be closed just because it's a "Hello World" problem. – zzzzBov – 2011-03-11T23:37:04.760

2@zzzzBov: I don't think it's different enough to warrant another question in the "hello world" theme; a different theme would have been better. But, that's just my opinion. – Chris Jester-Young – 2011-03-11T23:39:15.083

1I think this is a fine code golf - and better than the prior one. – MtnViewMark – 2011-03-12T06:58:11.860

2Some people seem to assume that "O"* means they can have a string literal with any number of O’s, including zero. I don’t think that was the intention. Please clarify. – Timwi – 2011-03-12T21:12:38.363

@Timwi, Multiple "O"s are fine, "" (an empty string literal) is not. Dilbert never mentioned using single "O"s in his programs. – zzzzBov – 2011-03-13T07:38:17.393

BTW, where did that comic come from? – Kevin Cox – 2013-11-22T15:13:20.947

@KevinCox, I completely forgot to credit the source! It's a Dilbert comic from 1992.

– zzzzBov – 2013-11-22T15:26:52.833

I thought it looked like Dilbert, it's amazing how the art style has changed though. – Kevin Cox – 2013-11-22T15:43:48.987

How would you solve this in Seed? – TehPers – 2017-07-26T18:09:33.300

Are we allowed to output Hello, World with a comma? – VFDan – 2019-05-22T20:01:22.437

@VFDan, no the question clearly shows the output as it is expected. – zzzzBov – 2019-05-22T21:18:13.877

@zzzzBov OK, if we were able to write Hello, World!, I could write a 0 byte program in stuck that does this – VFDan – 2019-05-22T21:20:23.297

@VFDan, the standard loopholes apply.

– zzzzBov – 2019-05-22T21:22:42.787

@zzzzBov IK, but Stuck was not designed to be a language that just prints Hello, World!. It actually is a legitimate programming language, just made for golfing

– VFDan – 2019-05-22T21:26:02.193

Can I even use Bash, given that command-line arguments are literals AFAIK? – None – 2014-04-13T12:43:17.817

Answers

83

Windows PowerShell, way too much

Yes, indeed, back in the day we had to write a »Hello world« using (almost exclusively) zeroes ...

&{-join[char[]]($args|% Length)} `
O00000000000000000000000000000000000000000000000000000000000000000000000 `
O0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O0000000000000000000000000000000 `
O00000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 `
O00000000000000000000000000000000

On a more serious note:

Windows PowerShell, 25

Write-Host Hello World!

No string literal. The Hello World! in there just happens to be parsed as a string since PowerShell is in argument parsing mode there.

Joey

Posted 2011-03-11T21:18:56.530

Reputation: 12 260

1"Back in the day". :) You millennials crack me up – None – 2017-01-26T23:29:47.683

2How is that real?? O_o – Josh – 2011-03-11T22:06:24.963

Oh. Unary. I get it. – Matthew Roh – 2017-07-26T16:22:09.003

1I searched the internet for some examples or history of this. This is so weird. Could you provide any links? – Caleb Jares – 2011-12-05T05:44:15.493

87

C, 327 chars

#define O(O)-~O
#define OO(o)O(O(o))
#define Oo(o)OO(OO(o))
#define oO(o)Oo(Oo(o))
#define oo(o)oO(oO(o))
#define O0 putchar
main() {
    O0(OO(oO(!O0(~O(Oo(OO(-O0(~O(Oo(-O0(O(OO(O0(oo(oO(O0(O(oo(oO(OO(Oo(oo(oO(
    O0(oo(oo(!O0(O(OO(O0(O0(O(OO(Oo(O0(O(Oo(oo(oO(O0(oo(oo(oO(oo(oo(0))))))))
    ))))))))))))))))))))))))))))))))))))));
}

Strangely, it does't lose its beauty after preprocessing:

main() {
putchar(-~-~-~-~-~-~-~-~-~-~!putchar(~-~-~-~-~-~-~-~-putchar(~-~-~-~-~-~-
putchar(-~-~-~putchar(-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~putchar(
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~putchar(-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
-~-~-~-~-~-~-~-~-~-~-~-~-~!putchar(-~-~-~putchar(putchar(-~-~-~-~-~-~-~putchar
(-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~putchar(-~-~-~-~-~-
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~0))))))))))));
}

ugoren

Posted 2011-03-11T21:18:56.530

Reputation: 16 527

I feel like the body could be shortened with even more preprocessors. Not sure if the code as a whole would benefeit though. – Zwei – 2016-10-27T03:37:52.353

@Zwei, It's certainly possible to shorten it. I made no effort to find the optimal set of macros. – ugoren – 2016-10-27T07:59:41.597

Why don't you include the parens in the CLANG #define? would save a few bytes, no? Edit: nevermind, just tried and now I see why that won't work ahaha – Albert Renshaw – 2017-01-24T18:15:19.917

2Awesome. Missing the !, though. – Mark Reed – 2013-11-21T15:07:39.490

1This is real art! – Askaga – 2014-02-07T19:42:00.983

52

BrainFuck, 102 111 characters

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

Meets all of the rules.

Credit goes to Daniel Cristofani.

Kevin Brown

Posted 2011-03-11T21:18:56.530

Reputation: 5 756

1I can't decide if the rules should also state 0 and/or "O" must be used. It's a little mean to BrainFuck and golfscript, but they don't exactly have a hard time with this challenge. – zzzzBov – 2011-03-11T21:32:49.653

35@zzzzBov: If they must be used, then Brainfuck code will just include them. They don't affect the program at all, though. – Joey – 2011-03-11T21:47:28.740

38

C, 182 bytes

#define decode(c,o,d,e,g,O,l,f) e##c##d##o
#define HelloWorld decode(a,n,i,m,a,t,e,d)
#define Puzzles(flog) #flog
#define CodeGolf Puzzles(Hello World!)
HelloWorld(){puts(CodeGolf);}

fR0DDY

Posted 2011-03-11T21:18:56.530

Reputation: 4 337

1+1,Lol,You still using the token pasting operator trick! Nice mate :-) – Quixotic – 2011-03-12T07:52:07.040

35

C program - 45

(cheating)

Lexically, this doesn't use any string literals or regex literals. It takes advantage of the stringification feature of the C preprocessor. s(x) is a macro that turns its argument into a string.

#define s(x)#x
main(){puts(s(Hello World!));}

Joey Adams

Posted 2011-03-11T21:18:56.530

Reputation: 9 929

3For a very convenient notion of "lexically" :) But cheekiness FTW! – J B – 2011-03-12T22:39:29.203

24

Haskell - 143 characters

o%y=o.o.o$y;o&y=(o%)%y;o!y=o$o$(o%)&y
r=succ;w=pred;a=r%y;e=r$w&l;l=r!'O';o=r e;u=(w&)&a;y=r%l
main=putStrLn[w!o,o,l,l,y,w u,w$r&'O',y,a,l,e,u]

oy, that was woolly!

No numbers, no numeric operations, variables renamed for amusement.

Some exposition might be nice:

  • o%y, o&y, and o!y each applies the function o to y multiple times: 3, 9, and 29 times respectively. 29?!?! Yes, 29!
  • r and w are next and previous character, which when applied using the above higher- order functions can be made to get all the characters needed from 'O'.

The sequence of jumps needed is:

'O' +29    -> 'l'
'O'  +9 -1 -> 'W'
'l'  -9 +1 -> 'd'
'l'  +3    -> 'o'
'd'  +1    -> 'e'
'o'  +3    -> 'r'
'e' -29    -> 'H'
'r' -81    -> '!'
'!'  -1    -> ' '

  • Edit: (134 -> 144) Forgot to output an exclamation point, sigh....
  • Edit: (144 -> 143) Removed a unnecessary $, renamed # to ! for Hugs.

MtnViewMark

Posted 2011-03-11T21:18:56.530

Reputation: 4 779

1o rly? o.o .... – Joey Adams – 2011-03-12T07:12:59.977

It doesn't work. http://codepad.org/lyKyj1Ox

– nyuszika7h – 2011-03-13T15:31:51.737

@Nyuszika7H That's because this service turns on some compiler options by default. It should compile with plain GHC. – FUZxxl – 2011-03-13T16:10:36.480

@Nyuszika7H It works just fine with GHC. The problem is that that service is using Hugs from 2006. There appear to be two things that Hugs can't deal with: 1) Using '#' as an operator. Changing to '!' makes it work. 2) The definitions of r=succ and w=pred run afoul of how Hugs implements the monomorphism restriction. Changing to r x=succ x and w x=pred x makes it work (at the cost of 4 characters). These seem to be problems in Hugs. – MtnViewMark – 2011-03-13T18:09:14.403

Uhh, r=succ?! – Matthew Roh – 2017-04-22T10:00:25.267

Is it still valid after the @Community edit? – None – 2014-02-21T23:58:07.440

+1, I can confirm this works.

– Shoe – 2014-04-21T22:34:58.090

22

Unary, 10197 1137672766964589547169964037018563746793726105983919528073581559828 bytes

I'm surprised that no one's done this yet...

It's too long to post here, but it's 1137672766964589547169964037018563746793726105983919528073581559828 zeroes.

Or, more easily read: ~1067 zeroes.

Thanks to @dzaima for saving 10197 bytes

Beta Decay

Posted 2011-03-11T21:18:56.530

Reputation: 21 478

2When I read "I once wrote an entire database using only zeroes", my first thought was "he must have done it in unary". +1 for being the only answer to work exactly how the comic did – Cyoce – 2016-10-17T23:45:42.573

21

Mathematica 12 chars

Only symbols, no strings.

Hello World!   

The ! is a factorial operator, but as the symbols Hello and World are undefined, returns the input unchanged.

If we modify the program a bit:

Hello=2;
World=3;
Hello World!  

Then it prints 12 (2 * 3!)

Dr. belisarius

Posted 2011-03-11T21:18:56.530

Reputation: 5 345

16

i386 assembly (Linux, gcc syntax), 440 442 435

Today's my assembly day, and after that I'll have had enough for a while. I allowed myself number 128, see below program for discussion of why. Nothing extraordinary: I'm just encoding "Hello World!" as assembly opcodes where that made sense without numeric constants, and filled in the rest with arithmetic.

#define M mov
M $0,%ecx;inc %cx;M %ecx,%ebx;inc %cx;M %ecx,%eax;add %ax,%ax
M %ecx,%edx;shl %cl,%dx;M (e),%ch;add %dl,%ch;dec %ch;M %ch,(l)
M %ch,(j);M %ch,(z);M $0,%ch;shl %cl,%edx;M %dl,(s);inc %dl
M %dl,(b);M (o),%dl;M %dl,(u);add %al,%dl;dec %dl;M %dl,(r)
M $m,%ecx;M $n,%edx;int $c;M %ebx,%eax;M $0,%ebx;int $c
.data
m:dec %eax;e:gs;l:es;j:es;o:outsl (%esi),(%dx)
s:es;push %edi;u:es;r:es;z:es;fs;b:es;n=.-m
t=(n+n)/n;c=t<<(t*t+t)

(assemble with gcc -nostartfiles hello.S -o hello, possibly -m32 depending on your arch)

Why the tolerance for 128? I need syscalls to actually show anything; Linux syscalls are on INT 80h (128 decimal); the only operand format for INT is immediate, so it's not possible to have anything else than a constant (to the code) there. I could (after I get sober) attempt to express it as a function of other symbolic constants in the code, likely n, but that's getting very boring for not much gain. I read the constraint on numbers as a way to prevent ASCII coding, and that's definitely not what I'm doing here, so I feel innocent enough to submit this. (FWIW, I also tried self-modifying code, but that segfaulted) There's now no 128 left either. The code's pure!

  • Edit1 reformatted to save lines; removed a numeric 1 (nobody noticed?!)
  • Edit2 compressed mov with CPP macros; eliminated the remaining 128.

J B

Posted 2011-03-11T21:18:56.530

Reputation: 9 638

6This is how real men program. – Nit – 2014-03-04T17:30:03.190

14

Javascript - 305

A bit long but I like the method used.

O=0;O++;O=O.toString();alert([O+0+0+O+0+0+0,0+O+O+0+0+O+0+O,O+O+0+O+O+0+0,O+O+0+O+O+0+0,O+O+0+O+O+O+O,O+0+0+0+0+0,O+0+O+0+O+O+O,O+O+0+O+O+O+O, O+O+O+0+0+O+0,O+O+0+O+O+0+0,O+O+0+0+O+0+0,O+0+0+0+0+O].map(function(e){O=0;O++;O++;return String.fromCharCode(parseInt(e,O))}).reduce(function (a,b){return a+b}))

david4dev

Posted 2011-03-11T21:18:56.530

Reputation: 665

I like it. It would be better with function parameters as OO, OOO, but of course that would make it longer. – zzzzBov – 2011-03-12T19:31:15.457

Really nice. Does the ',new String()' need to be there at the end? It seems to work without it. – Stephen Perelson – 2011-03-12T23:32:07.123

3Ah, no it doesn't. Sometimes I forget just how weakly typed Javascript is. – david4dev – 2011-03-12T23:38:06.807

You don't need left 0 bits ('0+') either, and the space and the exclamation have two left 0 bits. Total reduction of 28 characters. – Stephen Perelson – 2011-03-12T23:50:42.007

10

C# (131 chars)

141 chars 142 chars

enum X{Hello,World,A,B=A<<A<<A}class Y{static void Main(){var c=(char)X.B;System.Console.Write(X.Hello.ToString()+c+++X.World+c);}}

Readable:

// Define some constants (B = 32)
enum X { Hello, World, A, B = A << A << A }
class Y
{
    static void Main()
    {
        // Generate the space (character #32)
        var c = (char) X.B;

        // Remember that “!” is character #33
        System.Console.Write(X.Hello.ToString() + c++ + X.World + c);
    }
}

Timwi

Posted 2011-03-11T21:18:56.530

Reputation: 12 158

+1 nice way to generate certain numbers. Gotta remember that! – Igby Largeman – 2013-09-19T06:03:02.673

2this is twisted and nice. I love it. – jcolebrand – 2011-03-14T16:33:32.920

LINQPad program, 102 chars: enum X{Hello,World,A,B=A<<A<<A}void Main(){var c=(char)X.B;(X.Hello.ToString()+c+++X.World+c).Dump();} – Cœur – 2014-07-08T16:10:30.960

.ToString() -> +"" saves some cahrs – Firo – 2014-07-10T10:18:01.463

2@Firo: ... and breaks the rules. (No string literals allowed.) – Timwi – 2014-07-10T13:55:57.787

8

JavaScript, 88

t=!0<<-~-~-~-~!0
r=[]
for(i in{Hello:"O",World:0})r+=i+String.fromCharCode(t++)
alert(r)

99

Many thanks to @Timwi for the suggestions

removed ternary operator:

o={Hello:"O",World:0}
t=!0<<-~-~-~-~!0
c=String.fromCharCode
r=c(0)
for(i in o)r+=i+c(t++)
alert(r)

103
aliased String.fromCharCode

o={Hello:"O",World:0}
t=!0<<-~-~-~-~!0
c=String.fromCharCode
for(i in o)o[i]?r=i+c(t):alert(r+i+c(++t))

117
Switched if-else to ternary operator

o={Hello:"O",World:0},t=!0<<-~-~-~-~!0
for(i in o)o[i]?r=i+String.fromCharCode(t):alert(r+i+String.fromCharCode(++t))

125
I'm keeping the "O" just to have an "O" in the program.

o={Hello:"O",World:0},t=!0<<-~-~-~-~!0
for(i in o)if(o[i])r=i+String.fromCharCode(t)
else alert(r+i+String.fromCharCode(++t))

133

o={Hello:"O",World:0},t=!0<<(!0+!0<<!0)+!0
for(i in o)if(o[i])r=i+String.fromCharCode(t)
else r+=i+String.fromCharCode(t+!0)
alert(r)

zzzzBov

Posted 2011-03-11T21:18:56.530

Reputation: 2 915

@zzzzBov Save a Character (and make the character count less unsympathetic :) t=-~!0,t=t<<t*t – C5H8NNaO4 – 2013-08-16T12:50:32.667

@Joey, that's largely the point. – zzzzBov – 2011-03-11T23:35:45.383

@Joey, i read on the codegolf meta that one should avoid answering their own question for some time to encourage others to try various different approaches. My plan was to uncomment it in a day or two. – zzzzBov – 2011-03-11T23:43:42.257

@Joey, wasn't working on my own machine at the time, and I didn't feel like e-mailing myself the answer when I could just post it in a comment. – zzzzBov – 2011-03-11T23:57:31.247

@Joey: "There are only five of those" is wrong. Anyone can suggest an edit. Just click on "edit" between "link" and "flag" and you can see the code. – John – 2011-03-12T03:57:59.097

@zzz: "that's largely the point" Anyone can still see it. Anyone can suggest an edit by clicking on "edit" in between "link" and "flag", which will bring up the edit dialog, revealing your code. – John – 2011-03-12T03:59:27.003

@John: eep, didn't think of that. Sorry then – Joey – 2011-03-12T04:18:13.600

Now this answer alone is missing the "edit" link when it wasn't ~2 hours ago... what happened? – John – 2011-03-12T05:09:46.007

@John "Anyone can still see it" i understand that, that's why i had it up. If you were interested in looking, you could look, if you were interested in coming up with your own answer, you could come up with your own. I didn't want it visible initially so that people wouldn't just mimic the first thing they saw. – zzzzBov – 2011-03-12T05:47:29.267

@zzz: Gotcha. Good plan. – John – 2011-03-12T17:51:13.097

I just discovered the codegolf power of ~- and -~ on numeric literals. – zzzzBov – 2011-03-13T07:52:42.900

whoops! fixed it. – zzzzBov – 2011-03-13T23:46:48.807

7

Brainfuck, 111 bytes

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

Algorithm explained

Increment cell 0 to 10 (it will be loop counter)
Repeat 10 times ; will stop at cell 0
  Increment cell 1 to 7
  Increment cell 2 to 10
  Increment cell 3 to 3
  Increment cell 4 to 1
Increment cell 1 by 2 and output it ; Thus, output ASCII 72 'H'
etc. for all symbols in 'Hello World!'

Longer version without loop, 389 bytes:

+++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++.+++++++++++++++++
++++++++++++.+++++++..+++.-------------------
---------------------------------------------
---------------.+++++++++++++++++++++++++++++
++++++++++++++++++++++++++.++++++++++++++++++
++++++.+++.------.--------.------------------
---------------------------------------------
----.-----------------------.

Michael

Posted 2011-03-11T21:18:56.530

Reputation: 71

This is a code-golf puzzle, the point is to make the shortest possible program. Part of that involves posting the length of your code. – zzzzBov – 2012-03-18T19:44:35.893

7

GolfScript, 63 chars

[0))):O.)?O.*-.O.?+)).O.*+((..O+.O(.O+?.O-O*@.O+O.+$.O.*-).O/]+

What, no GolfScript entry yet?

This one uses a single numeric literal 0 and a variable named O (which is used to store the number 3). Everything else is arithmetic and stack manipulation. The string Hello World! is built up from its ASCII codes, character by character.

Here's how it works:

[             # insert start-of-array marker
  0))):O      # increment 0 thrice to get 3, and save it in the variable O
  .)?O.*-     # calculate 3^(3+1) - 3*3 = 81 - 9 = 72 = "H" 
  .O.?+))     # calculate 72 + 3^3 + 1 + 1 = 72 + 27 + 2 = 101 = "e"
  .O.*+((     # calculate 101 + 3*3 - 1 - 1 = 101 + 9 - 2 = 108 = "l"
  .           # ...and duplicate it for another "l"
  .O+         # calculate 108 + 3 = 111 = "o"
  .           # ...and duplicate it for later use
  O(.O+?      # calculate (3-1)^(3-1+3) = 2^5 = 32 = " "
  .O-O*       # calculate (32 - 3) * 3 = 29 * 3 = 87 = "W"
  @           # pull the second 111 = "o" to the top of the stack
  .O+         # calculate 111 + 3 = 114 = "r"
  O.+$        # copy the (3+3 = 6)th last element on the stack, 108 = "l", to top
  .O.*-)      # calculate 108 - (3*3) + 1 = 108 - 9 + 1 = 100 = "d"
  .O/         # calculate int(100 / 3) = 33 = "!"
]             # collect everything after the [ into an array
+             # stringify the array by appending it to the input string

Ilmari Karonen

Posted 2011-03-11T21:18:56.530

Reputation: 19 513

5

Python (126 130)

O=ord("O")
N=O/O
T=N+N
R=N+T
E=T**R
E<<T
print'O'[0].join(chr(c+O)for c in[N-E,E*R-T,_-R,_-R,_,N-_-E-E,E,_,_+R,_-R,E*R-R,T-_-E-E])

Hoa Long Tam

Posted 2011-03-11T21:18:56.530

Reputation: 1 902

The literal '' is not allowed. – RomanSt – 2011-03-12T21:12:27.830

1@romkyns: Very true, fixed. – Hoa Long Tam – 2011-03-13T00:40:41.050

5Not fixed (wrong output). You are probably thinking of [:0]. – Reinstate Monica – 2013-11-22T15:39:53.483

5

Lua 144 97 86 chars

A different approach, based on the fact that table keys are also strings, and the fact that #Hello == #World == 32 == string.byte'\n'

e=#"O"t=e+e for k,v in pairs{Hello=0,World=e}do T=t^#k io.write(k,string.char(T+v))end

145 char solution

  • no strings except "O" or 0
  • no Regexes
  • no pre-built functions

Did delta encoding of the bytes, then some primenumbers etc etc :)

Golfed version:

e=#"O"d=e+e t=d+e v=d+t z=v+t T=t^d*d^t n=0 for l,m in pairs{T,T/t-z,z,0,d,-T-z,z*z+t*d,T/d,d,-d*t,-t^d,-T+v}do n=n+m io.write(string.char(n))end

Commented:

-- without numbers, strings, regex
-- except "O" and 0
e=#"0"
t=e+e --2
d=t+e -- 3
v=d+t -- 5
z=v+t -- 7
n=0
T=t^d*d^t -- 72 = 2^3+3^2
for l,m in pairs{T, --72
T/t-z, -- 29 = 72/2-7
z, --7
0, -- 0
d, -- 3
-T-z, -- -79 = -72 - 7
z*z+t*d, -- 55 = 7*7 + 2*3
T/d, -- 24 = 72/3
d, -- 3
-d*t, -- -6
-t^d, -- -8
-T+v -- -67 = -72+5
} do
    n=n+q[k]
    io.write(string.char(n))
end

Edit: Changed multiple O strings, and found some more optimalisations.

jpjacobs

Posted 2011-03-11T21:18:56.530

Reputation: 3 440

Hello and World in table constructor are still string literals - that's just a syntatic sugar. – Oleg V. Volkov – 2015-12-21T10:00:20.417

"O"* - I think the * was for the footnote, not "any number of O's – RomanSt – 2011-03-12T21:13:16.317

Well, regex'ing is what I naturally do :p. Could replace it at the cost of 5 or 3 extra characters for respectively the first and second solution – jpjacobs – 2011-03-12T21:33:12.303

But anyway, I'll edit them out, thanks for the heads up – jpjacobs – 2011-03-12T21:45:09.827

5

J, 250

oo=:#a.
o0=:<.o.^0
o0o=:%:%:%:oo
ooo=:p:^:(-*oo)
o=:<.(^^^0)*(^^0)*(^^0)
o00=:o,~(,[)o0(**(**[))o0o
oo0=:*/p:(!0),>:p:!0
echo u:(o0(**(**]))o0o),(ooo ooo ooo(o.o.^^^0)*oo),o00,(+:%:oo),(oo0-~!p:>:>:0),o,(<.-:o.o.^o.^0),(>:p:(]^])#o00),(*:#0,#:oo),oo0

I had entirely too much fun with this one, and I learned a little bit more J to boot. Also, ooo ooo ooo may be the stupidest code I've ever written.

Jesse Millikan

Posted 2011-03-11T21:18:56.530

Reputation: 1 438

5

QR with halfblocks (169) 121 characters

With QR-Code by using UTF-8 Half-blocks characters:

▗▄▄▄▗▄▖▗▄▄▄  
▐▗▄▐▝█▙▐▗▄▐  
▐▐█▐▝▄ ▐▐█▐  
▐▄▄▟▗▗▗▐▄▄▟  
▗▗▖▄▞▝ ▗ ▖▄  
 ▟▜ Code ▀▟  
 ▙▀ Golf ▘▚  
▗▄▄▄▐▗▘▟▙▝▝  
▐▗▄▐▝▀▛▘▘█▖  
▐▐█▐▐▖▐▝▖▜▘  
▐▄▄▟▗ ▌█▛▗▝  3

Unfortunely, this won't render nicely there. There is a little snippet with appropriate style sheet, but.. No! The language presented here is not HTML! Language presented here is QR Code! (HTML and CSS is used here only to work around presentation bug!)

 body {
    font-family: monospace;
    line-height:97%;
 }
▗▄▄▄▗▄▖▗▄▄▄  <br>
▐▗▄▐▝█▙▐▗▄▐  <br>
▐▐█▐▝▄ ▐▐█▐  <br>
▐▄▄▟▗▗▗▐▄▄▟  <br>
▗▗▖▄▞▝ ▗ ▖▄  <br>
 ▟▜ Code ▀▟  <br>
 ▙▀ Golf ▘▚  <br>
▗▄▄▄▐▗▘▟▙▝▝  <br>
▐▗▄▐▝▀▛▘▘█▖  <br>
▐▐█▐▐▖▐▝▖▜▘  <br>
▐▄▄▟▗ ▌█▛▗▝  <br>
             <br>

QR with halfblocks (169)

  ▛▀▀▌▚▝▐▀▌▛▀▀▌
  ▌█▌▌▖▞▚▚▘▌█▌▌
  ▌▀▘▌ ▚▛▞ ▌▀▘▌
  ▀▀▀▘▚▌▙▘▌▀▀▀▘
  ▄▙▛▚▜▀▄▀█▖▝▄▌
  ▖▄▄▘▖▄▄▄▟▗ ▀▘
  ▜Code  golf!▌
  ▚▟▘▘▝▙▛▚▐▀▖▜▘
  ▘▘ ▀▛▗▚▗▛▀▌▄ 
  ▛▀▀▌▟▌▜▖▌▘█▐▘
  ▌█▌▌▘█▌▟█▜▙▐ 
  ▌▀▘▌▚▌▌█▗▝▌▚▘
  ▀▀▀▘ ▝▘▘▀▀▀▀▘

Idealy, this could look like:

QR:Hello World!

F. Hauri

Posted 2011-03-11T21:18:56.530

Reputation: 2 654

html is not the language, the language is QR! HTML and CSS was usefull to work around presentation bug. – F. Hauri – 2015-11-20T06:17:21.203

1

I used HTML (minus JS) as an example for what's not a language. Same goes for QR. See these criteria.

– ugoren – 2015-11-20T15:25:40.003

Use your smart phone to see this or zbar under linux. (sample: xwd | xwdtopnm | zbarimg /dev/stdin ) – F. Hauri – 2014-01-28T21:40:53.790

Isn't Code golf! a character literal? – ugoren – 2014-02-05T08:10:27.593

No, because it's only there for cosmetic! You could drop and replace them by anything (like ¢@d3||@01f for sample). The number of required characters won't change! – F. Hauri – 2014-02-05T08:51:38.783

2I actually think this answer, though creative, doesn't qualify because it isn't a program. QR is a way to encode data, not a programming language. – ugoren – 2014-02-05T09:20:43.440

1Also what about languages like postscript, svg or other presentation languages already used there!? A way to encode is a language anyway... I think! – F. Hauri – 2014-02-05T10:07:16.330

I don't really know postscript and svg. I think postscript has real programming power - loops and variables - not just encoding. But I wouldn't call a piece of HTML a program (unless it contains JavaScript). – ugoren – 2014-02-05T13:13:07.673

4

Java 389 characters

spotted a unnecessary declaration

class A{static int a=0,b=a++,f=a,e=a++;static char p(String s){return(char)Byte.parseByte(s,a);}public static void main(String[]z){long x=e,y=b;String c=((Long)x).toString(),d=((Long)y).toString();char l=p(c+c+d+c+c+d+d),m=p(c+c+d+d+c+d+c),o=(char)(l+a+f),_=p(c+d+d+d+d+d),$=_++;System.out.print(new char[]{p(c+d+d+c+d+d+d),m,l,l,o,$,p(c+d+c+d+c+c+c),o,(char)(o+a+f),l,(char)(m-f),_});}}

History is in edit history now the original ungolfed version readable:

// H  e  l    l   o      W  o  r   l    d  !
//72,101,108,108,111,32,87,111,114,108,100 33
import static java.lang.Integer.*;
class A
{


    public static void main(String[] args)
    {
        Integer a=0,b=a++,e=a++;  // making a 0 a 1 and a 2 which is required later;
        String c=e.toString(),d=b.toString(),z=c.substring(0,0);  //

        String H = ((char)parseInt(d+c+d+d+c+d+d+d,a))+z+  // make binary values and then to char
                (char)parseInt(d+c+c+d+d+c+d+c,a)+
                (char)parseInt(d+c+c+d+c+c+d+d,a)+
                (char)parseInt(d+c+c+d+c+c+d+d,a)+
                (char)parseInt(d+c+c+d+c+c+c+c,a)+
                (char)parseInt(d+d+c+d+d+d+d+d,a)+
                (char)parseInt(d+c+d+c+d+c+c+c,a)+
                (char)parseInt(d+c+c+d+c+c+c+c,a)+
                (char)parseInt(d+c+c+c+d+d+c+d,a)+
                (char)parseInt(d+c+c+d+c+c+d+d,a)+
                (char)parseInt(d+c+c+d+d+c+d+d,a)+
                (char)parseInt(d+d+c+d+d+d+d+c,a)
                ;
        System.out.println(H);  //obvious
    }

masterX244

Posted 2011-03-11T21:18:56.530

Reputation: 3 942

4

Scala (357 423 361 characters)

Not the shortest answer, unfortunately, but hoping to get bonus marks for the most use of 'O' and '0'

def h(){type t=scala.Char;def OO(c:t)={(c-('O'/'O')).toChar};def O(c:t)={OO(OO(OO(c)))};def O00(c:t)={(c+('O'/'O')).toChar};def O0(c:t)={O00(O00(O00(c)))};val l=O('O');val z=O0(O0(O0(O0(O0(O0(O0(O0(O0(O0(O0(0)))))))))));print(OO(O(O('O'))).toString+(OO(O(O(O('O')))).toString+l+l+'O'+OO(z)+O0(O0(O0(OO('O'))))+'O'+O0('O')+l+OO(OO(O(O(O('O')))))+z).toLowerCase)}

Previously:

def h(){type t=scala.Char;print(OO(O(O('O'))).toString+(OO(O(O(O('O')))).toString+O('O')+O('O')+'O'+OO(O0(O0(O0(O0(O0(O0(O0(O0(O0(O0(O0(0))))))))))))+O0(O0(O0(OO('O'))))+'O'+O0('O')+O('O')+OO(OO(O(O(O('O')))))+O0(O0(O0(O0(O0(O0(O0(O0(O0(O0(O0(0)))))))))))).toLowerCase);def OO[Char](c:t)={(c-('O'/'O')).toChar};def O[Char](c:t)={OO(OO(OO(c)))};def O00[Char](c:t)={(c+('O'/'O')).toChar};def O0[Char](c:t)={O00(O00(O00(c)))}}

Old (illegal) version:

def h(){type t=scala.Char;print(""+OO(O(O('O')))+(""+OO(O(O(O('O'))))+O('O')+O('O')+'O'+OO(O(O(O(O(O('0'))))))+O0(O0(O0(OO('O'))))+'O'+O0('O')+O('O')+OO(OO(O(O(O('O')))))+O(O(O(O(O('0')))))).toLowerCase);def O0[Char](c:t)={O00(O00(O00(c)))};def O[Char](c:t)={OO(OO(OO(c)))};def OO[Char](c:t)={(c-('O'/'O')).toChar};def O00[Char](c:t)={(c+('O'/'O')).toChar}}

Gareth

Posted 2011-03-11T21:18:56.530

Reputation: 11 678

I believe the empty string ("") and strings/character literals containing the character zero ('0') are not allowed. Only the string "O" (capital O) and the number 0 are. – Timwi – 2011-03-12T22:59:48.797

Bugger. Some editing required then... – Gareth – 2011-03-12T23:08:27.853

4

C (or C++) (body segment: 49) (cheating)

when compiling, compile to a binary called Hello\ World\!, the code is:

#include <stdio.h>
#include <string.h>
int main(int i,char**a)
{
  int j=i+i,k=j<<j;puts(strrchr(*a,'O'-(k<<j))+i);
}

The strrchr segment is required to remove the full path in the event the program name passed in contains the full path, also no arguments must be passed in..

Typical compile line could be: gcc -o Hello\ World\! foo.c

Nim

Posted 2011-03-11T21:18:56.530

Reputation: 269

3

Python, 106

o=-~-~-~0
L=o+o
d,W=-~L,o**o
_=o*W
print str().join(chr(L+W+_-i)for i in[d*L,L+d,L,L,o,-~_,W,o,0,L,d+d,_])

flornquake

Posted 2011-03-11T21:18:56.530

Reputation: 1 467

Use '' (with no preceding space) instead of str() – aditsu quit because SE is EVIL – 2013-03-19T11:29:19.977

2Also, VERY nice! :) Btw, the multiple assignment is not saving any characters – aditsu quit because SE is EVIL – 2013-03-19T11:39:27.183

@aditsu: I can't, that would be a string literal. Thanks for your comments. :) – flornquake – 2013-03-20T14:49:30.513

Oh oops, somehow the empty string didn't register as a literal in my mind – aditsu quit because SE is EVIL – 2013-03-20T15:23:59.413

3

C++, 141, 146

First time trying one of these, can probably be improved quite a bit yet:

char o='O'/'O',T=o+o,X=T+o,f=T+X,t=f+f,F=t*f,h=F+F,l=h+t-T,O=l+X;
char c[]={F+t+t+T,h+o,l,l,O,o<<f,h-t-X,O,l+f+o,l,h,0};
cout<<c;

EDIT:

Stole the divide trick from another post, can't believe I didn't think of that :(

LorenVS

Posted 2011-03-11T21:18:56.530

Reputation: 147

1You're technically supposed to include the entire working program in the character count, including things like main, any included libraries, std::, etc etc – Wug – 2012-11-09T22:01:42.703

3

Haskell - 146

a:b:c:f:g:s:j:z=iterate(\x->x+x)$succ 0
y=[f+j,d+a,c+s+h,l,a+b+l,s,f-s+o,o,a+b+o,l,l-f,a+s]
[h,e,l,_,o,_,w,_,r,_,d,x]=y
main=putStrLn$map toEnum y

I figured pattern matching would give Haskell a huge leg up, in particular because you can initialize powers of two like so:

one:two:four:eight:sixteen:thirty_two:sixty_four:the_rest = iterate (*2) 1

However, as seen in MtnViewMark's Haskell answer (which deserves many many upvotes, by the way) and other answers, better compression can be achieved by using more than just + and -.

Joey Adams

Posted 2011-03-11T21:18:56.530

Reputation: 9 929

3

C++

/*
Hello World!
*/
#define CodeGolf(r) #r
#include<iostream>
using namespace std;
int main()
{
    char str[*"O"];
    freopen(__FILE__,CodeGolf(r),stdin);
    gets(str);gets(str);puts(str);
}

fR0DDY

Posted 2011-03-11T21:18:56.530

Reputation: 4 337

1The 100 violates the rule about numbers. Please replace it with something more amusing. – Joey Adams – 2011-03-12T23:03:41.377

@joey-adams Thanks for pointing out. Changed that. – fR0DDY – 2011-03-13T05:15:20.350

Line 7: error: ISO C++ forbids declaration of 'main' with no type – Nathan Osman – 2011-03-15T02:31:55.597

@george-edison Corrected. Though it worked without int on g++ – fR0DDY – 2011-03-15T03:07:47.743

3

Clojure - 46 chars

(map print(butlast(rest(str'(Hello World!)))))

Note that Hello and World! are symbols, not literals of any kind.

mikera

Posted 2011-03-11T21:18:56.530

Reputation: 1 233

3

PHP – 49 chars

<?=Hello.chr(($a=-~-~-~0).~-$a).World.chr($a.$a);

Changelog:

  • (73 -> 86) Forgot to output an exclamation point... sigh
  • (86 -> 57) Uses a single variable with incrementing
  • (57 -> 51) Changed to use bitwise operators on 0
  • (51 -> 49) More bitwise operators

nyuszika7h

Posted 2011-03-11T21:18:56.530

Reputation: 1 624

1Pretty sure that the constants would count as string literals because of the conversions. – Kevin Brown – 2011-03-13T18:23:04.250

@Bass5098 Thanks for your edit! I approved it. – nyuszika7h – 2011-03-13T18:34:37.447

@Bass5098 that doesn't work, you need to have chars 32 and 33, not 21 and 22. <?$a=-~-~-~0;echo Hello.chr($a.$a-1).World.chr($a.$a); works, but it's 54 chars. – zzzzBov – 2011-03-16T18:07:11.453

@zzzzBov I could not figure out how to clear the edit initially, and forgot to roll it back once it was approved. – Kevin Brown – 2011-03-16T22:52:19.833

whoops, i left the 1 in there. There I go breaking my own rules...<?$a=-~-~-~0;echo Hello,chr($a.~-$a),World,chr($a.$a); is what I should have used, still 54 chars. – zzzzBov – 2011-03-16T23:34:15.653

Even better: <?=Hello.chr(($a=-~-~-~0).~-$a).World.chr($a.$a);, 49 chars. – zzzzBov – 2011-03-16T23:41:12.760

3

Perl, 186 bytes

@A=(0,0,0,0);@B=(@A,@A);@C=(@B,@B);@D=(@C,@C);@E=(@D,@D);@d=(@E,@D,@A);$l=[@d,@B];$o=[@$l,0,0,0];print(chr@$_)for[@E,@B],[@d,0],$l,$l,$o,\@D,[@E,@C,@A,0,0,0],$o,[@$o,0,0,0],$l,\@d,[@D,0]

Each chararcter is printed via its ordinal number, which is the length of an array. The construction of the arrays are optimized via the binary representation of the character numbers.

Ungolfed:

@A = (0, 0, 0, 0);          # A = 2^2
@B = (@A, @A);              # B = 2^3
@C = (@B, @B);              # C = 2^4
@D = (@C, @C);              # D = 2^5
@E = (@D, @D);              # E = 2^6

# d = 100 = 0x64 = 1100100b
@d = (@E, @D, @A);          # d = 2^6 + 2^5 + 2^2 

# l = 108 = 0x6C = 1101100b
$l = [@d, @B];              # l = d + 2^3

# o = 111 = 0x6F = 1101111b
$o = [@$l, 0, 0, 0];        # o = l + 3

print (chr @$_) for
    [@E, @B],              # "H"    H  =  72 = 0x48 = 1001000b = 2^6 + 2^3
    [@d, 0],               # "e"    e  = 101 = 0x65 = 1100101b = d + 1  
    $l, $l, $o,            # "llo"
    \@D,                   # " "   ' ' =  32 = 0x20 = 0100000b = 2^5
    [@E, @C, @A, 0, 0, 0], # "W"    W  =  87 = 0x57 = 1010111b = 2^6 + 2^4 + 2^2 + 3
    $o,                    # "o"
    [@$o, 0, 0, 0],        # "r"    r  = 114 = 0x72 = 1110010b = o + 3
    $l, \@d,               # "ld"
    [@D,0]                 # "!"    !  =  33 = 0x21 = 0100001b = 2^5 + 1

Heiko Oberdiek

Posted 2011-03-11T21:18:56.530

Reputation: 3 841

seems that my binary vodoo inspired you :) +1 – masterX244 – 2014-04-13T18:18:00.400

3

Perl 6, 199 bytes

my \O=+[0];my \t=O+O;my \T=t+O;my \f=(t+t,O);my \F=t+T;my \S=T+T;my \L=(S,F);
say [~] ((S,T),(|L,t,0),(my \l=(|L,T,t)),l,(my \o=(|l,O,0)),F,(S,|f,t,0),o,(|L,|f),l,(|L,t),(F,0),)
.map({chr [+] t X**@_})

(newlines are added to reduce width, but are unnecessary so are not counted)


Hello World! is encoded as a list of lists of the powers of 2 of each letter.

There is exactly one place where I have a literal 0 that is used for anything other than a 0. It is used to create a one-element list, which is immediately turned into the number 1 with the numeric prefix operator (+[0]).

my \O=+[0];    # one          # (List.elems)
my \t=O+O;     # two
my \T=t+O;     # Three
my \f=(t+t,O); # (four, one)  # <W r>
my \F=t+T;     # five
my \S=T+T;     # six

my \L=(S,F);   # lowercase letter  # (6,5)

say [~] (
  (S,T),            # H
  (|L,t,0),         # e
  (my \l=(|L,T,t)), # l
  l,                # l  reuse <l>
  (my \o=(|l,O,0)), # o  reuse <l>, add 0,1
  F,                # ␠
  (S,|f,t,0),       # W
  o,                # o  reuse <o>
  (|L,|f),          # r
  l,                # l  reuse <l>
  (|L,t),           # d
  (F,0),            # !
).map({chr [+] t X**@_})

Brad Gilbert b2gills

Posted 2011-03-11T21:18:56.530

Reputation: 12 713

3

JavaScript 662 chars

O=[[,],[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,],[],[,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]];for(O_O=[].length;O.length>O_O;O_O++)document.write(String.fromCharCode((O[O_O].length||-Math.pow([,,].length,[,,,,,].length)-[,,,,,,,].length)+Math.pow([,,].length,[,,,,,,].length)+Math.pow(++[,].length,[,,,].length)-[,].length));document.write(String.fromCharCode(Math.pow([,,].length,[,,,,,].length)+[,].length))

What about abusing array literals just to have unary base. This program has advantage of not using 0.

Konrad Borowski

Posted 2011-03-11T21:18:56.530

Reputation: 11 185

While this may be valid, this particular puzzle is a code golf, which means you should be aiming for the shortest code possible. At 600+ chars, you're nowhere near the <100 chars that the existing JS solutions already have. – zzzzBov – 2012-11-20T15:01:14.620

1@zzzzBov: I'm actually not trying to win. – Konrad Borowski – 2012-11-20T15:02:08.317

1This program has advantage of not using 0. What about O_O=0;? – Erik the Outgolfer – 2016-09-15T15:12:01.413

@EriktheGolfer: Fixed, thanks. I failed to notice that one. – Konrad Borowski – 2016-09-17T11:15:02.727

O_O=[].length can be written as O_O=false which decreases it by 4. – Atmocreations – 2016-10-26T14:54:48.530

2

Java - 147, no literals

class HelloCWorlds{static{char[]a=HelloCWorlds.class.getName().toCharArray();int
x=a.length,y=a[--x]%x;a[y]/=x/y;a[x]=a[y]--;System.out.print(a);}}

Run it like this (after compiling):

java HelloCWorlds 2>/dev/null

If you don't want to ignore stderr, then add System.exit(0); after the last semicolon. It brings the file size to 162 and makes use of the 0 literal.

aditsu quit because SE is EVIL

Posted 2011-03-11T21:18:56.530

Reputation: 22 326

Nice trick! Just one thing to mention: not works with OpenJDK. http://pastebin.com/gxE7PrjX

– manatwork – 2013-03-19T08:42:22.477

@manatwork Hmm I think it's not about OpenJDK, but about java 6 vs 7 – aditsu quit because SE is EVIL – 2013-03-19T08:55:42.077

Possible. BTW, I dug out an old “java version "1.4.2_02" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)” to test this – also works fine. – manatwork – 2013-03-19T09:04:50.710

2

SmileBASIC, 98 bytes (non-competing)

I admit, this answer is cheating. Labels transparently behave as strings when in an expression, but technically they aren't string or character literals, right? If anyone wants to weigh in feel free but I'm convinced a SmileBASIC answer would just amount to abusing PI() or EXP() to compute every character code.

S=VAL(RIGHT$(@32,2))?RIGHT$(@Hello,5)+CHR$(S+LEN(@O0O0O0O0O0O))+CHR$(S)+RIGHT$(@world,5)+CHR$(S+1)

You could easily golf this more, I'm sure.

snail_

Posted 2011-03-11T21:18:56.530

Reputation: 1 982

2

Commodore 64 O.0! interpreter

O0 Hello World interpreter

The best I could come up with was to write an interpreter that would accept O and 0 - O starts the counter from 65 (A) and 0 adds 1 to the counter, so you have to enter the following to produce HELLOWORLD**

O0000000O0000O00000000000O00000000000O00000000000000O0000000000000000000000O00000000000000O00000000000000000O00000000000O000

Which I work out at 124 characters. To use, run the program and start typing with O, enter 0 to increase the character count and begin a new character with O again.

** The current version of the interpreter does not support the space or new line character, and you have to break [RUN/STOP] to stop it

Shaun Bebbers

Posted 2011-03-11T21:18:56.530

Reputation: 1 814

2

Python3, 16 bytes

import __hello__

Note the rule:

pre-built functions that return "Hello World!"

Does not apply since:

  1. That's an import and not a function
  2. It doesn't return anything
  3. It doesn't return the string but simply prints it.

Bakuriu

Posted 2011-03-11T21:18:56.530

Reputation: 781

2

Python 3 – 99 chars

from re import*
c=X+U+L;_=c+M
print(bytes([X+M,-~c,_,_,_-~I,U,X+U+~M,_-~I,c+S-I,_,c,-~U]).decode())

Taking advantage of the fact that the re module uses integers as flags, e.g. re.X is 64.

flornquake

Posted 2011-03-11T21:18:56.530

Reputation: 1 467

2

Unlambda, 37 bytes

Note that Unlambda doesn't have string or integer literals; .a is a function with a two-character name that writes a to standard output; it's not a function . that takes a as argument.

`.!`.d`.l`.r`.o`.W`. `.o`.l`.l`.e`.Hi

Try it online

celtschk

Posted 2011-03-11T21:18:56.530

Reputation: 4 650

2

PHP, 220 202 201 characters

<?$b=++$a+$a;$y=$b+$a;$c=$y+$b;$z=$c*$b;$s=$y*$z+$b;$h=$s*$b+$z-$b;$e=$z*$z+$a;$o=$e+$z;$l=chr($o-$y);echo chr($h).chr($e).$l.$l.chr($o).chr($s).chr($h+$z+$c).chr($o).chr($o+$y).$l.chr(--$e).chr(++$s);

Uses no numbers, string literals, RegEx literals, or pre-built functions that display "Hello World!".

It works: http://codepad.viper-7.com/OhXBkA

Kevin Brown

Posted 2011-03-11T21:18:56.530

Reputation: 5 756

2

Heres my Perl entry.

It uses the length of an array to store the ordinal of the character.

use strict;
use warnings;
use 5.010;
my @hello_world = (
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
);
say map{ chr @$_ } @hello_world;

That seemed like a lot of writing to me, so I used this to generate the above code:

perl -E'
  say for map{"use $_;"} qw"strict warnings 5.010";
  say "my \@hello_world = (";
  say "  [",join(",",@$_),"]," for map{[(0) x ord]} split //, "Hello World";
  say ");";
  say q"say map{ chr @$_ } @hello_world;"
'

Brad Gilbert b2gills

Posted 2011-03-11T21:18:56.530

Reputation: 12 713

2

APL (Dyalog Unicode), 35 bytesSBCS

{⍞←⍺,⍵,⍨⊃⍕⍬⋄⍞←!}/⎕NL≡Hello World←⍬0

Try it online!

⍬0 the list [[];0]

Hello World← store those two values in these two variables

the depth of that array; ¯2 (max-depth is 2, negative means ragged)

⎕NL Name List of defined variables (class 2 — negative means return as list of strings)

{}/ apply the following anonymous lambda infix between the two names:

 empty list; []

 stringify; ""

 coerce the first character; " "

⍵,⍨ append the right argument; " World"

⍺, prepend the left argument; "Hello World"

⍞← print that to stdout with no trailing line break

 then:

⍞←! print the factorial function to stdout

Adám

Posted 2011-03-11T21:18:56.530

Reputation: 37 779

2

JavaScript, 661 characters (without "O" or 0)

That's not the shortest, but that was funny to make. I tried to make it without 0 or "O".

I'm not really happy with H and W because it's the only ones which uses non-symbols characters, but that works. If anyone has an idea to do it ...

This is javascript code, tested in firefox 27 scratchpad, and running with Ctrl+I (should I add an alert or console.log ?).

(document+[])[(++[[]+[]][+[]])<<(++[[]+[]][+[]])<<(++[[]+[]][+[]])<<(++[[]+[]][+[]])] // H
+((!!{})+[])[((++[[]+[]][+[]])<<(++[[]+[]][+[]]))+(++[[]+[]][+[]])]                   // e
+([]+(![]))[(++[[]+[]][+[]])<<(++[[]+[]][+[]])]                                       // l
+([]+(![]))[(++[[]+[]][+[]])<<(++[[]+[]][+[]])]                                       // l
+([]+{})[++[[]+[]][+[]]]                                                              // o
+([]+{})[((++[[]+[]][+[]]<<(~!+[]))+[])[(++[[]+[]][+[]])<<(++[[]+[]][+[]])]]          //  
+(self+[])[(++[[]+[]][+[]])<<(++[[]+[]][+[]])<<(++[[]+[]][+[]])<<(++[[]+[]][+[]])]    // W
+([]+{})[++[[]+[]][+[]]]                                                              // o
+([]+(!!{}))[++[[]+[]][+[]]]                                                          // r
+([]+(![]))[(++[[]+[]][+[]])<<(++[[]+[]][+[]])]                                       // l
+([][+[]]+[])[(++[[]+[]][+[]])<<(++[[]+[]][+[]])<<(++[[]+[]][+[]])<<(++[[]+[]][+[]])] // d
+((/!/)+[])[++[[]+[]][+[]]]                                                           // !

(the count of 661 of course doesn't include the comments)

sebcap26

Posted 2011-03-11T21:18:56.530

Reputation: 1 301

I have one in the Obfuscated Hello world task that makes use of assignment. The idea is to use the Function constructor (which is reachable as ""["constructor"]["constructor"]) to allow arbitrary code. You could do something similar perhaps.

– FireFly – 2014-02-05T13:49:00.387

2

bash, 66 characters

66 characters, no new lines

Hello(){ H=$FUNCNAME;};World! (){ echo $H $FUNCNAME;};Hello;World!

Previous version (81 characters), left here because I like the $IFS trick :-)

81 characters, no new lines

Hello(){ H=$FUNCNAME;};World! (){ echo $H${IFS:0:$[0**0]}$FUNCNAME;};Hello;World!

81 as well but with (including) new lines and easier to read

Hello(){ H=$FUNCNAME;}
World! (){ echo $H${IFS:0:$[0**0]}$FUNCNAME;}
Hello;World!

Commented version

Hello(){ H=$FUNCNAME;}                        # set $H to function name ("Hello")
World! (){ echo $H${IFS:0:$[0**0]}$FUNCNAME;} # print $H, first char of $IFS (" ") & "World!"
Hello;World!                                  # run the stuff

(strictly speaking the calculation 0**0 should be indeterminate but it evaluates to 1 :-D)

Johannes Weiss

Posted 2011-03-11T21:18:56.530

Reputation: 131

2

C - 125 128 chars

I didn't see a proper C entry so I wrote this one:

main(){char u='O'/'O',t=u+u+u,h=u<<t,s=h<<u+u,d='O'*'O'+t,l=d+h,o='O'|s,
g['O']={'O'-h+u,d+u,l,l,o,s,o+h,o,o+t,l,d,s+u};puts(g);}

(As noted below, redefining u via main(u) can save another 9 bytes.)

breadbox

Posted 2011-03-11T21:18:56.530

Reputation: 6 893

3Your array isn't NULL-terminated, so it prints junk. Pay 2 chars. Earn them back, and more, by main(u) instead of 'O'/'O'. – ugoren – 2012-05-08T06:58:23.220

2

Clojure

The stupid simple (22):

(print 'Hello 'World!)

These are technically symbols, not strings.

In the spirit of the puzzle (204):

(apply str(map(comp char(fn f[x](if x(+(#(+ % %)(f(next x)))({\O (inc 0) \0 0} (first x)))0)) reverse str)'[O00O000 OO00O0O OO0OO00 OO0OO00 OO0OOOO O00000 O0O0OOO OO0OOOO OOO00O0 OO0OO00 OO00O00 O0000O]))

galdre

Posted 2011-03-11T21:18:56.530

Reputation: 131

1No string or character literals were used. – galdre – 2015-11-20T05:22:10.507

@Mego, the question rules allow many trivial answers like this to be valid. – None – 2015-11-21T06:12:49.437

2

Python, 139 bytes

class World():
 pass
class Hello(World):
 def __init__(self):
  print(self.__class__.__name__, self.__class__.__base__.__name__)
O=Hello()

ig0r

Posted 2011-03-11T21:18:56.530

Reputation: 29

2

C, 190 189 204

a,b,c,h,e,l,o;i[4],*j=i;main(_){o=*"O";a=_+_+_;b=_<<a;c=b*a+b;h=(o>>_)^o;o^=c;e=h-a;l=o-h+e;*j++=h-c|e<<b|l<<b+b|l<<c-b;*j++=o|c<<b|o+b-c<<b+b|o<<c-b;*j=o+a|l<<b|e-_<<b+b|c+_<<c-b;puts(i);}
  • Must be run with exactly zero command line arguments since it depends on argc being equal to 1.
  • no preprocessor macros
  • Might be system endian dependant (involves cast from integer array to char array)
  • Not memory safe
a,b,c,h,e,l,o;   // variables
i[],m,*j=i;      // array and pointer

main(_)          // if no arguments are given _ will be 1
{
    o=*"O";      // our one legal string constant
    a=_+_+_;     // a = 3
    b=_<<a;      // b = 8
    c=b*a+b;     // c = 32
    h=(o>>_)^o;  // h = 'h'
    o^=c;        // o = 'o'
    e=h-a;       // e = 'e'
    l=o-h+e;     // l = 'l'
    *j++=h-c|e<<b|l<<b+b|l<<c-b;     // j[0] = 'H' | 'e' << 8 | 'l' << 16 | 'l' << 24
    *j++=o|c<<b|o+b-c<<b+b|o<<c-b;   // j[1] = 'o' | ' ' << 8 | 'W' << 16 | 'o' << 24
    *j=o+a|l<<b|e-_<<b+b|c+_<<c-b;   // j[2] = 'r' | 'l' << 8 | 'd' << 16 | '!' << 24

    puts(i);     // puts("Hello World!\0\0\0\0")
}

Revisions:

a,b,c,h,e,l,o;i[9],*j=i;main(_){o=*"O";a=_<<_|_;b=_<<a;c=_<<b-a;h=(o>>_)^o;o^=c;e=h-a;l=o-h+e;*j++=h^c|e<<b|l<<b<<b|l<<(c-b);*j++=o|c<<b|(o+b^c)<<b<<b|o<<(c-b);*j=o+a|l<<b|e-_<<b<<b|c+_<<(c-b);printf(i);} /* original */
a,b,c,h,e,l,o;i[4],*j=i;main(_){o=*"O";a=_+_+_;b=_<<a;c=b*a+b;h=(o>>_)^o;o^=c;e=h-a;l=o-h+e;*j++=h-c|e<<b|l<<b+b|l<<c-b;*j++=o|c<<b|o+b-c<<b+b|o<<c-b;*j=o+a|l<<b|e-_<<b+b|c+_<<c-b;puts(i);} /* golfed better */
a,b,c,h,e,l,o;i[],m,*j=i;main(_){o=*"O";a=_+_+_;b=_<<a;c=b*a+b;h=(o>>_)^o;o^=c;e=h-a;l=o-h+e;*j++=h-c|e<<b|l<<b+b|l<<c-b;*j++=o|c<<b|o+b-c<<b+b|o<<c-b;*j=o+a|l<<b|e-_<<b+b|c+_<<c-b;puts(i);} /* removed illegal numeric literal in array size */

Wug

Posted 2011-03-11T21:18:56.530

Reputation: 1 607

i[9] violates the rules. – ugoren – 2012-11-09T18:15:00.737

shoot, it does doesn't it. – Wug – 2012-11-09T18:26:53.567

i['O'] should be fine. Or i[-~-~-~-~0]. – ugoren – 2012-11-09T21:05:10.593

The way that's there works (with the caveat that it starts scribbling over other global variables, but they're not read from again later so I don't care). I could probably reorder them to specifically take advantage of this behavior and make them only overwrite variables that are from-then-on unused. Anyway, at this point it contains no numeric literals and I rather like it that way. – Wug – 2012-11-09T21:57:35.943

2

JavaScript 100 chars (when all in one line)

Borrowing subtly from zzzzBov -- with regard to the -~ trick, not seen that before :) -- this is another way to source those pesky space and exclamation characters.

Relies on the Function.toString() ability:

c=!0<<-~-~!0;a=[];
for(i in{Hello:0,world:"O"}){a+=i+([]+function(){!0}).charAt(c);c+=c>>!0}
alert(a)

JavaScript 89 chars (when all in one line)

Also zzzzBov could slightly improve the first example by using the fact that arrays in JS collapse down to strings when used in a calculation; oh, and not creating needless vars ;)

t=!0<<-~-~-~-~!0;r=[];for(i in{Hello:"O",World:0})r+=i+String.fromCharCode(t++);alert(r)

Pebbl

Posted 2011-03-11T21:18:56.530

Reputation: 151

1

J, 134 124 bytes

Thanks to miles for a bugfix!

echo u:#.((+:+:>.^#a:),<.^+:*_)$'0O'i.'O00O000OO00O0OOO0OO00OO0OO00OO0OOOO0O00000O0O0OOOOO0OOOOOOO00O0OO0OO00OO00O000O0000O'

Try it online! This was much easier to write than the below.

Alternatively, no strings, 134 bytes:

echo u:(-:*:>.>:C),(>:*:<.C),A,A,B,(+:+:>.C),(+:*:<.^.A),(<.*:+:^.A),(B=:>:>:>:A),(+:>:>:>:-:A),A,(*:<.C=:%:A),>.*:>:^.A=:+:<.^+:+:#a:

Try it online! This. Was. A. Triumph Pain to write. I should really write a program to help me automate this...

Conor O'Brien

Posted 2011-03-11T21:18:56.530

Reputation: 36 228

I think _ counts as a number. Another way to get 1 is #a: – miles – 2017-01-21T02:40:53.497

@miles True. I'll make the change accordingly. – Conor O'Brien – 2017-01-21T02:58:02.063

Shorter 1: ^0 – Adám – 2019-10-28T23:15:45.300

Shouldnt *_ be ^0 too, since _ is a non-zero number? – Adám – 2019-10-28T23:18:15.050

1

Common Lisp, 35

I think nobody tried Common Lisp. Strictly speaking, a symbol is not a string literal, so this is valid:

(print(symbol-name'|Hello World!|))

Second-short if you count the Mathematica one.

Diego Sevilla

Posted 2011-03-11T21:18:56.530

Reputation: 111

1

PHP, 136 bytes

a different approach, inspired by Adám´s APL answer:

for(;$c=[O00O000,OO00O0O,$l=OO0OO00,$l,$o=OO0OOOO,O00000,O0O0OOO,$o,OOO00O0,$l,OO00O00,O0000O][+$i++];)echo chr(bindec(strtr($c,O,!0)));

loops through array of 0O encoded ASCII values to print corresponding characters. Run with -nr.

breakdown

for(;$c=[O00O000,OO00O0O,$l=OO0OO00,$l,$o=OO0OOOO,  // binary ascii codes,
    O00000,O0O0OOO,$o,OOO00O0,$l,OO00O00,O0000O]    // 1 replaced with O
    [+$i++];)           // loop through array
    echo                    // 4. print
        chr(                // 3. convert to character
        bindec(             // 2. convert to decimal
        strtr($c,O,!0)      // 1. replace capital O with 1  
    ));

Titus

Posted 2011-03-11T21:18:56.530

Reputation: 13 814

1

JavaScript (ES5), 79 bytes

b=-~!0;for(c in{Hello:a="",World:b<<=b*b})a+=c+String.fromCharCode(b++);alert(a)

Explanation

Like the other JavaScript answers, this is just a code snippet that alerts the string'Hello World!'.

The first trick is creating an object with the key names Hello and World. These are not string literals, so it obeys the rules. It is not allowed to put the exclamation mark or the space in there, so we get those characters through the second trick.

The second trick is getting the characters through their ASCII value. Sadly, we have to use String.fromCharCode for that, which is really long. Luckily, the space (32) and exclamation mark (33) are right next to each other in the ASCII table, and the character code for the space is a nice power of 2, which is easily obtainable though bitshifting. Getting 32 using only zeroes is a little bit tricky: 32 equals 1 << 5, which is not very golfable, but it also equals 2 << 4 = 2 << 2 * 2. All these two's allow us to assign 2 to a variable, and use that (note that -~!0 equals 2).

The third trick is that we don't need the values in the object we loop over, and you can assign values to variables in the object declaration. This doesn't just save 2 semicolons, but also 2 dummy values, so 4 bytes in total.

JavaScript (ES6) (non-competing), 82 bytes

_=>eval('b=-~!0;for(c in{Hello:a="",World:b<<=b*b})a+=c+String.fromCharCode(b++)')

Explanation

This is a full function with the same body as the competing version, but we use a fat-arrow function with "the eval trick". eval returns the value of the last variable it assigned to, which is a in this case.

This is non-competing since ECMAScript 6 was released in 2015, more than 4 years after this challenge was made.

Luke

Posted 2011-03-11T21:18:56.530

Reputation: 4 675

1

Perl, 96 chars

sub AUTOLOAD{my$x++;$y=$x<<$x++;print substr($AUTOLOAD,$x+$y).chr(($x<<$y)+$a++)}
&Hello;&World

It passes the rules!

user7486

Posted 2011-03-11T21:18:56.530

Reputation:

1

Python, 110

def HelloOWorld():B
def B(a):print HelloOWorld.__name__.replace('O',chr(a+~0))+chr(a)
B(ord(B.__name__)>>-~0)

mxmul

Posted 2011-03-11T21:18:56.530

Reputation: 61

1

Lua, 36

print(next{Hello=0},(next{world=0}))

mniip

Posted 2011-03-11T21:18:56.530

Reputation: 9 396

1

Tcl

In Tcl, everything is a string.

puts Hello\ World!

If you disallow this, then this is the only valid Tcl program that can be written:

Johannes Kuhn

Posted 2011-03-11T21:18:56.530

Reputation: 7 122

1

C, 177 bytes

enum{a,b,c=b+b,d=c*c,e=c*d,f=c*e,g=c*f,h=c*g,i=c*h};x[]={h+e,i-g+d+b,i-g+e+d,i-g+e+d,i-g+f-b,g,h+f+e-b,i-g+f-b,i-f+c,i-g+e+d,i-g+d,g+b,},j=a;main(){for(;j<f-d;putchar(x[j++]));}

Try it online

Johan du Toit

Posted 2011-03-11T21:18:56.530

Reputation: 1 524

1

Lenguage, 12731474882444739483739382239546264946233453512894971245352595483589354073858968246926319892 bytes

It is 12731474882444739483739382239546264946233453512894971245352595483589354073858968246926319892 zeros. Or Os. Both of them if you want. Any character in fact. Thanks Lenguage.

Convert It Online! <-- Conversion from brainfuck Hello World!

Try It Online! <-- brainfuck Hello World! in action

V. Courtois

Posted 2011-03-11T21:18:56.530

Reputation: 868

1

PowerShell: 596 382

Started with Joey's idea (Excel counts 1155 characters!) and cut it by about half with some math, then down to a third with some more math and optimization of my own script.

Original: 596 characters:

My first version was fairly similar to the current one in general theory, but a bit simpler in implementation. I just took each character's ASCII code and broke it into two factors, then converted those into strings of zeroes that were as long as the factors, and made PowerShell put them back together. Some numbers were problematic since the smallest factor pairs I could come up with were pretty high - especially 'e', since 101 is prime.

$O=('000000000','00000000'),('00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000','0'),('0000','000000000000000000000000000'),('0000','000000000000000000000000000'),('000','0000000000000000000000000000000000000'),('00000000','0000'),('000','00000000000000000000000000000'),('000','0000000000000000000000000000000000000'),('000000','0000000000000000000'),('0000','000000000000000000000000000'),('0000000000','0000000000'),('000','00000000000');for($0=0;$0-lt$O.Length;$0++){$O[$0]=($O[$0][0].length,$O[$0][1].length)-join'*'|iex}[char[]]$O-join''

Current: 382 characters

The current version includes a few optimizations, and a change to more comfortably suit the spirit of the challenge.

  • All factor pairs now end up 23 short of their actual target. This makes every element equate to a composite number, greatly reducing the characters required to build all of them. This alone saved about 156 characters.
  • Used a ForEach-Object loop, via the % alias, instead of for.
  • Replaced the 1 (though it was defining array indexes, and so not strictly a number or string literal) with '0'.length. This may cost me some characters, but it's relatively small in comparison to the overall length of the script and helps to fit in with the theme a bit better.
  • Optimized the multiplication routine by using a % loop instead of individually calling out array elements.
  • Restructured the script so that no defined variables are needed.
-join[char[]](('0000000','0000000'),('000000','0000000000000'),('00000','00000000000000000'),('00000','00000000000000000'),('00000000','00000000000'),('000','000'),('00000000','00000000'),('00000000','00000000000'),('0000000','0000000000000'),('00000','00000000000000000'),('0000000','00000000000'),('00','00000')|%{(($_|%{$_.length})-join'*'|iex)+'00000000000000000000000'.length})

Step-by-step:

-join[char[]](...) will take an array of integers (generated by the script within), convert them to ASCII characters, and put it all together in one string output.

('0000000','0000000'),('000000','0000000000000'),... are pairs of strings of zeroes. Within a pair, the product of each string's length comes 23 short of an ASCII code needed to represent a character in 'Hello World!'.

|%{...} pipes the factor pairs into a ForEach-Object loop.

(($_|%{$_.length})-join'*'|iex) takes the length of each factor in a pair and multiplies them together.

+'00000000000000000000000'.length effectively adds 23 to the product, resulting in our target ASCII code.

Hello World!

Iszi

Posted 2011-03-11T21:18:56.530

Reputation: 2 369

1

Javascript, 186

alert("O00O000OO00O0OOO0OO00OO0OO00OO0OOOO0O00000O0O0OOOOO0OOOOOOO00O0OO0OO00OO00O00".replace(/\D/g,-~0).replace(/......./g,function(O){return String.fromCharCode(parseInt(0+O,-~!0));}))

wolfhammer

Posted 2011-03-11T21:18:56.530

Reputation: 1 219

1

Fish - 270

>"O":l(?!v~~~~~~~lo 00000v |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !<lo0000000000000000000v  |0000000 !<lo000lo~~~~~~lo~~~~~~~~lo~~~~~~~~~v;
^        <|000000000000 !<lo0000000l:oo000lo~~~~~~~~~~~~~~~~~^|000000000000000000 !<lo0000000000^  |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !<lo;

Using |0000000000 !< to double the number of 0's put onto the stack. It will bounce off the mirror, and then jump past the <.

Cruncher

Posted 2011-03-11T21:18:56.530

Reputation: 2 135

1

Python (169) -- FIXED

Quite a bit longer than the other solutions. But more insane.

from turtle import setworldcoordinates as w
o=0**0
t=o+o+o
b=cmp.__ne__.__doc__
print(hex.__name__[0]+str(Ellipsis)[:t]+"O"+b[-t*t-o]+w.func_name[t:t*t-o]+b[-t]).title()

Jagu

Posted 2011-03-11T21:18:56.530

Reputation: 139

Sorry, typo on my behalf. I've corrected that error now. – Jagu – 2011-03-19T00:35:14.317

Nice. I would retract my downvote, but this stupid website doesn’t let me, so don’t blame me... – Timwi – 2011-03-19T17:00:17.870

@Timwi: I think if a question/answer is edited, you can undo your vote, can't you? – nyuszika7h – 2011-04-27T05:18:19.380

1

Tcl, 62 bytes

proc Hello\ world! {} {puts {*}[info level 0]}
[Hello\ world!]

Try it online!

proc Hello\ World! is a function with name "Hello world"; [info level 0] gives the funtion name where I am presently now; [Hello\ world!] is a call to the "Hello world" function!

sergiol

Posted 2011-03-11T21:18:56.530

Reputation: 3 055

@Johannes Kuhn: I think my solution is farther from a literal than yours! – sergiol – 2018-04-30T00:20:26.083

1

Forth (gforth), 38 bytes

: f name type ; f Hello space f World!

Try it online!

OR

name World! name Hello type space type

Try it online!

Explanation

Uses the Forth built-in for processing code to convert the next character entered to a string, and then prints it

Code Explanation

: f             \ start a new word definition
  name          \ grabs the next word (space-delimited) from the input/code
  type          \ output the string on top of the stack
;               \ end word definition
f Hello         \ converts and outputs Hello, as name will grab Hello from the input before continuing
space           \ outputs a single space
f World!        \ converts World! to a string and outputs it

reffu

Posted 2011-03-11T21:18:56.530

Reputation: 1 361

1

Keg, 14 bytes

Hello World*

TIO

  • Keg does not have character literals, only instructions that push constants onto the stack, except for \, which pushes the character onto the stack.
  • This program does not use integers.
  • There are no built-functions that return the string in Keg.
  • Keg does not support regex.

user85052

Posted 2011-03-11T21:18:56.530

Reputation:

1

C# (169)

class HelloOWorld0
{
    public static void Main()
    {
        Console.WriteLine(typeof(HelloOWorld0).Name.Replace('O', (char) ConsoleKey.Spacebar).Replace('0', (char) ConsoleKey.PageUp));
    }
}

Minified:

class HelloOWorld0{public static void Main(){Console.WriteLine(typeof(HelloOWorld0).Name.Replace('O',(char)ConsoleKey.Spacebar).Replace('0',(char) ConsoleKey.PageUp));}}

microbian

Posted 2011-03-11T21:18:56.530

Reputation: 2 297

1

Ruby, 115 characters

No numbers or string literals whatsoever.

[(s=-(x=(z=[z].size)+y=z+z)+q=x*x+z)*q+y,z+f=q*q,l=f+q-y,l,o=l+x,_=q*x+y,(s+z)*q+s,o,o+x,l,f,_+z].map{|x|$><<x.chr}

Ruby, 110 characters (but less awesome)

This one has a zero. :(

[(s=-(x=(z=-~0)+y=z+z)+q=x*x+z)*q+y,z+f=q*q,l=f+q-y,l,o=l+x,_=q*x+y,(s+z)*q+s,o,o+x,l,f,_+z].map{|x|$><<x.chr}

user4740

Posted 2011-03-11T21:18:56.530

Reputation:

z=[z].size is brilliant. – Jordan – 2016-08-16T15:54:28.867

1

Python (99 bytes)

o=-~0
def World():0
def Hello():print Hello.__name__,World.__name__+chr(o+(o<<(o+o+o+o+o)))
Hello()

(similar to my bash version ).

EDIT: Cut another byte by optimising 0**0 to -~0 (== 1), thanks to @kasran for the tip!

Johannes Weiss

Posted 2011-03-11T21:18:56.530

Reputation: 131

1-~0 is a shorter way to get 1 than 0**0. – Kasran – 2014-11-23T01:36:49.037

1

Sclipting, 9

걐낆녬닆묠녶뭲닆뀡

Sclipting pushes this into the stack as an array of numbers and returns as a string.

tohanov

Posted 2011-03-11T21:18:56.530

Reputation: 156

1I would guess this violates the "no number literals" rule? – Paŭlo Ebermann – 2015-11-02T19:37:50.953

1

R, 78

paste(deparse(quote(Hello)),paste0(deparse(quote(World)),deparse(quote(`!`))))

Wanton abuse of deparse (which extracts the literal name of an object, i.e. "de-parsing" it, even if that object doesn't exist) and R's name class, which is not a string literal; is.character(quote(Hello)) returns FALSE. Also ! is a function in R, hence the backticks.

But for a (slightly) more honest solution,

R, 391 after removing whitespace

u = !is.na("O")

paste(
  paste0(letters[u+u+u+u+u+u+u+u],
         letters[u+u+u+u+u],
         letters[u+u+u+u+u+u+u+u+u+u+u+u],
         letters[u+u+u+u+u+u+u+u+u+u+u+u],
         letters[u+u+u+u+u+u+u+u+u+u+u+u+u+u+u]),
  paste0(letters[u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u],
         letters[u+u+u+u+u+u+u+u+u+u+u+u+u+u+u],
         letters[u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u+u],
         letters[u+u+u+u+u+u+u+u+u+u+u+u],
         letters[u+u+u+u])
)

In R, there is a built-in object called letters that's, well, a vector of letters. is.na returns FALSE because "O" is not equal to the special value NA, and ! negates the logical (aka Boolean). Then + in R automatically coerces logicals to numerics.

shadowtalker

Posted 2011-03-11T21:18:56.530

Reputation: 461

1

C# (130 chars)

class 聇聤聫聫聮耟聖聮聱聫聣耠{static void Main(){foreach(var c in typeof(聇聤聫聫聮耟聖聮聱聫聣耠).Name)System.Console.Write((char)(c-short.MaxValue));}}

Even though this beats my 131 chars solution, posting this as a separate answer because it works very differently and the other one is more interesting. (And also because the other one is ASCII-only and thus only 131 bytes long.)

Timwi

Posted 2011-03-11T21:18:56.530

Reputation: 12 158

1

Python 2, 116

def Hello(n,m,j):print n.func_name,m.func_name+chr(j)
def World():pass
o=-~0;O=o+o;P=O<<O*O;Hello(Hello,World,P+o)

This is the best I can do so far. Hooray, func_name! (I may or may not try this in Befunge as well.)

(Oops, someone already did this better. Upvote that one instead.)

Kasran

Posted 2011-03-11T21:18:56.530

Reputation: 681

1

Python 272 chars

s=ord('O')
a=len('0')
b=a+a
c=b+a
d=c+a
e=d+a
f=e+a
g=f+a
h=g+a
print chr(s-g)+chr(s+g*c+a)+chr(s+g*d+a)+chr(s+g*d+a)+chr(s+h*d)+chr(s-h*f+a)+chr(s+h)+chr(s+h*d)+chr(s+g*e)+chr(s+g*d+a)+chr(s+g*c)+chr(s-h*f+b)

Though I'm surprised no one tried this method

Python 31 chars

f=open(r'/0.O',)
print f.read()

elssar

Posted 2011-03-11T21:18:56.530

Reputation: 579

I don't think '0' is valid. I think only 0 and '0' are valid. – Erik the Outgolfer – 2016-10-26T17:27:13.167

1

Scala 159

val o='O'/'O'
val t=o+o
val d=t+o
val f=t*t
val e=f*t
val l=' '-d
println (List(-e+o,d*e-t,l,l,' ',-'/',e,' ',' '+d,l,(e-1)*d).map(x=>(x+'O').toChar).mkString)

ungolfed:

val one='O'/'O'
val two=one+one
val drei=two+one // tri, three
val four=two*two
val eight=four<<one

val l=' ' - drei
val h=List(-eight+one, four*eight-two, l, l, ' ', -'/'+one, eight, ' ', ' ' + drei, l, (eight-1)*drei)
println (h.map (x=> (x + 'O').toChar).mkString)

user unknown

Posted 2011-03-11T21:18:56.530

Reputation: 4 210

1

Ruby, 182 bytes

->{o=?O.ord;o/=o;t=o+o;"O00O000OO00O0OOO0OO00OO0OO00OO0OOOO0O00000O0O0OOOOO0OOOOOOO00O0OO0OO00OO00O000O0000O".tr(?O,o.to_s).chars.each_slice(t+t+t+o).map{|i|i.join.to_i(t).chr}.join}

Lambda function, returns desired value.

dkudriavtsev

Posted 2011-03-11T21:18:56.530

Reputation: 5 781

1

Dyalog APL, 115 bytes

Needs ⎕IO←0 which is default on many systems.

Inspiration.

Plain ASCII encoding using 0 for 0 and O for 1.

⎕UCS(⍴⍬⍬)⊥'0O'⍳'OOOOO0OOOOO00OOOOO0OOOOO000000O0O000O0OOO00O0O000OOOO0OO0OO00000O0OOO0000O00O0OO000O'⍴⍨≢¨⎕TS(⎕D,⍬⍬)

⎕UCS Convert Unicode code points to character

(⍴⍬⍬)⊥ base-2 decode of (⍴⍬⍬ is the length of a list of two empty lists, i.e. 2)

'0O'⍳ indices into 0O for each character in

'OOO...00O' the 7×12 character encoded string

⍴⍨ reshaped into a matrix of dimensions

≢¨ the tally of each of

⎕TS(⎕D,⍬⍬) the Time Stamp and the Digits appended with two empty lists

TryAPL online!

Adám

Posted 2011-03-11T21:18:56.530

Reputation: 37 779

0

PHP, 160 157 bytes

no literals at all. Still wonder if it has golfing potential left:

for(;$c=[$h=($f=($t=++$n+$n)+$t)+$f+$s=$f*$f*$f,$e=$s+$s/$t+$v=$f+$n--,$l=$e+$f+--$f,$l,$o=$l+$f,$s/=$t,$h+$v*$f,$o,$o+$f,$l,--$e,++$s][+$i++];)echo chr($c);

creates an array with the ascii codes and loops through it to print the characters.
Run with -nr or try it online.

breakdown

for(;$c=[$h=
    ($f=($t=++$n+$n)+$t)    #       $n=1,$t=2,$f=4
    +$f+$s=$f*$f*$f,        # H     $s=64,$h=72
    $e=$s+$s/$t+$v=$f+$n--, # e     $n=0,$v=5,$e=101
    $l=$e+$f+--$f,$l,       # ll    $f=3,$l=108
    $o=$l+$f,               # o     $o=111
    $s/=$t,                 # space $s=32
    $h+$v*$f,$o,            # Wo
    $o+$f,$l,               # rl
    --$e,                   # d     $e=100
    ++$s                    # !     $s=33
][+$i++];)          # loop through array
    echo chr($c);           # print character

Titus

Posted 2011-03-11T21:18:56.530

Reputation: 13 814

0

ZX Spectrum BASIC, 16 bytes

(including the end of line, but excluding the line number, since that is not part of the code itself)

The hexadecimal representation of the code is:

08 08 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0d

Its "normal" entry would be:

1\x08\x08Hello, world!

where 1 is the (unimportant) line number, \x08 means byte with the value 0x08 - you might have to overcome some slight difficulties if you want to enter it from the keyboard.

Note that Hello, world! is not a string literal, but part of the code itself.

Bonus: you do not have to RUN the program, just "having" it in the computer is enough (in keyword mode) to display:

enter image description here

If you accept "garbage" around the message, the code could be made shorter by three bytes.

Radovan Garabík

Posted 2011-03-11T21:18:56.530

Reputation: 437

1loophole: As "part of the code", it´s a string literal; no matter how you call it. It is also no program, not even a code snippet. It´s actually just plain text. – Titus – 2017-01-28T12:33:31.673

@Titus No, it most definitely is not a string literal - in ZX Spectrum BASIC there is a very sharp difference between code and literals - numbers and strings (also in how they are represented in RAM). And this is none of them, it's neither a string variable. – Radovan Garabík – 2017-01-28T13:47:57.163

0

Ruby 45 chars

p [:Hello,:World!].join :_20[-~0..~0].hex.chr

Mikey

Posted 2011-03-11T21:18:56.530

Reputation: 141

If that is allowed I should just use #| Hello World sub h{};say &h.WHY in Perl 6. – Brad Gilbert b2gills – 2016-05-12T19:28:15.870

or :HelloWorld!.to_s.titleize in rails (26 chars) – Mikey – 2013-03-20T14:37:24.317

Since the rules are already being bent I'm pretty sure :"Hello World!" is technically a Symbol literal. – Kevin Cox – 2013-11-22T02:23:08.110

Never mind, added it as my own. – Kevin Cox – 2013-11-22T02:25:12.230

0

Groovy, 117

def propertyMissing(p){p}
b="OOOOOOOO"
c={(char)it.size()}
a=b+b+b+b
println(Hello+c(a+b+"OOOO")+c(a)+World+c(a+"O"))

prints

Hello, World!

Will Lp

Posted 2011-03-11T21:18:56.530

Reputation: 797

0

If we push the rules quite a bit.

Ruby, 20

puts :"Hello World!"

Technically :"Hello World!" is just the Symbol syntax.

Kevin Cox

Posted 2011-03-11T21:18:56.530

Reputation: 451

2Yeah... you are pushing the rules. – John Dvorak – 2013-11-22T14:13:56.907

0

Befunge 98 - 37

:0!g,:0!0!+:::**+`#@_0!+
Hello World!

The Hello World! is not a string literal. It is source code that would actually do something if you run it (I have no idea what it would do). This program works off the idea of a Befunge quine:

:            duplicate number on stack (note that if there is none, then pushes a 0)
0!           push 0 then not it, producing a 1
g            get the character at the location (:,1) (: = number determined by the previous :)
,            print that character
:            duplicate number on stack (same number as first duplicate)
0!0!+:::**+  push the number 10
`            compare the duplicated number with 10, if it is greater than it, push 1, else push 0.
#            jump over the next character, going to the _
_            move right if the number on the top of the stack is 0, otherwise, move left
@            end program
0!           push 0 then not it, producing a 1
+            add it to the counter (number on top of stack)

I'm working on a longer, more interesting version.

Justin

Posted 2011-03-11T21:18:56.530

Reputation: 19 757

0

F#, 103 bytes

let[<EntryPoint>]``Hello world!``a=System.Reflection.MethodBase.GetCurrentMethod().Name|>stdout.Write;0

Similar to some of the other answers here. The `` characters around the method name are not literals, rather they "delimit an identifier that would otherwise not be a legal identifier, such as a language keyword." (Source)

They do make F# nice for writing tests, since you can give a long human-language name for the tests instead of a programming-language name.

Ciaran_McCarthy

Posted 2011-03-11T21:18:56.530

Reputation: 689

0

JavaScript, 166 bytes

(o=-~0,O=o+[],e=O+0,c=e+0,q=O+c,d=c+0,p=e+O+O+O)=>[c+d,q+e+O,a=O+e+q,a,g=O+p+O,d+0+0,e+p,g,O+q+e,a,q+c,d+0+O].map(b=>String.fromCharCode(parseInt(b,o+o))).join([]+[])

I tried to use most circular alphabet as possible for the variable names.

Naruyoko

Posted 2011-03-11T21:18:56.530

Reputation: 459

0

Runic Enchantments, 94 bytes

mmXm-m-FFm-k$Xm+mm,+:m-:k$Fm+k::}$$::,:++k:}$mKymmmm+++k$mmqnmm,-k${${:FFm+k$k$Fmm+Xk$FFmmqnk@

Try it online!

Wouldn't surprise me if there's a shortcut or two I missed to construct the required values in fewer bytes (mmmm+++ is particularly gross), but managing the stack with duplicated values to be used later incurs its own overhead (as does adjusting the IP s mana value). As such only the o and l in World are utilized this way, as they are constructed in the order lo and required again later in the order ol, so only 6 total bytes are needed to dup and rotate.

The program functions by drawing on the inherent mana of the instruction pointer to generate numerical values, then performing arithmetic operations on that value as necessary to generate the decimal values 72, 101, 108, 111, 32, 87, 114, 100 in order, casting each to char and printing them.

m  -> push current mana value to stack (default 10)
F  -> lower mana value by 1 ("Fizzle")
mK -> increase mana value by 1 (spawns an IP with m mana, costs m-1, then they combine)
X  -> multiply top of stack by 10 (note that this is not a literal value)
k  -> cast top of stack to Char
$  -> print top of stack

In this way the sequence mXm-m- gives the value 80. FFm gives the value 8. 80 - 8 = 72:
mXm-m-FFm-k$ causes H to be printed.

Draco18s no longer trusts SE

Posted 2011-03-11T21:18:56.530

Reputation: 3 053

0

C#, 130 characters

A friend of mine came up with this solution, which is one character shorter than my own solution of 131 (but longer if you count bytes).

class 聇聤聫聫聮耟聖聮聱聫聣耠{static void Main(){foreach(var c in typeof(聇聤聫聫聮耟聖聮聱聫聣耠).Name)System.Console.Write((char)(c-short.MaxValue));}}

Readable:

class 聇聤聫聫聮耟聖聮聱聫聣耠
{
    static void Main()
    {
        foreach (var c in typeof(聇聤聫聫聮耟聖聮聱聫聣耠).Name)
            System.Console.Write((char)(c - short.MaxValue));
    }
}

Timwi

Posted 2011-03-11T21:18:56.530

Reputation: 12 158

I'm sorry, but counting by bytes is the standard here. – SuperJedi224 – 2016-10-26T15:04:46.030

@SuperJedi224: It is now. This answer is quite old. – Timwi – 2016-10-29T22:21:17.393

0

Rebol (23 chars)

print ['Hello 'World!]

NB. In Rebol these are word literals ('word) which are completely different to string literals ("string"):

>> type? 'Hello       
== word!

>> type? "Hello"
== string!

Alternative if you think using word literals is cheating!

print [quote Hello quote World!]

draegtun

Posted 2011-03-11T21:18:56.530

Reputation: 1 592

0

Forth (942)

I'm sure it's not the shortes forth solution... but it's binary! First 5 lines are driver.

: O0 0 ;
: OO 0 0 INVERT - ;
: 00 SWAP 2 * + ;
: OOOOOOOO EMIT ;
: O CR BYE ;

O0 OO 00 O0 00 O0 00 OO 00 O0 00 O0 00 O0 00  OOOOOOOO
O0 OO 00 OO 00 O0 00 O0 00 OO 00 O0 00 OO 00  OOOOOOOO
O0 OO 00 OO 00 O0 00 OO 00 OO 00 O0 00 O0 00  OOOOOOOO
O0 OO 00 OO 00 O0 00 OO 00 OO 00 O0 00 O0 00  OOOOOOOO
O0 OO 00 OO 00 O0 00 OO 00 OO 00 OO 00 OO 00  OOOOOOOO
O0 O0 00 OO 00 O0 00 O0 00 O0 00 O0 00 O0 00  OOOOOOOO
O0 OO 00 O0 00 OO 00 O0 00 OO 00 OO 00 OO 00  OOOOOOOO
O0 OO 00 OO 00 O0 00 OO 00 OO 00 OO 00 OO 00  OOOOOOOO
O0 OO 00 OO 00 OO 00 O0 00 O0 00 OO 00 O0 00  OOOOOOOO
O0 OO 00 OO 00 O0 00 OO 00 OO 00 O0 00 O0 00  OOOOOOOO
O0 OO 00 OO 00 O0 00 O0 00 OO 00 O0 00 O0 00  OOOOOOOO
O0 O0 00 OO 00 O0 00 O0 00 O0 00 O0 00 OO 00  OOOOOOOO

O

Edit #1: I'm stupid! I had to insert 2 noop instructions to make it look nearly like a real dump of /dev/zero...

: O0 0 ;
: OO 0 0 INVERT - ;
: 00 SWAP 2 * + ;
: OOOOOOOO EMIT ;
: 00000000 ;
: 0O ;
: O CR BYE ;

O0 OO 00 O0  00 O0 00 OO  00000000
00 O0 00 O0  00 O0 00 0O  OOOOOOOO
O0 OO 00 OO  00 O0 00 O0  00000000
00 OO 00 O0  00 OO 00 0O  OOOOOOOO
O0 OO 00 OO  00 O0 00 OO  00000000
00 OO 00 O0  00 O0 00 0O  OOOOOOOO
O0 OO 00 OO  00 O0 00 OO  00000000
00 OO 00 O0  00 O0 00 0O  OOOOOOOO
O0 OO 00 OO  00 O0 00 OO  00000000
00 OO 00 OO  00 OO 00 0O  OOOOOOOO
O0 O0 00 OO  00 O0 00 O0  00000000
00 O0 00 O0  00 O0 00 0O  OOOOOOOO
O0 OO 00 O0  00 OO 00 O0  00000000
00 OO 00 OO  00 OO 00 0O  OOOOOOOO
O0 OO 00 OO  00 O0 00 OO  00000000
00 OO 00 OO  00 OO 00 0O  OOOOOOOO
O0 OO 00 OO  00 OO 00 O0  00000000
00 O0 00 OO  00 O0 00 0O  OOOOOOOO
O0 OO 00 OO  00 O0 00 OO  00000000
00 OO 00 O0  00 O0 00 0O  OOOOOOOO
O0 OO 00 OO  00 O0 00 O0  00000000
00 OO 00 O0  00 O0 00 0O  OOOOOOOO
O0 O0 00 OO  00 O0 00 O0  00000000
00 O0 00 O0  00 OO 00 0O  OOOOOOOO

O

max.haredoom

Posted 2011-03-11T21:18:56.530

Reputation: 369

You used a literal 2 in : 00 SWAP 2 * + ;, which is forbidden. – mbomb007 – 2015-11-20T18:20:15.780

Look at the other solutions. That's driver. – max.haredoom – 2016-01-21T20:24:59.833

It's still part of your source code? Also, I looked through every solution rated +1 or more, and there are none that contain any number other than 0, like the rules state, with the exception of one answer using it to specific a version of the language, which may or may not be allowed. What you're doing is not allowed. – mbomb007 – 2016-01-22T03:17:10.783

You are free to ignore my solution. – max.haredoom – 2016-01-25T23:28:13.747

Also, SWAP 2 * +, could be written as OVER + +. – mbomb007 – 2016-01-26T14:27:41.393

0

Python:

print str().join([chr((~0*(~0+~0))**(~0*(~0+~0+~0))*(~0*(~0+~0+~0))**(~0*(~0+~(0)))),
                  chr((~0*(~0+~0))**(~0*(~0+~0))*(~0*(~0+~0+~0+~0+~0))**(~0*(~0+~0))+~0*~0),
                  chr((~0*(~0+~0))**(~0*(~0+~0))*(~0*(~0+~0+~0)**(~0*(~0+~0+~0)))),
                  chr((~0*(~0+~0))**(~0*(~0+~0))*(~0*(~0+~0+~0)**(~0*(~0+~0+~0)))),
                  chr((~0*(~0+~0))**(~0*(~0+~0+~0+~0))*~0*(~0+~0+~0+~0+~0+~0+~0)+~0),
                  chr((~0*(~0+~0))**(~0*(~0+~0+~0+~0+~0))),
                  chr((~0*(~0+~0))**(~0*(~0+~0+~0))*(~0*(~0+~0+~0))*(~0*(~0+~0+~0+~0+~0))+~0),
                  chr((~0*(~0+~0))**(~0*(~0+~0+~0+~0))*~0*(~0+~0+~0+~0+~0+~0+~0)+~0),
                  chr((~0*(~0+~0))**(~0*(~0+~0))*(~0*(~0+~0+~0+~0+~0))**(~0*(~0+~0))+(~0*(~0+~0))**((~0+~0)*(~0+~0))+~0+~0),
                  chr((~0*(~0+~0))**(~0*(~0+~0))*(~0*(~0+~0+~0)**(~0*(~0+~0+~0)))),
                  chr((~0*(~0+~0))**(~0*(~0+~0))*(~0*(~0+~0+~0+~0+~0))**(~0*(~0+~0))),
                  chr((~0*(~0+~0))**(~0*(~0+~0+~0+~0+~0))+~0*~0)
                  ])

ɐɔıʇǝɥʇuʎs

Posted 2011-03-11T21:18:56.530

Reputation: 4 449

0

Java @230 : Twisting the rules with Enumerator behavior

enum A{Hello,B,C,D,E,F,World;public static void main(String[]z){p(Hello);int b=(B.ordinal()),c=(b<<F.ordinal());p((char)(c|b<<D.ordinal()|b<<(b<<b)));p((char)c++);p(World);p((char)c);}static void p(Object o){System.out.print(o);}}

took me a while to figure the logic out, enums printed act like literals and cn donate numbers at the same time :P

masterX244

Posted 2011-03-11T21:18:56.530

Reputation: 3 942

0

VBScript: 279

o = Asc("O")
n = 0 ^ 0
w = Round(Cos(o) / Sin(o), 0)
r = Cos(0) + Sgn(o) + Exp(0)
u = Fix(Log(o))
v = Left(o, o ^ 0)
e = Int(Sqr(o))

MsgBox Join(Array( _
    Chr(v & w), _
    Chr(n & 0 & n), _
    Chr(n & 0 & e), _
    Chr(n & 0 & e), _
    LCase("O"), _
    Chr(u & u), _
    Chr(r & w), _
    Chr(e & v), _
    Chr(n & n & n), _
    Chr(n & n & u), _
    Chr(n & 0 & e), _
    Chr(n & 0 & 0), _
    Chr(r & r) _
), String(0, "O"))

Strategy

  1. Generate the numbers 1,2,3,4,7, and 8 from "O" and 0 and common functions

  2. Concatenate the numbers together as strings to form ascii values

  3. Put ascii values in an array

  4. Join the array into a string using an empty string (repeat "o" 0 times) as the delimiter

  5. Display!

This golfs down to (a very beatable) 279 by removing underscores, linebreaks, and all spaces except for one to seperate 'msgbox' and 'join' and more to keep &0s from behaving like hex literals

o=Asc("O"):n=0^0:w=Round(Cos(o)/Sin(o),0):r=Cos(0)+Sgn(o)+Exp(0):u=Fix(Log(o)):v=Left(o,o^0):e=Int(Sqr(o)):MsgBox Join(Array(Chr(v&w),Chr(n& 0&n),Chr(n& 0&e),Chr(n& 0&e),LCase("O"),Chr(u&u),Chr(r&w),Chr(e&v),Chr(n&n&n),Chr(n&n&u),Chr(n& 0&e),Chr(n& 0& 0),Chr(r&r)),String(0,"O"))

JesterBLUE

Posted 2011-03-11T21:18:56.530

Reputation: 696

0

Javascript - 129 chars

s=[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];c=String.fromCharCode;alert(Object.keys({Hello:s,World:s}).join(c(s.length))+c(++s.length));

vpzomtrrfrt

Posted 2011-03-11T21:18:56.530

Reputation: 201

You can make your code shorter by replacing console.log with alert and by removing the space between : and null. Also, you forgot to add the exclamation mark at the end of the output. – ProgramFOX – 2014-08-28T14:34:07.143

Okay, I've corrected it. – vpzomtrrfrt – 2014-08-28T14:48:38.783

0

Befunge-98, 120

'O0!::+::+*-++:,0!::+::*:**\::++-++:,0!::+::+*--+:,+:,0!::++++:,'O%+:,\#@_0!\0!::++/0!:++:0\-0!+:0!:+/:0!:++:0!-::0!:++*

One long line of Befunge. Yikes.

This basically just prints "Hello ", loads in a list of offsets, and then runs the Hello-printing bit again with some offsets applied to turn "Hello " into "World!". It can probably be golfed down a bit further with the representations of numbers.

Edit - Removed two extraneous spaces that had snuck in.

Kasran

Posted 2011-03-11T21:18:56.530

Reputation: 681

0

Hieroglyphy With 0s, 6129

Golfed down from a generated expression in pure hieroglyphy (itself a variant of the infamous JSF***) which was 7999 bytes long.

Basically exploits the oddities of javascript's type system to generate the string using only the character set [](){}+!0.

[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+([][0]+[])[0]+([][0]+[])[+!0]+([][0]+[])[!0+!0+!0]+(![]+[])[!0+!0+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+([]+[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+(![]+[])[!0+!0]+([]+{})[+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+(!0+[])[0]+([][0]+[])[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0])())[!0+!0+!0]+([][0]+[])[!0+!0+!0])()([][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+([][0]+[])[!0+!0+!0]+(![]+[])[!0+!0+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+([]+[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+(![]+[])[!0+!0]+([]+{})[+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+(!0+[])[0]+([][0]+[])[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0])())[!0+!0+!0]+([][0]+[])[!0+!0+!0])()(([]+{})[0])[0]+(!0+!0+!0+!0+[])+(!0+!0+!0+!0+!0+!0+!0+!0+[]))+([][0]+[])[!0+!0+!0]+(![]+[])[!0+!0]+(![]+[])[!0+!0]+([]+{})[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+([][0]+[])[0]+([][0]+[])[+!0]+([][0]+[])[!0+!0+!0]+(![]+[])[!0+!0+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+([]+[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+(![]+[])[!0+!0]+([]+{})[+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+(!0+[])[0]+([][0]+[])[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0])())[!0+!0+!0]+([][0]+[])[!0+!0+!0])()([][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+([][0]+[])[!0+!0+!0]+(![]+[])[!0+!0+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+([]+[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+(![]+[])[!0+!0]+([]+{})[+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+(!0+[])[0]+([][0]+[])[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0])())[!0+!0+!0]+([][0]+[])[!0+!0+!0])()(([]+{})[0])[0]+(!0+!0+!0+!0+!0+[])+(!0+!0+!0+!0+!0+!0+!0+[]))+([]+{})[+!0]+(!0+[])[+!0]+(![]+[])[!0+!0]+([][0]+[])[!0+!0]+[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+([][0]+[])[0]+([][0]+[])[+!0]+([][0]+[])[!0+!0+!0]+(![]+[])[!0+!0+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+([]+[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+(![]+[])[!0+!0]+([]+{})[+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+(!0+[])[0]+([][0]+[])[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0])())[!0+!0+!0]+([][0]+[])[!0+!0+!0])()([][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+([][0]+[])[!0+!0+!0]+(![]+[])[!0+!0+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+([]+[][(![]+[])[!0+!0+!0]+([]+{})[+!0]+(!0+[])[+!0]+(!0+[])[0]][([]+{})[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0]+(![]+[])[!0+!0+!0]+(!0+[])[0]+(!0+[])[+!0]+([][0]+[])[0]+([]+{})[!0+!0+!0+!0+!0]+(!0+[])[0]+([]+{})[+!0]+(!0+[])[+!0]]((!0+[])[+!0]+([][0]+[])[!0+!0+!0]+(!0+[])[0]+([][0]+[])[0]+(!0+[])[+!0]+([][0]+[])[+!0]+([]+{})[!0+!0+!0+!0+!0+!0+!0]+(![]+[])[!0+!0]+([]+{})[+!0]+([]+{})[!0+!0+!0+!0+!0]+(+{}+[])[+!0]+(!0+[])[0]+([][0]+[])[!0+!0+!0+!0+!0]+([]+{})[+!0]+([][0]+[])[+!0])())[!0+!0+!0]+([][0]+[])[!0+!0+!0])()(([]+{})[0])[0]+(!0+!0+[])+(+!0+[]))

Because this "language" is a subset of javascript, you can run this right from your browser console. It returns the string "Hello World!".

SuperJedi224

Posted 2011-03-11T21:18:56.530

Reputation: 11 342

0

Burlesque, 28 bytes

blsq ) {Hello,}m]\[{world!}m]\[ClwD
Hello, world!

Explanation:

{Hello,} is actually a Block containing the commands He, ll and o,. The reason we can't use {Hello, world!} is because the parser skips whitespaces obviously. m] converts commands to strings and \[ concatenates them. With wD (which is unwords) we insert missing space.

For what it's worth a few notes about how Burlesque parses commands. Pretty much everything that does not start with a digit will be parsed as a command with the exception of the minus sign which tries to parse a double first, if that fails it tries to parse it as an integer and if that fails it tries to parse it as a command. For example a{b} contains NO block. That's the command a{ followed by the command b}. {ab} is a block that contains the command ab. {-}-}} is a block containing the command -} twice. a2.0 is the command a2 followed by the command .0. (That 2.0 is NOT a double in there).

mroman

Posted 2011-03-11T21:18:56.530

Reputation: 1 382

0

Hassium, 264 Bytes

Well this was interesting.

use Math;func main(){a=Math.pi;a/=a;b=a+a;t=Math.pow(b+b,b+a);o=t+Math.pow(b*b+b,b);d(t+(b*b*b));d(o+a);c=o+(b*b*b)d(c)d(c)d(c+b+a)d(Math.pow(b*b,b)*2)d(o-((b*(b*b)+(b*b+a))))d(c+b+a)d((c+b+a)+(b+a))d(c)d(o)d(Math.pow(b*b,b)*b+a);}func d(m)print(Convert.toChar(m))

Run online and see expanded here

Jacob Misirian

Posted 2011-03-11T21:18:56.530

Reputation: 737

0

Prolog, 198 bytes

p:-atom_codes('O0',[O,N]),A is O-N,B is O/O,C is A-B-B,D is B+B+B,G is O+C,H is G+D,I is H+D,K is A+B,L is K+B,M is C*D,J is L*D+B,F is J+B,E is F-C,atom_codes(X,[E,F,G,G,H,K,M,H,I,G,J,L]),write(X).

Explanation

p:-atom_codes('O0',[O,N]),                      % O=79, N=48
   A is O-N,                                    % A=79-48=31
   B is O/O,                                    % B=79/79=1
   C is A-B-B,                                  % C=31-1-1=29
   D is B+B+B,                                  % D=1+1+1=3
   G is O+C,                                    % G=79+29=108
   H is G+D,                                    % H=108+3=111
   I is H+D,                                    % I=111+3=114
   K is A+B,                                    % K=31+1=32
   L is K+B,                                    % L=32+1=33
   M is C*D,                                    % M=29*3=87
   J is L*D+B,                                  % J=33*3+1=100
   F is J+B,                                    % F=100+1=101
   E is F-C,                                    % E=101-29=72
   atom_codes(X,[E,F,G,G,H,K,M,H,I,G,J,L]),     % X='Hello World!'
   write(X).

Emigna

Posted 2011-03-11T21:18:56.530

Reputation: 50 798

0

Emacs Lisp, 281 bytes

(defalias'O'string-to-char)
(setq O(1+(O"O"))O0(-(1+ O)(O"O"))OO(* O0 O0 O0 O0 O0 O0)O1(+ O(- O OO))OOO(+ O1 (* O0 O0 O0) O0 O0)OO1(1+ (+ OOO O0)))
(princ(string(-O(* O0 O0 O0))(1+(+ O1 O0 O0))OOO OOO OO1 (/ OO O0)(1+ (+ O O0 O0 O0))OO1(1+ (+ OO1 O0))OOO(+ O1 O0 O0)(1+(/ OO O0))))

1+ is not a number, but a function, that returns 1 + NUMBER with NUMBER as its argument.

Ungolfed:

(defalias'O'string-to-char)
(setq O (1+ (O"O"))                 ; 80 => "P"
      O0 (-(1+ O)(O"O"))            ; 2
      OO (* O0 O0 O0 O0 O0 O0)      ; 64
      O1 (+ O(- O OO))              ; 96
      OOO (+ O1 (* O0 O0 O0) O0 O0) ; 108 => "l"
      OO1 (1+ (+ OOO O0)))          ; 111 => "o"
(princ
 (string
  (- O (* O0 O0 O0))   ; "H"
  (1+(+ O1 O0 O0))     ; "e"
  OOO                  ; "l"
  OOO                  ; "l"
  OO1                  ; "o"
  (/ OO O0)            ; " "
  (1+ (+ O O0 O0 O0))  ; "W"
  OO1                  ; "o"
  (1+ (+ OO1 O0))      ; "r"
  OOO                  ; "l"
  (+ O1 O0 O0)         ; "d"
  (1+ (/ OO O0))))     ; "!"

Lord Yuuma

Posted 2011-03-11T21:18:56.530

Reputation: 587

0

Clojure, 19 bytes

Since I am not allowed to comment (yet) both of atrociously long Clojure answers, here is mine:

(pr 'Hello 'World!)

3 bytes shorter than print

Michael M

Posted 2011-03-11T21:18:56.530

Reputation: 101

'something is a symbol, not string literal. Symbols evaluate to their names, which are string literals – Michael M – 2016-09-30T06:19:28.183

don't symbols have all caps? – Destructible Lemon – 2016-10-26T05:13:12.797

-1

Stuck, 0 bytes

Yup, an empty program in stuck prints Hello, World! I don't see any string literals or Regex here

Inspired by Fatalize's Answer

sagiksp

Posted 2011-03-11T21:18:56.530

Reputation: 1 249

standard loophole – zzzzBov – 2017-01-22T07:01:03.560

Ok, let me start by explaining that I am the original poster of this challenge, so whatever I tell you can be considered "word of god" for this challenge. I'll follow that with the fact that I posted this challenge almost six years ago, and I was much less experienced. Finally, per the FAQ "The purpose of this question is to provide a repository of standard loopholes which may be assumed to be closed without the question-setter having to explicitly close them." -- with all of that said, *they are absolutely forbidden for this challenge*. – zzzzBov – 2017-01-28T16:58:16.697

-1

C# (357)

class H 
{
    static void main()
    {
         Func<ConsoleKey, char> f = (k) => (char) k;
         Func<char, char> l = (c) => char.ToLower(c);

         Console.WriteLine(new[] {
             f(ConsoleKey.H),
             l(f(ConsoleKey.E)),
             l(f(ConsoleKey.L)),
             l(f(ConsoleKey.L)),
             l(f(ConsoleKey.O)),
             f(ConsoleKey.Spacebar),
             f(ConsoleKey.W),
             l(f(ConsoleKey.O)),
             l(f(ConsoleKey.R)),
             l(f(ConsoleKey.L)),
             l(f(ConsoleKey.D)),
             f(ConsoleKey.PageUp)
        });
    }
}

Golfed:

class H{static void main(){Func<ConsoleKey,char>f=(k)=>(char)k;Func<char,char>l=(c)=>char.ToLower(c);Console.WriteLine(new[]{f(ConsoleKey.H),l(f(ConsoleKey.E)),l(f(ConsoleKey.L)),l(f(ConsoleKey.L)),l(f(ConsoleKey.O)),f(ConsoleKey.Spacebar),f(ConsoleKey.W),l(f(ConsoleKey.O)),l(f(ConsoleKey.R)),l(f(ConsoleKey.L)),l(f(ConsoleKey.D)),f(ConsoleKey.PageUp)});}}

microbian

Posted 2011-03-11T21:18:56.530

Reputation: 2 297

using C = System.ConsoleKey; would save a number of chars. – zzzzBov – 2014-01-28T22:55:49.727

I don't think it will. Enum constants can only be referred through Enum. – microbian – 2014-01-28T23:02:40.507

Next time, please compile your programs before posting them. This needs a using System and Main needs to be capitalized. However, the suggestion made by @zzzzBov is correct; you can use using C=System.ConsoleKey; to abbreviate the code massively. Furthermore, you can remove the parentheses around the lambda parameters. That takes it down to 275. – Timwi – 2014-02-05T00:48:05.930

-1

Ruby 49 chars

def Hello World!;puts __method__;end
Hello World!

The whitespace in the method name is a UTF8 Emsp, a little wider then a normal space which would be a syntax error.

steenslag

Posted 2011-03-11T21:18:56.530

Reputation: 2 070

-2

Windows Batch (17)

Inspired by Joey's answer.

echo Hello World!

kitcar2000

Posted 2011-03-11T21:18:56.530

Reputation: 2 689

1Does Hello World! not qualify as a string literal here? Curious. – shadowtalker – 2014-07-07T22:11:31.273