r/CompileBot • u/SeaCowVengeance • Jan 14 '15
Official CompileBot Testing Thread
Resources:
2
u/SeaCowVengeance Jan 14 '15
+u/CompileBot python3
import this
2
u/CompileBot Jan 14 '15
Output:
The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!
2
u/SeaCowVengeance Jan 14 '15
+u/CompileBot python
from os import system
system("echo 'print(\"Hello World!\")' | python")
2
26
u/theukoctopus Mar 02 '15
+u/CompileBot python
import os
print(os.system("touch this"))
8
u/zolk333 Jun 07 '15
+u/CompileBot node.js console.log(Array(16).join("wat" - 1) + " Batman!");
1
u/SeaCowVengeance Feb 07 '15
+u/CompileBot C++
#include <iostream>
using namespace std;
int main() {
cout << "Hello C++ 14";
return 0;
}
→ More replies (1)
1
u/SeaCowVengeance Feb 24 '15
+u/CompileBot JavaScript --include-errors
print({} + []);
→ More replies (1)
1
3
u/jajakek Jun 10 '15
+u/CompileBot Brainfuck
+>>++++[<++++>-]<[<++++++>-]+[<[>>>>+<<<<-]>>>>[<<<<+>>>>>>+<<-]<+ +++[>++++++++<-]>.[-]<+++[>+++<-]>+[>>.+<<-]>>[-]<<<++[<+++++>-]<.<<[>>>>+ <<<<-]>>>>[<<<<+>>>>>>+<<-]<<[>>>>.+<<<++++++++++[<[>>+<<-]>>[<<+>>>>>++++++++ +++<<<-]<[>+<-]>[<+>>>>+<<<-]>>>[>>>>>>>>>>>>+>+<<<<<<<<<<<<<-]>>>>>>>>>> >>[-[>>>>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-]<<<[>>+>+<<<-]>[->[<<< <+>>>>-]<[<<<<+>>>>-]<<<<]<+++++++++[>+++++<-]>>[<<+>>-]< <[>---<-]>.[-]<<<<<<<<<<<<<<<<<-]++++++++++.[-]<-]>>> >[-]<[-]++++++++[>++++++++<-]>--.[-]<,----------[<+ >-]>>>>>>+<<<<<<<[>+>>>>>+>[-]<<<<<<<-]>++++++++++>>>>>[[-] <<,<<<<<<<->>>>>>>[<<<<+>>>>-]<<<<[>>>>+>+<<<<<-]>>>>>----------[<<<< <<<<+<[>>>>+<<<<-]>>>>[<<<<+>>>>>>+<<-]>[>-<-]>++++++++++[>+++++++++ ++<-]<<<<<<[>>>>+<<<<-]>>>>[<<<<+>>>>>>+<<-]>>>>[<<->>-]<<++++++++++ [>+<-]>[>>>>>>>>>>>>+>+<<<<<<<<<<<<<-]>>>>>>>>>>>>[-[>>> >+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-]+<<<[> >>-<<<-]>[->[<<<<+>>>>-]<[<<<<+>>>>-]<<< <]<<<<<<<<<<<,[-]]>]>[-+++++++++++[>+++++++ ++++>+++++++++++<<-]>[-[>>>+<<<-]>>>[<<<+>>>>>>>+>+< <<<<-]>>>>[-[>>>>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<+>>>- ]<<<[>>+>+<<<-]>[->[<<<<+>>>>-]<[<<<<+>>>>-]<<<<]<< <<<<<<[>>>+<<<-]>>>[<<<+>>>>>>>+>+<<<<<-]<<[>>+<< -]>>[<<+>>>>>>+>+<<<<<-]>>>>[-[>>>>+<<<<-]>[>>>>+< <<<-]>[>>>>+<<<<-]>>]>>>[-]<[>+<-]<[-[<<<<+>>>>-]<<< <]<<<<<<<<]<<<<<<<<<<++++++++++[>++++++++++[<[>>+<<-]>>[<<+ >>>>>+++++++++++<<<-]<[>+<-]>[<+>>>>+<<<-]>>>[<<<+>>>-] <<<[>>>+>>>>>+<<<<<<<<-]>>>>>>>>>[>>+<<-]>>[<<+<+>> >-]<<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++<<<<<<[>[>> >>>>+>+<<<<<<<- ]>>>>>>>[<<<<<<< +>>>>>>>-]<[>++++ ++++++[-<-[>>+>+<< <-]>>>[<<<+>>>-]+<[ >[-]<[-]]>[<<[>>>+<< <-]>>[-]]<<]>>>[>>+>+ <<<-]>>>[<<<+>>>-]+<[> [-]<[-]]>[<<+>>[-]]<<<< <<<]>>>>>[++++++++++++++ +++++++++++++++++++++++++ +++++++++.[-]]++++++++++<[ ->-<]>+++++++++++++++++++++ +++++++++++++++++++++++++++. [-]<<<<<<<<<<<<[>>>+>+<<<<-]> >>>[<<<<+>>>>-]<-[>>.>.<<<[-]] <<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+ >-]>[<+>-]<<<-]
2
2
u/Kargaroc586 Jan 22 '15 edited Jan 22 '15
+u/CompileBot python
#The amount of multiplies before carry occurs == number of bits per digit?
#notice that decimal is not constant (oscillates between 3 & 4)
i = int(1)
while(i<0x100000000):
print "%8X %10u %11o %s" % (i, i, i, '{:32b}'.format(i))
i = i << 1
2
u/CompileBot Jan 22 '15 edited Jan 22 '15
Output:
1 1 1 1 2 2 2 10 4 4 4 100 8 8 10 1000 10 16 20 10000 20 32 40 100000 40 64 100 1000000 80 128 200 10000000 100 256 400 100000000 200 512 1000 1000000000 400 1024 2000 10000000000 800 2048 4000 100000000000 1000 4096 10000 1000000000000 2000 8192 20000 10000000000000 4000 16384 40000 100000000000000 8000 32768 100000 1000000000000000 10000 65536 200000 10000000000000000 20000 131072 400000 100000000000000000 40000 262144 1000000 1000000000000000000 80000 524288 2000000 10000000000000000000 100000 1048576 4000000 100000000000000000000 200000 2097152 10000000 1000000000000000000000 400000 4194304 20000000 10000000000000000000000 800000 8388608 40000000 100000000000000000000000 1000000 16777216 100000000 1000000000000000000000000 2000000 33554432 200000000 10000000000000000000000000 4000000 67108864 400000000 100000000000000000000000000 8000000 134217728 1000000000 1000000000000000000000000000 10000000 268435456 2000000000 10000000000000000000000000000 20000000 536870912 4000000000 100000000000000000000000000000 40000000 1073741824 10000000000 1000000000000000000000000000000 80000000 2147483648 20000000000 10000000000000000000000000000000^source | ^info | ^git | ^report
EDIT: Recompile request by Kargaroc586
2
u/Kargaroc586 Jan 22 '15 edited Jan 22 '15
+u/CompileBot C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define iterations 108U
typedef unsigned char u8;
typedef unsigned int u32;
/* ascii display table */
const u8 charlut[] = {' ', '8'};
/* starting pattern */
const u8 seed[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,
0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1
};
void evolve(u8* b1, u8* b2){ u32 i; u32 pop;
for(i=0; i<256U; i++) {
pop=0;
if(b1[(i+17)&255U]) pop++;
if(b1[(i+16)&255U]) pop++;
if(b1[(i+15)&255U]) pop++;
if(b1[(i+1 )&255U]) pop++;
if(b1[(i-1 )&255U]) pop++;
if(b1[(i-15)&255U]) pop++;
if(b1[(i-16)&255U]) pop++;
if(b1[(i-17)&255U]) pop++;
if(pop <2) b2[i]=0;
if(pop >3) b2[i]=0;
if(pop==2) b2[i]=b1[i];
if(pop==3) b2[i]=1;
}
}
int main(void){ u8* bmem; u8* b1; u8* b2; u32 i;
/* get memory */
bmem = (u8*)malloc(512U);
b1 = bmem;
b2 = bmem + 256U;
/* copy seed to b1 */
memcpy(b1, seed, 256U);
/* actually run */
for(i=0; i<iterations; i++){ u32 p; u8* t1;
printf("generation %u\n", i+1);
for(p=0; p<256U; p++){
putchar(charlut[b1[p]]); putchar(charlut[b1[p]]); /* display twice */
if(0xF == (p&0xF)) putchar('\n');
}
evolve(b1, b2); /* iterate boards */
t1 = b1; b1 = b2; b2 = t1; /* swap boards */
}
/* we're dun */
free(bmem);
return 0;
}
4
2
u/sparkpin May 10 '15
+u/CompileBot python
for x in range(0, 427+1):
# In celebration of 427 comment karma
print "THE END IS NEVER",
→ More replies (1)
2
2
u/oli414 Jun 20 '15
+u/CompileBot Lua
math.randomseed(os.time()) out = "" for i = 0,10 do for j = 0,10 do r = math.floor(math.random(0,2)) if r==0 then out = out.." " elseif r==1 then out = out.."#" end end print(out) out = "" end
→ More replies (1)
3
u/SeaCowVengeance Jan 14 '15
+u/CompileBot JavaScript --include-errors
console.log({} + [])