[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

You have 1 minute to write the most inefficient "Hello World"

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 54
Thread images: 14

File: post-0-13007232731603.png (6KB, 432x252px) Image search: [Google]
post-0-13007232731603.png
6KB, 432x252px
You have 1 minute to write the most inefficient "Hello World" in known human existence.

Go.
>>
File: hello.png (3KB, 177x41px) Image search: [Google]
hello.png
3KB, 177x41px
>>60168336
>>
>>60168336
So a C program that callocs all available system memory, sleeps until the end of time, then outputs Hello World?
>>
>>60168336
Powershell:

-join ((33..126) | Get-Random -count 11 | % {[char]$_})

Randomly generates 11 characters (the length of hello world). Will produce numbers, letters special characters, and given enough time hellow world and a Shakespearean play.
>>
File: 1.jpg (174KB, 428x640px) Image search: [Google]
1.jpg
174KB, 428x640px
>>
package org.fourchan.g;

public class HelloWorld {
public static void main(String[] args) {
String hw;
do {
hw = "";
for (int i = 0; i < "Hello World".length(); i++)
hw += (char) (Character.MAX_CODE_POINT * Math.random());
} while (!hw.equals("Hello World"));
System.out.println(hw);
}
}
>>
File: 2.png (81KB, 500x528px) Image search: [Google]
2.png
81KB, 500x528px
>>
>>60168336
>Go.

You just did ;^)
>>
File: Virus.png (52KB, 1920x1080px) Image search: [Google]
Virus.png
52KB, 1920x1080px
Too stupid to put it into proper code

>Take random string of 11 ascii characters
>check if matches "hello world"
>if it does print hello world
>if not goto 10
>>
>>60168463
see
>>60168441
>>
This is Hello World in Malbolge
(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc

It was discovered using cryptanalysis.
Wikipedia doesn't say how long it took to discover.
>>
File: hw.png (746B, 133x30px) Image search: [Google]
hw.png
746B, 133x30px
This image.

Just think of all the code that's going in to transmitting, storing, and distributing this across the internet, sending it to your browser where it has to be reassembled and displayed as an image.
>>
>>60168462
>using the smiley with a carat nose
>>
>>60168336
no, that's C#

((lambda (s)
(loop for c across s do
((lambda (c)
(princ c))
c)))
"Hello, world!")
>>
File: 1488611606756.jpg (64KB, 582x582px) Image search: [Google]
1488611606756.jpg
64KB, 582x582px
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
srand(time(NULL));
int r[3];
for (;;) {
r[0] = rand();
r[1] = rand();
r[2] = rand();
if (
(r[0] & 0x000000FF) >> 0 == 'H' &&
(r[0] & 0x0000FF00) >> 8 == 'e' &&
(r[0] & 0x00FF0000) >> 16 == 'l' &&
(r[0] & 0xFF000000) >> 24 == 'l' &&
(r[1] & 0x000000FF) >> 0 == 'o' &&
(r[1] & 0x0000FF00) >> 8 == ' ' &&
(r[1] & 0x00FF0000) >> 16 == 'W' &&
(r[1] & 0xFF000000) >> 24 == 'o' &&
(r[2] & 0x000000FF) >> 0 == 'r' &&
(r[2] & 0x0000FF00) >> 8 == 'l' &&
(r[2] & 0x00FF0000) >> 16 == 'd' &&
(r[2] & 0xFF000000) >> 24 == '\0'
) {
printf("%s\n", r);
}
}
}
>>
((lambda (s)
(loop for c across s do
((lambda (c)
(princ
(code-char
(loop
for i = (random 128)
while (not (eq i (char-code c)))
finally (return i)))))
c)))
"Hello, world!")
>>
/bin/bash -c /usr/bin/ruby -e "puts URaFaget"
>>
>>60168445
assemply?
>>
>>60168445
>Moving esp up instead of just popping the argument
KYS
>>
>>60168682
poping is objectively worse
Since you aren't going to use what you just popped you just dirtied up a register unnecessarily.
>>
hello world
>>
>>60168751
underrated post
>>
>>60168724
>his cpu doesn't have a null register
>>
>>60168816
This clearly meant to be x86 asm where there is no null register
>>
>>60168441
bogo world!
>>
>>60168445
>extern _printf
>calling a library function
>>
Step back, guys. I got this. :^)

#include <iostream>
#include <time.h>
#include <cstring>
#include <string>

using namespace std;

const int MAX_CHARS = 12;

int main()
{
srand(time(NULL));

bool is_hello = false;
char *letters = new char[MAX_CHARS];
string a = "";

do
{
for (int i = 0; i < MAX_CHARS; ++i)
{
letters[i] = rand() % 255 + 0;
}

for (int i = 0; i < MAX_CHARS; ++i)
a.push_back(letters[i]);

printf("%s", a);
cout << endl;

if (a.compare("Hello world!") == 0)
is_hello = true;
else
{
for (int i = 0; i < MAX_CHARS; ++i)
letters[i] = 0;
a = "";
}
} while (is_hello == false);

cout << letters << endl;

system("pause");
return 0;
}
>>
>something something pick random unicode character and display if it matches substring, then go to next substring etc
>>
>>60168336
static void Main(string[] args)
{
List<Task> tasks = new List<Task>();
for (int i = 0; i < Environment.ProcessorCount; i++)
{
tasks.Add(Task.Run(() =>
{
var ran = new Random();
var bytes = new byte[12];
while (Encoding.ASCII.GetString(bytes) != "Hello World.")
{
ran.NextBytes(bytes);
}
Console.WriteLine(Encoding.ASCII.GetString(bytes));
}));
}
Task.WaitAny(tasks.ToArray());
}
>>
<?xml version="1.0"?>
<string xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="string.xsd">
<character repeat="1">H</character>
<character repeat="1">e</character>
<character repeat="2">l</character>
<character repeat="1">o</character>
<character repeat="1"> </character>
<character repeat="1">W</character>
<character repeat="1">o</character>
<character repeat="1">r</character>
<character repeat="1">l</character>
<character repeat="1">d</character>
</string>


better make sure to validate it!
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0">
<xsd:simpleType name="characterType">
<xsd:restriction base="xsd:string">
<xsd:length fixed="true" value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="repeatType">
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="characterElemType">
<xsd:simpleContent>
<xsd:extension base="characterType">
<xsd:attribute name="repeat" type="repeatType" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="stringElemType">
<xsd:sequence>
<xsd:element name="character" type="characterElemType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="string" type="stringElemType"/>
</xsd:schema>

$ xmllint --noout --schema string.xsd hello.xml
hello.xml validates


All good! Next we transform...
>>
>>60169264
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="character">
<xsl:param name="repeat" select="@repeat"/>
<xsl:apply-templates/>
<xsl:if test="$repeat &gt; 1">
<xsl:apply-templates select=".">
<xsl:with-param name="repeat" select="$repeat - 1"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="string">
<xsl:apply-templates select="character"/>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
</xsl:stylesheet>


$ xsltproc print-string.xsl hello.xml
Hello world
$
>>
#include <stdio.h>
#include <string.h>

int main()
{
char *buf = "Hello World!\n";
volatile int i;
volatile int c;

for(i = 0; i < strlen(buf); i++)
{
for(c = 0; c < buf[i]; c++);
fprintf(stdout, "%c", c);
fflush(stdout);
}
return 0;

}
>>
File: ss (2017-05-01 at 11.09.59).png (27KB, 613x579px) Image search: [Google]
ss (2017-05-01 at 11.09.59).png
27KB, 613x579px
>>60168336
I feel dirty.
>>
I'd have the code to post here, but it's stuck in QA.
>>
>>60168368
not sure if retarded or joke about python
>>
char unary(char *s) { char c = 0;
for(char c = 0; s; s++) if (c=='1') c++;
return c;}

static const char target[13] = "Hello world!";
int match(char** s) {int ret = 1;
for (int i=0; i <13; i++) ret &= unary(s[i]) == target[i] ;
return ret;}
int main(void)
{ char buff[13][256] = {0};
for (int i = 0; i < 13; i+, +) for(int j =0; j < 256; j++) for (int k = 0 ; k < 256; k++) {
buff[i][j] = (char) k;
if (match(buff)) { for (int h = 0; h < 13; h++) printf("%c", unary(buff[h])) ; return 0;}
}
}
>>
>>60168895
>using the smiley with a carat nose
>>
https://pastebin.com/CwKLX3aW
>>
File: hello.gif (772KB, 500x335px) Image search: [Google]
hello.gif
772KB, 500x335px
>>60168495
I see your .png and raise you a .gif
>>
File: 7i1lvije90by.png (41KB, 542x497px) Image search: [Google]
7i1lvije90by.png
41KB, 542x497px
void helloWorld(){
char[] allCharacters = ['a','b','c','d','e','f','g','e','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ']
char[] helloWorldArray = ['h','e','l','l','o',' ','w','o','r','l','d'];
for (int i = 0; i<=11; i++) {
for (int j = 0; i <= 27; j++){
if (allCharacters[j] == helloWorldArray[i]) print allCharacters[j];
};
};
}



Took me a little bit longer than a minute.
>>
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
>>
>>60168336
youtube.com/watch?v=tBQ69ZnuMbc
>>
>>60168336
a = []
a.append('h')
a.append('e')
for i in xrange(2):
a.append('l')
a.append('o')
a.append(' ')
a.append('w')
a.append('o')
a.append('r')
a.append('l')
a.append('d')

for x in a:
print x,
>>
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

var s, c;

for(;;){

s = '';

for(var i = 0; i < 18; i++){
s += String.fromCharCode(getRandomInt(0,255));
}
if(s == 'Hello World!'){
console.log(s);
break;
}
}


>>

(aBA@?>=<;:9876543210/.-,JH)('&%$#"!~}|{zy\J6utsrq
ponmlkjihgJ%dcba`_^]\[ZYXWVUTSRQPONMLKJIHGF('C%$$^
K~<;4987654321a/.-,\*)
j
!~%|{zya}|{zyxwvutsrqSonmlO
jLhg`edcba`_^]\[ZYXWV8TSRQ4
ONM/KJIBGFE>CBA@?>=<;{9876w
43210/.-m+*)('&%$#"!~}|{zy\
wvunslqponmlkjihgfedcEa`_^A
\>ZYXWPUTSRQPONMLKJIH*FEDC&
A@?>=<;:9876543210/.-m+*)(i
&%$#"!~}|{zyxwvutsrqpRnmlkN
ihgfedcba`_^]\[ZYXWVU7SRQP3
NMLKJIHGFEDCBA@?>=<;:z8765v
3210/.-,+*)('&%$#"!~}_{zyx[
vutsrqjonmlejihgfedcba`_^]@
[ZYXWVUTSRo

>>
File: thisnew.jpg (21KB, 458x319px) Image search: [Google]
thisnew.jpg
21KB, 458x319px
>>60170557
>https://pastebin.com/CwKLX3aW
>>
File: oiMundo.png (194KB, 1472x1000px) Image search: [Google]
oiMundo.png
194KB, 1472x1000px
Swift
>>
>>60168445
>C lib calls from assembly
>Not using syscalls or interrupts
>>
sleep( 4294967295);
cout << "Hello World.";
>>
>>60170870

kek, it hurts so bad.
>>
Sure
section .data
hello db "Hello World",10
section .text
global _start
_start:
mov rax,1
mov rdi,1
mov rsi,hello
mov rdx,12
syscall
>>
>>60168451
Junior Java dev here, there are people who wouldn't bat an eyelid at something like this...
>>
>>60170737
brainfuck
>>
>>60168336
https://gist.github.com/lolzballs/2152bc0f31ee0286b722
Thread posts: 54
Thread images: 14


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.