90
\$\begingroup\$

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.

\$\endgroup\$
24
  • 1
    \$\begingroup\$ I hope by "numbers" you mean "numeric constants", because there probably wouldn't be much programming left without. \$\endgroup\$
    – J B
    Commented Mar 11, 2011 at 21:42
  • 5
    \$\begingroup\$ One 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. \$\endgroup\$ Commented Mar 11, 2011 at 22:29
  • 4
    \$\begingroup\$ -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. \$\endgroup\$ Commented Mar 11, 2011 at 22:35
  • 2
    \$\begingroup\$ @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. \$\endgroup\$ Commented Mar 11, 2011 at 23:39
  • 2
    \$\begingroup\$ Some 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. \$\endgroup\$
    – Timwi
    Commented Mar 12, 2011 at 21:12

108 Answers 108

1
\$\begingroup\$

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));}}
\$\endgroup\$
1
\$\begingroup\$

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}
\$\endgroup\$
1
  • \$\begingroup\$ z=[z].size is brilliant. \$\endgroup\$
    – Jordan
    Commented Aug 16, 2016 at 15:54
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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

\$\endgroup\$
1
\$\begingroup\$

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!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ -~0 is a shorter way to get 1 than 0**0. \$\endgroup\$
    – Kasran
    Commented Nov 23, 2014 at 1:36
  • \$\begingroup\$ 93 bytes \$\endgroup\$ Commented Jul 30, 2023 at 17:39
1
\$\begingroup\$

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]))
\$\endgroup\$
2
  • 1
    \$\begingroup\$ No string or character literals were used. \$\endgroup\$
    – galdre
    Commented Nov 20, 2015 at 5:22
  • \$\begingroup\$ @Mego, the question rules allow many trivial answers like this to be valid. \$\endgroup\$
    – user7486
    Commented Nov 21, 2015 at 6:12
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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!

\$\endgroup\$
1
\$\begingroup\$

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

\$\endgroup\$
4
  • \$\begingroup\$ I think _ counts as a number. Another way to get 1 is #a: \$\endgroup\$
    – miles
    Commented Jan 21, 2017 at 2:40
  • \$\begingroup\$ @miles True. I'll make the change accordingly. \$\endgroup\$ Commented Jan 21, 2017 at 2:58
  • \$\begingroup\$ Shorter 1: ^0 \$\endgroup\$
    – Adám
    Commented Oct 28, 2019 at 23:15
  • \$\begingroup\$ Shouldnt *_ be ^0 too, since _ is a non-zero number? \$\endgroup\$
    – Adám
    Commented Oct 28, 2019 at 23:18
1
\$\begingroup\$

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  
    ));
\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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

\$\endgroup\$
1
\$\begingroup\$

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

\$\endgroup\$
1
\$\begingroup\$

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!

\$\endgroup\$
1
  • \$\begingroup\$ @Johannes Kuhn: I think my solution is farther from a literal than yours! \$\endgroup\$
    – sergiol
    Commented Apr 30, 2018 at 0:20
1
\$\begingroup\$

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.
\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

Microsoft Excel, 178 131 chars

Uses the following cells:

  1. A1 - =0=0 TRUE. Since we don't need a real "1", we can just abuse coercion.
  2. A2 - =A1+A1 TRUE + TRUE = 2
  3. A3 - =A2+A1 2 + TRUE = 3
  4. A4 - =A3+A1 3 + TRUE = 4
  5. A6 - =A4+A2 4 + 2 = 6
  6. A8 - =A6+A2 6 + 2 = 8
  7. A9 - =A8+A1 8 + TRUE = 9
  8. B8 - =A4&A2 42
  9. B9 - =A3&A3 33
  10. B1 - =PROPER(BASE(A8&0&A2&A9&B8&A2,A2&A6)&" "&BASE(A3&A8&A8&B8&0&A6&A9,B9)&CHAR(B9)) "Hello World!"

5 + 6 * 8 + 79 = 131 chars.

Only a 0 literal was used. Every other value is a reference dependent on that.

Unobfuscated, the formula is =PROPER(BASE(8029422,26)&" "&BASE(38842069,33)&CHAR(33))

\$\endgroup\$
1
\$\begingroup\$

Arturo, 34 bytes

prints['Hello]prints'World print'!

Try it

Using literals (what might be called symbols in most languages) and a symbolLiteral for the !. Luckily they can be printed directly. A minimum of 3 prints must be used to force the correct spacing.

\$\endgroup\$
1
\$\begingroup\$

Javascript, 186 Bytes

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

Vyxal 3, 15 bytes

n½hṪṪtm½½htḢh+Ė

Try it Online!

manipulates the alphabet builtins to create the string "kH" which is evaled to "Hello, World!"

\$\endgroup\$
4
  • \$\begingroup\$ Am I missing something? The challenge says not to use Hello World builtins, this is eventually using it, just in a different order than usual \$\endgroup\$ Commented Feb 8 at 17:41
  • \$\begingroup\$ Also, here’s kH in 12: vyxal.github.io/… lower is probably possible with a different method \$\endgroup\$ Commented Feb 8 at 17:49
  • \$\begingroup\$ I can look for golfier ways, and I don't see this as cheating since I never actually used a built in for hello world, I just constructed it \$\endgroup\$
    – pacman256
    Commented Feb 8 at 18:12
  • 1
    \$\begingroup\$ in the one i sent earlier, “halve tail” can be “str-last-half” \$\endgroup\$ Commented Feb 8 at 18:16
0
\$\begingroup\$

Ruby 45 chars

p [:Hello,:World!].join :_20[-~0..~0].hex.chr
\$\endgroup\$
4
  • \$\begingroup\$ or :HelloWorld!.to_s.titleize in rails (26 chars) \$\endgroup\$
    – Mikey
    Commented Mar 20, 2013 at 14:37
  • \$\begingroup\$ Since the rules are already being bent I'm pretty sure :"Hello World!" is technically a Symbol literal. \$\endgroup\$
    – Kevin Cox
    Commented Nov 22, 2013 at 2:23
  • \$\begingroup\$ Never mind, added it as my own. \$\endgroup\$
    – Kevin Cox
    Commented Nov 22, 2013 at 2:25
  • \$\begingroup\$ If that is allowed I should just use #| Hello World␤sub h{};say &h.WHY in Perl 6. \$\endgroup\$ Commented May 12, 2016 at 19:28
0
\$\begingroup\$

If we push the rules quite a bit.

Ruby, 20

puts :"Hello World!"

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

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Yeah... you are pushing the rules. \$\endgroup\$ Commented Nov 22, 2013 at 14:13
0
\$\begingroup\$

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.

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

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));
    }
}
\$\endgroup\$
2
  • \$\begingroup\$ I'm sorry, but counting by bytes is the standard here. \$\endgroup\$ Commented Oct 26, 2016 at 15:04
  • \$\begingroup\$ @SuperJedi224: It is now. This answer is quite old. \$\endgroup\$
    – Timwi
    Commented Oct 29, 2016 at 22:21
0
\$\begingroup\$

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!]
\$\endgroup\$
0
\$\begingroup\$

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
\$\endgroup\$
5
  • \$\begingroup\$ You used a literal 2 in : 00 SWAP 2 * + ;, which is forbidden. \$\endgroup\$
    – mbomb007
    Commented Nov 20, 2015 at 18:20
  • \$\begingroup\$ Look at the other solutions. That's driver. \$\endgroup\$ Commented Jan 21, 2016 at 20:24
  • \$\begingroup\$ 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. \$\endgroup\$
    – mbomb007
    Commented Jan 22, 2016 at 3:17
  • \$\begingroup\$ You are free to ignore my solution. \$\endgroup\$ Commented Jan 25, 2016 at 23:28
  • \$\begingroup\$ Also, SWAP 2 * +, could be written as OVER + +. \$\endgroup\$
    – mbomb007
    Commented Jan 26, 2016 at 14:27
0
\$\begingroup\$

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)
                  ])
\$\endgroup\$
0
\$\begingroup\$

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

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

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"))
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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