You have 1 minute to write the most inefficient "Hello World" in known human existence.
Go.
>>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.
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);
}
}
>>60168336
>Go.
You just did ;^)
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
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.
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!")
#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
>>60168336static 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 > 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> </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;
}
>>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
>>60168495
I see your .png and raise you a .gif
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
>>60168336a = []
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
>>60170557
>https://pastebin.com/CwKLX3aW
Swift
>>60168445
>C lib calls from assembly
>Not using syscalls or interrupts
sleep( 4294967295);
cout << "Hello World.";
>>60170870
kek, it hurts so bad.
Suresection .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