views:

186

answers:

7

What's the most convoluted hello world program you can think of without any bogus lines? That means every single statement has to contribute to the overall program so you can't simply bloat it with useless declarations and the such.

Any language is ok, but using the esoteric nature of a language by itself does not count as convolution!

+2  A: 

Look into the IOCCC contest winners here and search for the word hello. Lots of entries.

IOCCC = The International Obfuscated C Code Contest

jalexiou
+1  A: 

Build a character array; maybe even forcing match to a numeric sequence corresponding to the letters of the alphabet (8 5 12 12...) to build HELLO WORLD. You can even convolute the output methodology by writing to a buffer in memory and then writing the buffer to the output stream.

Tahbaza
+1  A: 

Take a hello world program written in ... let's say brainfuck, but any stack-based language will do.

Translate said program into pure C. And no, I seriously do not feel like writing that by hand right now, but the idea is to use a stack instead of normal variables and to have the whole alphabet stored at the bottom of said stack as well. Then using the combination of those to write out "Hello world".

Swizec Teller
ha! never heard of that language before.
MakerOfThings7
+4  A: 

Hello World in the Brainf**k language, hands down:

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Ryan Tenney
I absolutely agree that this is crazy convoluted. I understand the dude building a compiler that is less than 200 Bytes, but who in their right mind would EVER actually program using this. That's insane.
rockinthesixstring
It's an interesting exercise to say the least!
Ryan Tenney
This probably doesn't count. You're not really convoluting it, just using a convoluted language. Now if you were to translate this into C or assembler ... :P
Swizec Teller
[Translated into C](http://github.com/ryantenney/brainfuck/blob/master/examples/helloworld.c)
Ryan Tenney
@rock people actually submit SO [code-golf] solution in BrainF_ck...
dmckee
+2  A: 
<script language="vbscript" runat="server">
Dim idx
Dim output
Dim regEx
Dim matches
Dim match
Dim tmp

idx = ""
output = ""
regEx = ""
matches = ""
match = ""
tmp = ""

Dim arr(10)
arr(0) = 72
arr(1) = 101
arr(2) = 108
arr(3) = 108
arr(4) = 111
arr(5) = 32
arr(6) = 87
arr(7) = 111
arr(8) = 114
arr(9) = 108
arr(10) = 100

Function getArrayValue(idx)
    If idx < 11 Then
        getArrayValue = arr(idx)
    End If  
End Function

Function getCharacterToWrite(idx)
    If (idx>0) AND (idx<12) Then
        getCharacterToWrite = Mid(output,idx,1)
    End If  
End Function


For idx = 0 To 10
    output = output & Chr(getArrayValue(idx))
Next

Set regEx = New RegExp
regEx.IgnoreCase = False
regEx.Global = True
regEx.pattern = "[a-zA-Z\ ]"

Set matches = regEx.Execute(output)
For Each match In matches
    tmp = tmp & match.value
Next

If tmp = output Then
    For idx = 1 to 11
        Response.Write(getCharacterToWrite(idx))
    Next
    Response.Write vbCRLF
End If
</script>
rdivilbiss
looks like someone was having some fun
rockinthesixstring
+3  A: 
#include<stdio.h>

char *c[] = { "OLD", "WALLOW", "HERE", " SWORE" };
char **cp[] = { c+3, c+2, c+1, c };
char ***cpp = cp;

main()
{
    printf("%.2s", **++cpp);
    printf("%.3s ", **++cpp+2);
    printf("%.3s", cpp[1][3]+2);
    printf("%s", *cpp[1]+1);
    printf("%c\n", *(*cpp[-2])+1);
    return 0;
}

This should be fairly portable beyond the fact that it requires something at least vaguely ASCII-like -- ASCII, ISO 8859-*, Unicode should all be fine, but with EBCDIC, I'm pretty sure you won't get the final exclamation point.

Jerry Coffin
+2  A: 

:P

try:
    import httplib
except ImportError:
    import http.client as httplib
c = httplib.HTTPConnection("stackoverflow.com")
c.request("GET", "/questions/3420264/")
r = c.getresponse()
t = r.read()
import re
m = re.search("most convoluted (.*?) program", t)
import sys
sys.stdout.write(m.group(1))
André Laszlo