Beating C with one line of Brainfuck
kiwec.net
Beating C with one line of Brainfuck
1–10 of 91 posts
Re: Beating C with one line of Brainfuck
#2Thanks for sharing, I got a good chuckle out of it.
Re: Beating C with one line of Brainfuck
#3Re: Beating C with one line of Brainfuck
#4Re: Beating C with one line of Brainfuck
#5Re: Beating C with one line of Brainfuck
#6 #include
char mem[30000] = { };
#define OUTPUTS 0
char outputs[OUTPUTS] = { };
int main() {
char* ptr = mem + 0;
fwrite(outputs, sizeof(char), OUTPUTS, stdout);
ptr[2] = getchar();
++ptr[2];
while (ptr[2]) {
ptr[2] -= 11;
while (ptr[2]) {
ptr[2] -= 22;
while (ptr[2]) {
++ptr[3];
--ptr[1];
while (ptr[1]) {
++*ptr;
++ptr[1];
}
ptr[2] = 0;
}
ptr[2] = 0;
}
ptr[1] = 0;
ptr[1] += ptr[3] * 1;
ptr[3] = 0;
ptr[2] = getchar();
++ptr[2];
}
ptr[1] = 0;
ptr[3] += *ptr * 1;
ptr[2] += *ptr * 1;
*ptr = 0;
*ptr += ptr[3] * 1;
ptr[3] = 0;
++ptr[1];
while (ptr[2]) {
--ptr[1];
while (ptr[2]) {
ptr[3] += 10;
while (ptr[2]) {
--ptr[2];
--ptr[3];
while (ptr[3]) {
++ptr[4];
ptr += 3;
}
while (ptr[4]) {
++ptr[4];
ptr[3] += ptr[4] * 1;
ptr[4] = 0;
++ptr[5];
ptr += 3;
}
ptr -= 3;
}
ptr[3] = 8;
ptr[2] += ptr[3] * 6;
ptr[3] = 0;
ptr[2] += ptr[4] * 1;
ptr[4] = 0;
ptr[3] += ptr[5] * 1;
ptr[5] = 0;
++ptr;
}
++ptr;
}
while (ptr[1]) {
--ptr[1];
ptr[3] += 8;
ptr[2] += ptr[3] * 6;
ptr[3] = 0;
ptr += 2;
}
while (ptr[0]) {
putchar(ptr[0]);
*ptr = 0;
--ptr;
}
ptr[1] += 10;
putchar(ptr[1]);
return 0;
}Re: Beating C with one line of Brainfuck
#7Generated C: #include char mem[30000] = { }; #define OUTPUTS 0 char outputs[OUTPUTS] = { }; int main() { char* ptr = mem + 0; fwrite(outputs, sizeof(char), OUTPUTS, stdout); ptr[2] = getchar(); ++ptr[2]; while (ptr[2]) { ptr[2] -= 11; while (ptr[2]) { ptr[2] -= 22; while (ptr[2]) { ++ptr[3]; --ptr[1]; while (ptr[1]) { ++*ptr; ++ptr[1]; } ptr[2] = 0; } ptr[2] = 0; } ptr[1] = 0; ptr[1] += ptr[3] * 1; ptr[3] = 0; ptr[2]…
Re: Beating C with one line of Brainfuck
#8Marvelous. Anybody got an optimizing malbolge compiler?
Re: Beating C with one line of Brainfuck
#9Re: Beating C with one line of Brainfuck
#10I wonder if Brainfuck wins by his 100th of a second since he already called a program with words.txt, and therefore it was already loaded into memory, thus saving just a slice of time, as it would already be in the cache.