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!
Hello World in the Brainf**k language, hands down:
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
#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.
: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))
Look into the IOCCC
contest winners
here
[1] and search for the word hello
. Lots of entries.
IOCCC
= The International Obfuscated C
Code Contest
<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>
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.
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".
It's impossible to objectively answer this question
fits pretty well though. There's no "most convoluted" way to do anything, it's always possible to do it in an even more convoluted way. - deceze