What is the most convoluted way to write hello, world?
Brainfuck:++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
>>59171839
>>59171839
print("Hello world!")
>>59172068
Nice Python Anon. How'd you learn that difficult language...
Also:
Print ("hello, world?")
>>59171839
French or Polish.
(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc
>>59171839
directly, using binary. However the fuck you would do that
#!/usr/bin/perl
my @letters = ('a'..'z',' ','!');
my $string;
sub create_string {
for ($i=0;$i<=11;$i++) {
$string = $string . $letters[int rand @letters];
};
if ($string =~ 'hello world!') {
print $string;
} else {
$string = '';
create_string();
}
}
create_string();
>>59172368Salut, Le Monde
andWitaj świecie
Honetsly I'd say Arabic is more complicated m8مرحبا بالعالم
package com.helloworld.business;
public class Main {
public static void main(String[] args) {
Printer printerInstance = new Printer();
try {
printerInstance.print(Factory.getModel("Hello"));
printerInstance.print(Factory.getModel("Space"));
printerInstance.print(Factory.getModel("World"));
}
catch(Exception e) {
}
}
}
package com.helloworld.business;
public class Hello implements Printable {
@Override
public String print() {
return "Hello";
}
}
package com.helloworld.business;
public class Factory {
public static Printable getModel(String name) throws Exception {
switch (name) {
case "Hello":
return new Hello();
case "World":
return new World();
case "Space":
return new Space();
default:
throw new Exception("Invalid name");
}
}
}
package com.helloworld.business;
public interface Printable {
public String print();
}
package com.helloworld.business;
public class Printer {
private void print(boolean withNewLine, String what) {
if (withNewLine )
System.out.println(what);
else
System.out.print(what);
}
public void print(Printable who) {
this.print(false, who.print());
}
public void println(Printable who) {
this.print(true, who.print());
}
}
public class Space implements Printable{
public String print() {
return " ";
}
}
package com.helloworld.business;
public class World implements Printable {
public String print() {
return "World";
};
}
>>59172789
this is Java everybody
>>59172442
Good. Now do it in a way that won't trigger a stack overflow every time you call the function.
machine code.
Malbolge(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc
>>59171839
READY.
PRINT "HELLO, WORLD"
HELLO, WORLD
READY.
_
10 Print Hello World
20 Goto 10
>>59172442
>for loop
>>59172346
What's wrong with Python?import string
abc = string.ascii_lowercase
hello = abc[7]+abc[4]+abc[11]*2+abc[14]
world = abc[22]+abc[14]+abc[17]+abc[11]+abc[3]
print(hello.capitalize(), world+'!')
Do it for a bootloader in 16bit assembly
Here's my attempt:#define/**/install/**/0[x]=045;p(j);p(k);for(;;){++l;m++;++q;r++;
#define gentoo if((l-44)>>6){p(l);p(l);break;}}m|=3;q^=27;p(m); \
r+=6;t>>=2;t+=7;p(t);p(q);p(m);p(r);p(l) ;p(s); t++;p(t) ;p(10);}
#define/**/i/**/int/*/a/ /b/ /c/ /d/ /e/ /f/ /g/ /gif/ /h/ /hr/*/
#define/**/c/* */char/*/k/ /m/ /o/ /p/ /r/ /s/ /t/ /u/ /v/ /vg/*/
#define/**/Anonymous/**/1[x] b-1;i Mon b;j+=4;k++;i a=// /vr/ /w/
#define/* */b/* */=0144/* /wg/ /i/ /ic/ /r9k/ /s4s/ /cm/ /hm/ */
c x[2];i j b,No b,k b,l b,m b,q b,r b,s b,t b;main(){ //lgbt/ /y/
#define p(o) printf(x, o) //3/ /aco/ /adv/ /an/ /asp/ /biz/ /cgl/
Anonymous 12/12/16*(Mon)*19;55;11*No*57972012;
install gentoo
>>59173922
I will when I get home
Which is in about half an hour
Is there no Hello World Enterprise Edition?
>>59175536
It's the first hit on Google, my dude:
https://gist.github.com/lolzballs/2152bc0f31ee0286b722
>>59172821
It's Java, but the point was to become convoluted. If you're gonna complain that even without the extra shit, it's too convoluted, it's because it's not meant to be abused for tiny programs.
>>59171839auto hello = "aGVsbG8gd29ybGQNCg==";
cout << hello;
>>59173922
There, easy.bits 16
org 0x7c00
section .text
jmp 0:start
start:
mov ax, 0
mov ds, ax
mov ss, ax
mov ax, 0xb800
mov gs, ax
mov sp, 0x7c00
call clear
mov si, hwString
call puts
halt:
hlt
jmp halt
puts:
push si ; char *string
push di ; u16 vgaIndex
push bx ; char character
mov di, 0
.loop:
mov bl, [si]
cmp bl, 0
je .ret
mov [gs:di], bl
mov byte [gs:di + 1], 0x0f
inc si
add di, 2
jmp .loop
.ret:
pop bx
pop si
pop di
ret
clear:
push si ; int i
mov si, 0
.loop:
cmp si, (80 * 2 * 25)
jge .ret
mov byte [gs:si], 0
inc si
jmp .loop
.ret:
pop si
ret
hwString:
db 'Hello world!', 0
times (510 - ($ - $$)) db 0
dw 0xaa55
>>59175869
>tfw too intelligent for char hello[]
import java.io.OutputStream;
import java.io.PrintStream;
/**
*@author me
*/
public class Java {
private static final String STRING = "Hello World";
public static String getClassName() {
return STRING;
}
private static class Printer {
private String toBePrinted;
private final OutputStream outputStream;
public Printer() {
outputStream = System.out;
String toBePrinted = STRING;
}
private OutputStream getOutputStream() {
return outputStream;
}
public Printer(String toBePrinted) {
setToBePrinted(toBePrinted);
outputStream = System.out;
}
private void setToBePrinted(String whatWillWePrint) {
this.toBePrinted = whatWillWePrint;
}
public void print(OutputStream os) {
preparatoryPrint(new PrintStream(getOutputStream()));
}
private void preparatoryPrint(PrintStream out) {
out.print(this);
print(out);
}
private void print(PrintStream out) {
out.print(toBePrinted);
}
public String getWhatWeShallPrintThisTime() {
return this.toBePrinted;
}
@Override
public String toString() {
return "We shall print: " + getWhatWeShallPrintThisTime();
}
}
public static void main(String[] args ) throws Exception {
try {
Printer printer = new Printer(getClassName());
} catch (Exception error) {
throw new Exception("Construction of an object of the class Printer failed");
}
try {
Printer printer = new Printer(getClassName());
printer.print(System.out);
} catch (Exception error) {
throw new Exception("Some error happened");
}
}
}
>>59177686
you should paramerize what the printer will print.
eg a print descriptor object would be nice.
also these things should be linked using DI of course.
>>59172858
perl has tail call optimization so there is no stack overflow.
>>59172945
how the fuck does that even work?
>>59177815
He doesn't know, he just copied the hello world from Wikipedia
>>59171839
>What is the most convoluted way to write hello, world?
the python print "hello" is way more convoluted than examples presented here, it's just that the convolution is no apparently seen by the programmer.
in other words, you are all edgy teens.
>>59171839
Obfuscated C with inline assembly.
Like a Kloss
>>59171839
Let me Google that for you:
https://www.esolangs.org/wiki/Hello_world_program_in_esoteric_languages
>>59172789
>printer doesn't implement printable
package Earth;sub Greet{
%_=('Y','~');$_='$;=!(Middle
Earth.age~~~<Eart~~~~~~~~~~~~~h
.age)?!(defined$ti~~~~~~~~~~~mez~~~On
e[2])?!(push@time~~~~~~~~~~~~~~~~Zone,loc
~altime())?rotation?~~~~~~~~~~~~~q~~?The Worl
~~d?:q:[\w]::q=[\~~~~~~~~~~~~~~~~~d~a-f]=:q?..~~
~~~?:q:.:;"42b3d3~~~~~~~~~~~~~~~~~~~~~728656c6c6f6
~~~~~0277f627c64672~~~~~~~~~~~~~~~~~~~~~b3072796e647
~~~~~~~42b3b3rg7d"=Ym~~~~~~~~~~~~~~~~~~~\$;~~*\;p~~~~u
~~~~~~~~~sh@_,$&;bless~~~~~~~~~~~~~~~~~~~~~~~~~$c~~~~~~~
~~~~~~~~~o~ntine~~~~~nt~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~s=\~~~~~~~$~~~~~~~~~~~~~~~~~~~~~~~pangaea~~~~
~~~~~~~~~~~~~~~;{l~~~~~~~~~~~~~~~~~~~~~~~~~~~~ocal@_;local$;
~~~~~~~~~~~~~~~~~="o~~~~~~~~~~~~~~~~~~~~~~~~~cean";$^A=(defi
~~~~~~~~~~~~~~~~~~~n~~~~~~~~~~~~~~~~~~~~~~~~~ed$continents)?
~~~~~~~~~~~~~~~~~~~(vec(~~~~~~~~~~~~~~~~~~~~~~$;, YYsplit(\'
~~~~~~~~~~~~~~~~~\',${\$;}~~~~~~~~~~~~~~~~~~~~~~)%3,YYsplit(
~~~~~~~~~~~~~~~~q??,$;)**2-~~~~~~~~~~~~~~~~~~~~~~(($;=Ytr/oa
~~~~~~~~~~~~~~~~eiu//)**2))=~~~~~~~~~~~~~~~~~~~~~~=28160)?q:
~~~~~~~~~~~~~~~~~.::q?!?:\'?~~~~~~~~~~~~~~~~~~~~~~\';}$^A=Ys
~~~~~~~~~~~~~~~~:\Q.\E:pack(~~~~~~~~~~~~~~~~~~~~~~\'h*\',j
~~~~~~~~~~~~~~~~~oin(q(),~~~~~~~~~~~~~~~~~~~~~~~grep{$_=
~~~~~~~~~~~~~~~~~~Ym,$,,}~~~~~~~~~~~~~~~~~~~~~~~split("
~~~~~~~~~~~~~~~~~",@_~~~~~~~~~~~~~~~~~~~~~~~~~~[0]))
~~~~~~~~~~~~~~~~):e~~~~~~~~~~~~~~~~~~~~~~~~~~~gexe
~~~~~~~~~~~~~~~;$d~~~~~~~~~~~~~~~~~~~~~~~~~~~="s
~~~~~~~~~~~~~~ort~~~~~~~~~~~~~~~~~~~~~~~~~~<=
~~~~~~~~~~~~>,~~~~~~~~~~~~~~~~~~~~~~~~~~YY
~~~~~~~~~~~@_~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~"~~~~~~~~~~~~~~~~~~~';;
s,(~|\r|\n|\s),,g;s.Y.\x7e.g;
eval};Greet;'the world';
>>59178112
Why do people make comments of things that are so blatantly obvious?
>>59171839
>2017
>not programming in tail$ ./hello.tail
Hello World!
$ cat hello.tail
#!/usr/bin/tail -n+2
Hello World!
>>59178176
The target audience is literal retards
>>59171874
Why is this language so fun to learn
Scope(\) {
Method(_WAK) {
Store ("Hello World", Debug)
Return(Package(2){0x00000000,0})
}
}
So, am I a hax0r or what?
>>59171874
Whirl:110001100111000111110000010001111100011000000000110000011100000110000010000
011000111100000111110000011100001111100100011001110000111111100001001111100
011000000000110000011000111110001000000000000000000001001111110000111111000
100000000000000000000000000011111000100100000000111111000100000000000001001
000011111000001110000111110010001100011000000100010000011000000000000000001
100000111001111100111111000100111001111000011100010011111110000111000110000
000000000000000000000000000001000100001111100000111000011111001100011100000
111000000010001111100000111110001000000000111000110000000000000000000000000
000000100100001111100000111000011100010000000000000100010000111110001110001
111100111111000011100001100111000111000000000001111100000111000110000110110
001000000000010000001111100000111000011111000000010001110000000000000000000
000000000000100000011111000001100
>>59178112
>4 contributors
Really needed that many for this
Malbolge(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc
>>59180612
>>59172945
SAME RESULT, LONGER CODE('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>
One that brute force checks for non-trivial zeroes of the Riemann Zeta function between zero and one, and when it finds one, outputs "hello world!"
>>59181051
Written in JavaScript
>>59178176
We're talking about karlie m8
>>59181549
By a pajeet
>>59171839
#include <iostream> #include <string> #include <thread> #include <vector> #include <mutex> #include <cstring> #include <cstdlib> #define MOV "movq " #define PUT1 "movq $1, " #define SYSCALL "syscall" #define SYS_ARG_SYSCALL "%rax" #define SYS_ARG_FD "%rdi" #define SYS_ARG_BUFF "%rsi" #define SYS_ARG_COUNT "%rdx" #define ASM(...) __VA_ARGS__ " ;" #define ASM_ESCAPE(arg) "%" arg char **explode(char *string, const char *delim) { char **res = (char**)malloc(sizeof(char*)*(strlen(string)+1)); char *tok; char **current = res; while(tok = strtok(string, delim)) { string = NULL; *(current++) = strdup(tok); } *current = NULL; return res; } std::string hello; std::vector<char> hello_buffer; std::mutex hello_mutex; void hello_runner(char c) { std::lock_guard<std::mutex> lock(hello_mutex); if(hello_buffer.size() == hello.size()) return; hello_buffer.emplace_back(c); asm volatile( ASM(PUT1 ASM_ESCAPE(SYS_ARG_SYSCALL)) ASM(PUT1 ASM_ESCAPE(SYS_ARG_FD)) ASM(MOV ASM_ESCAPE("[addr]") "," ASM_ESCAPE(SYS_ARG_BUFF)) ASM(PUT1 ASM_ESCAPE(SYS_ARG_COUNT)) ASM(SYSCALL) : : [addr] "r"(&c) : SYS_ARG_SYSCALL, SYS_ARG_FD, SYS_ARG_BUFF, SYS_ARG_COUNT, "memory" ); } int main() { char input[] = "Helol ,World!\n#LOL!"; char **exploded = explode(input, "#"); std::vector<std::string> words; char **it = exploded; while(*it) { char *word = *(it++); words.emplace_back(word); free(word); } free(exploded); hello = words[0]; std::string target_string = "Hello, World!\n"; auto target = std::vector<char>(begin(target_string), end(target_string)); while(hello_buffer != target) { hello_buffer.clear(); std::vector<std::thread> threads; for(char c : hello) for(char c : hello) for(char c : hello) threads.emplace_back(hello_runner, c); for(std::thread &t : threads) t.join(); } }
>>59172422
Machine code much?