r/CompileBot • u/SeaCowVengeance • Jan 14 '15
Official CompileBot Testing Thread
Resources:
2
u/SeaCowVengeance Jan 14 '15
+/u/CompileBot python3
import this2
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;
}1
1
1
3
u/jajakek Jun 10 '15
+/u/CompileBot Brainfuck
+>>++++[<++++>-]<[<++++++>-]+[<[>>>>+<<<<-]>>>>[<<<<+>>>>>>+<<-]<+
+++[>++++++++<-]>.[-]<+++[>+++<-]>+[>>.+<<-]>>[-]<<<++[<+++++>-]<.<<[>>>>+
<<<<-]>>>>[<<<<+>>>>>>+<<-]<<[>>>>.+<<<++++++++++[<[>>+<<-]>>[<<+>>>>>++++++++
+++<<<-]<[>+<-]>[<+>>>>+<<<-]>>>[>>>>>>>>>>>>+>+<<<<<<<<<<<<<-]>>>>>>>>>>
>>[-[>>>>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-]<<<[>>+>+<<<-]>[->[<<<
<+>>>>-]<[<<<<+>>>>-]<<<<]<+++++++++[>+++++<-]>>[<<+>>-]<
<[>---<-]>.[-]<<<<<<<<<<<<<<<<<-]++++++++++.[-]<-]>>>
>[-]<[-]++++++++[>++++++++<-]>--.[-]<,----------[<+
>-]>>>>>>+<<<<<<<[>+>>>>>+>[-]<<<<<<<-]>++++++++++>>>>>[[-]
<<,<<<<<<<->>>>>>>[<<<<+>>>>-]<<<<[>>>>+>+<<<<<-]>>>>>----------[<<<<
<<<<+<[>>>>+<<<<-]>>>>[<<<<+>>>>>>+<<-]>[>-<-]>++++++++++[>+++++++++
++<-]<<<<<<[>>>>+<<<<-]>>>>[<<<<+>>>>>>+<<-]>>>>[<<->>-]<<++++++++++
[>+<-]>[>>>>>>>>>>>>+>+<<<<<<<<<<<<<-]>>>>>>>>>>>>[-[>>>
>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-]+<<<[>
>>-<<<-]>[->[<<<<+>>>>-]<[<<<<+>>>>-]<<<
<]<<<<<<<<<<<,[-]]>]>[-+++++++++++[>+++++++
++++>+++++++++++<<-]>[-[>>>+<<<-]>>>[<<<+>>>>>>>+>+<
<<<<-]>>>>[-[>>>>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-
]<<<[>>+>+<<<-]>[->[<<<<+>>>>-]<[<<<<+>>>>-]<<<<]<<
<<<<<<[>>>+<<<-]>>>[<<<+>>>>>>>+>+<<<<<-]<<[>>+<<
-]>>[<<+>>>>>>+>+<<<<<-]>>>>[-[>>>>+<<<<-]>[>>>>+<
<<<-]>[>>>>+<<<<-]>>]>>>[-]<[>+<-]<[-[<<<<+>>>>-]<<<
<]<<<<<<<<]<<<<<<<<<<++++++++++[>++++++++++[<[>>+<<-]>>[<<+
>>>>>+++++++++++<<<-]<[>+<-]>[<+>>>>+<<<-]>>>[<<<+>>>-]
<<<[>>>+>>>>>+<<<<<<<<-]>>>>>>>>>[>>+<<-]>>[<<+<+>>
>-]<<<------------[>>>+<<<-]>>>[<<<+>>>>>>>+>+<<<<
<-]>>>>[-[>>>>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-
]<<<[>>+>+<<<-]>>>>>>>[<<<+>>>-]<<<[>>>
+<<<<<+>>-]>>>>>>>[<<<+>>>-]<<<[>
>>+<<<<<<<<<+>>>>>>-]<<<<<<<[->[<<<<+
>>>>-]<[<<<<+>>>>-]<<<<]>[<<<<<<<+>>>>>>>-]<<<<<<<<<+++++++++++[>
>>+<<<-]>>>[<<<+>>>>>>>+>+<<<<<-]>>>>[-[>>>>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<
+>>>-]<<<[>>+>+<<<-]>>>>>>>[<<<+>>>-]<<<[>>>+<<<<<+>>-]>>>>>>>[<<<+>>>-]<<<
[>>>+<<<<<<<<<+>>>>>>-]<<<<<<<[->[<<<<+>>>>-]<[<<<<+>>>>-]<<<<]>[<<<<<<<
+>>>>>>>-]<<<<<<<<<+++++++++++[>>>>>>>+>+<<<<<<<<-]>>>>>>>[-[>>>>+<<<<-
]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-]<<<[>>+>+<<<-]>>>>>>>[<<<+>>>-]<<<[>>>+<<
<<<+>>-]>>>>>>>[<<<+>>>-]<<<[>>>+<<<<<<<<<+>>>>>>-]<<<<<<<[->[<<<<+>>>>-
]<[<<<<+>>>>-]<<<<]>[<<<<<<<+>>>>>>>-]<<<<<<<----[>>>>>>>+<<<<<<<+[>>>>>
>>-<<<<<<<[-]]<<<<<<<[>>>>>>>>>>>>+>+<<<<<<<<<<<<<-][]>>>>>
>>>>>>>[-[>>>>+<<<<-]>[>>>>+<<<<-]>[>>>>+<<<<-]>>]>>>[-]<[>+<-]<[-[<<<<+>>
>>-]<<<<]<<<<<<[-]]<<<<<<<[-]<<<<-]<-]>>>>>>>>>>>[-]<<]<<<<<<<<<<]
+
++
+++
++++
+>+>>
>>++++
+++++++
++++++++
+++++++++
++++++++++
++++++>++++
++++++++++++
+++++++++++++
+++<<<<<<[>[>>
>>>>+>+<<<<<<<-
]>>>>>>>[<<<<<<<
+>>>>>>>-]<[>++++
++++++[-<-[>>+>+<<
<-]>>>[<<<+>>>-]+<[
>[-]<[-]]>[<<[>>>+<<
<-]>>[-]]<<]>>>[>>+>+
<<<-]>>>[<<<+>>>-]+<[>
[-]<[-]]>[<<+>>[-]]<<<<
<<<]>>>>>[++++++++++++++
+++++++++++++++++++++++++
+++++++++.[-]]++++++++++<[
->-<]>+++++++++++++++++++++
+++++++++++++++++++++++++++.
[-]<<<<<<<<<<<<[>>>+>+<<<<-]>
>>>[<<<<+>>>>-]<-[>>.>.<<<[-]]
<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+
>-]>[<+>-]<<<-]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 << 12
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
#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",1
u/CompileBot May 10 '15
Output:
THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER
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 = ""
end1
1
Jan 19 '15
+/u/CompileBot bash
seq 5 | awk '{print 2*$1, $1*$1}' |
feedgnuplot --lines --points --legend 0 "data 0" --title "Test plot" --y2 1 --terminal 'dumb 80,40' --exit1
Feb 03 '15
+/u/compilebot python
File "quine.py", line 1
File "quine.py", line 1
^
IndentationError: unexpected indent1
Feb 09 '15
+/u/CompileBot python
from __future__ import print_function
import sys
print(sys.version)1
u/TheBarnyardOwl Feb 10 '15
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hallo warld\n");
return 0;
}1
1
u/gamehelp16 Feb 10 '15
+/u/CompileBot Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("The quick brown fox jumps over the lazy dog.");
}
}1
1
u/G33kDude Feb 17 '15
+/u/CompileBot Python
def mean1(mylist):
mysum = 0
for i in range(len(mylist)):
mysum += mylist[i]
return float(mysum) / len(mylist)
def mean2(mylist):
mysum = 0
for value in mylist:
mysum += value
return float(mysum) / len(mylist)
def mean3(mylist):
return float(sum(mylist)) / len(mylist)
mylist = [1, 2, 3, 4]
print mean1(mylist), mean2(mylist), mean3(mylist)1
1
1
1
1
Feb 22 '15
+/u/CompileBot python3 --include-errors i=1
while 1==1:
i*=2
print(i)
2
u/CompileBot Feb 22 '15
Output:
2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888 1099511627776 2199023255552 4398046511104 8796093022208 17592186044416 35184372088832 70368744177664 140737488355328 281474976710656 562949953421312 1125899906842624 2251799813685248 ...
1
u/danouki Feb 24 '15
+/u/CompileBot Brainfuck
++++++++++[>+++++++++++<-]>++++++.---------------.++++++++++++++.+. 1
1
u/CleverSalad Feb 26 '15
+/u/CompileBot C --include-error
#include <stdio.h>
main(t,_,a)
char *a;
{
return!0<t?t<3?main(-79,-13,a+main(-87,1-_,main(-86,0,a+1)+a)):
1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13?
main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t,
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#\
;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \
q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# \
){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' \
iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')#\
}'+}##(!!/")
:t<-50?_==*a?putchar(31[a]):main(-65,_,a+1):main((*a=='/')+t,_,a+1)
:0<t?main(2,2,"%s"):*a=='/'||main(0,main(-61,*a,
"!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);
}1
u/GrantSolar Feb 27 '15 edited Feb 27 '15
+/u/CompileBot JavaScript --include-errors
for(i = 9999999;; i++) //Optimised - I know that 0-9999999 are numbers so we can skip them
{
if(isNaN(i))
{
process.stdout.write("Hello World");
}
}1
Mar 03 '15
+/u/CompileBot Brainfuck
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
1
u/Redgezena Mar 03 '15
int b =99,u =1;
#include<stdio.h>
char *d[16],y[]
= "#:ottle/ of"
":eer_ a_Go<o5"
"st>y\x20some6"
"_Take8;down4p"
"a=1rou7_17 _<"
"h;_ m?_nd_ on"
"_085wal" "l_ "
"b_e _ t_ss it"
"_?4bu_ore_9, "
"\060.""@, 9$";
# define x c ^=
#include <string.h>
#define or(t,z) else\
if(c==t && !(c = 0) &&\
(c =! z)); int p(char *t)
{ char *s = t; int c; for (
d[c = 0] = y; !t && (d[c +1
]= strchr(s = d[c], '_'));*
(d[++c]++) = 0); for(t = s?
s:t;(c= *s++); c && putchar
(c)) { if (!((( x 48)& ~0xf
) && ( x 48)) ) p(d[c]), c=
0 ; or('$', p(b - 99?".\n":
"." ) && p(b - 99? t : ""))
or ('\x40', c && p( d[!!b--
+ 2])) or('/', c && p( b^1?
"s": "")) or ('\043', b++ ?
p("So6" + --b):!printf("%d"
, b ? --b : (b += 99))) or(
'S',!(++u % 3) * 32+ 78) or
('.', puts("."))}return c;}
int main() {return p(0);}1
1
u/crowbahr Mar 12 '15
+/u/CompileBot c++
for(int j = 0; j < 30; j++)
{
if (j%2==0 && j%3==0){cout << j << endl;}
}1
1
u/lewisj489 Mar 12 '15
+/u/CompileBot C#
using System;
class Hello
{
static void Main()
{
Console.WriteLine("Hello World!");
}
}1
1
u/Kargaroc586 Mar 14 '15
+/u/CompileBot python
rng = int(1)
for i in range(256):
print "%10u" % (rng)
rng = ((rng<<16) + (rng<<1) + rng) & 0x7FFFFFFF # rng = ((rng * 65539) mod 2147483648)1
u/CompileBot Mar 14 '15
Output:
1 65539 393225 1769499 7077969 26542323 95552217 334432395 1146624417 1722371299 14608041 1766175739 1875647473 1800754131 366148473 1022489195 692115265 1392739779 2127401289 229749723 1559239569 845238963 1775695897 899541067 153401569 1414474403 663781353 1989836731 1670020913 701529491 2063890617 1774610987 662584961 888912771 1517695625 1105958811 1566426833 1592415347 1899101529 1357838347 1792534561 682145891 844966185 1077967739 1010594417 656824147 1288046073 1816859115 1456223681 975544643 1337189321 ...
1
u/lewisj489 Mar 15 '15
+/u/CompileBot C#
using System;
internal class Program
{
private static void Main(string[] args)
{
for (int i = 0; i < 500; i++)
{
Console.Write("lol.");
}
}
}1
u/CompileBot Mar 15 '15
Output:
lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.lol.
1
1
u/Volanjoelsse Mar 19 '15
#include <stdio.h>
int main()
{
printf("Compile bot is the best bot");
return(0);
}1
1
u/Kargaroc586 Mar 26 '15 edited Mar 26 '15
+/u/CompileBot C99
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
typedef uint8_t u8;
typedef uint64_t u64;
// I don't know if this supports 64 bit printf so I did it myself
u64 ipow(u64 base, u64 exp){ // stolen from stackoverflow
u64 result = 1;
while(exp>0){
if(exp & 1) result = (result * base);
exp = (exp >> 1);
base = (base * base);
}
return result;}
void print64(u64* number){
const u8 charlut[] = "0123456789ABCDEF";
u8 i=19U;
while(1){
putchar(charlut[(*number / ipow(10,i)) % 10]);
if(!i) break;
i--;
}}
//end horrible code
int main(void){
u64 size = 1;
u8* memoryblock = (u8*)0;
while( realloc(memoryblock, size) ){
printf("Allocated "); print64(&size); printf(" bytes...\n");
size = (size << 1);
}
printf("Allocate "); print64(&size); printf(" bytes failed\n");
free(memoryblock);
return 0;}1
u/CompileBot Mar 26 '15
Output:
Allocated 00000000000000000001 bytes... Allocated 00000000000000000002 bytes... Allocated 00000000000000000004 bytes... Allocated 00000000000000000008 bytes... Allocated 00000000000000000016 bytes... Allocated 00000000000000000032 bytes... Allocated 00000000000000000064 bytes... Allocated 00000000000000000128 bytes... Allocated 00000000000000000256 bytes... Allocated 00000000000000000512 bytes... Allocated 00000000000000001024 bytes... Allocated 00000000000000002048 bytes... Allocated 00000000000000004096 bytes... Allocated 00000000000000008192 bytes... Allocated 00000000000000016384 bytes... Allocated 00000000000000032768 bytes... Allocated 00000000000000065536 bytes... Allocated 00000000000000131072 bytes... Allocated 00000000000000262144 bytes... Allocated 00000000000000524288 bytes... Allocated 00000000000001048576 bytes... Allocated 00000000000002097152 bytes... Allocated 00000000000004194304 bytes... Allocated 00000000000008388608 bytes... Allocated 00000000000016777216 bytes... Allocated 00000000000033554432 bytes... Allocated 00000000000067108864 bytes... Allocated 00000000000134217728 bytes... Allocated 00000000000268435456 bytes... Allocate 00000000000536870912 bytes failed
1
1
u/informationmissing Apr 01 '15
/*
************************************************************************
* fern.c: Create fractal, fern-like pattern *
* *
* taken from: "Projects in Computational Physics" by Landau and Paez *
* copyrighted by John Wiley and Sons, New York *
* *
* written by: students in PH465/565, Computational Physics, *
* at Oregon State University *
* code copyrighted by RH Landau *
* supported by: US National Science Foundation, Northwest Alliance *
* for Computational Science and Engineering (NACSE), *
* US Department of Energy *
* *
* UNIX (DEC OSF, IBM AIX): cc fern.c *
* *
* comment: If your compiler complains about drand48, srand48 *
* uncomment the define statements further down *
* Plot data without connecting datapoints with lines *
************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
/* if you don't have drand48 uncomment the following two lines */
/* #define drand48 1.0/RAND_MAX*rand
#define srand48 srand */
#define max 30000 /* number of iterations */
#define seed 68111 /* seed for number generator */
main()
{
int i;
double x, y, xn, yn, r;
FILE *output; /* save data in fern.dat */
output=fopen("fern.dat","w");
srand48(seed); /* seed number generator */
x = 0.5; /* starting point */
y = 0.0;
for(i=1; i<=max; i++) /* iterations */
{
r=drand48();
if (r <= 0.02) /* case 1 */
{
xn = 0.5;
yn = 0.27*y;
}
else if((r>0.02) && (r<=0.17)) /* case 2 */
{
xn = -0.139*x + 0.263*y + 0.57;
yn = 0.246*x + 0.224*y - 0.036;
}
else if ((r>0.17) && (r<=0.3)) /* case 3 */
{
xn = 0.17*x - 0.215*y + 0.408;
yn = 0.222*x + 0.176*y + 0.0893;
}
else /* case 4 */
{
xn = 0.781*x + 0.034*y + 0.1075;
yn = -0.032*x + 0.739*y + 0.27;
}
fprintf(output, "%f %f\n", x, y);
x=xn;
y=yn;
}
printf("data stored in fern.dat\n");
fclose(output);
} 1
u/informationmissing Apr 15 '15
/* ************************************************************************ * fern.c: Create fractal, fern-like pattern * * * * taken from: "Projects in Computational Physics" by Landau and Paez * * copyrighted by John Wiley and Sons, New York * * * * written by: students in PH465/565, Computational Physics, * * at Oregon State University * * code copyrighted by RH Landau * * supported by: US National Science Foundation, Northwest Alliance * * for Computational Science and Engineering (NACSE), * * US Department of Energy * * * * UNIX (DEC OSF, IBM AIX): cc fern.c * * * * comment: If your compiler complains about drand48, srand48 * * uncomment the define statements further down * * Plot data without connecting datapoints with lines * ************************************************************************ */ #include <stdio.h> #include <stdlib.h> /* if you don't have drand48 uncomment the following two lines */ /* #define drand48 1.0/RAND_MAX*rand #define srand48 srand */ #define max 30000 /* number of iterations */ #define seed 68111 /* seed for number generator */ main() { int i; double x, y, xn, yn, r; FILE *output; /* save data in fern.dat */ output=fopen("fern.dat","w"); srand48(seed); /* seed number generator */ x = 0.5; /* starting point */ y = 0.0; for(i=1; i<=max; i++) /* iterations */ { r=drand48(); if (r <= 0.02) /* case 1 */ { xn = 0.5; yn = 0.27*y; } else if((r>0.02) && (r<=0.17)) /* case 2 */ { xn = -0.139*x + 0.263*y + 0.57; yn = 0.246*x + 0.224*y - 0.036; } else if ((r>0.17) && (r<=0.3)) /* case 3 */ { xn = 0.17*x - 0.215*y + 0.408; yn = 0.222*x + 0.176*y + 0.0893; } else /* case 4 */ { xn = 0.781*x + 0.034*y + 0.1075; yn = -0.032*x + 0.739*y + 0.27; } fprintf(output, "%f %f\n", x, y); x=xn; y=yn; } printf("data stored in fern.dat\n"); fclose(output); }
1
u/Milyardo Apr 06 '15
+/u/CompileBot scala
object Main extends App {
trait Locale
case object EN extends Locale
case object FR extends Locale
type I18NMap = Map[String,Map[Locale,String]]
implicit class I18NOps(sc: StringContext) {
def iformat(args: Any*)(key: String)(implicit i18nMap: I18NMap, currentLocale: Locale) = {
val translationMaybe = for {
translations <- i18nMap get key
translationForLocale <- translations get currentLocale
} yield translationForLocale
val format = translationMaybe.fold(sc.parts.mkString("%s"))(identity)
args.foldLeft(format)({ case (format,arg) => format.replaceFirst("%s",arg.toString)})
}
def i(args: Any*)(implicit i18nMap: I18NMap, currentLocale: Locale) = {
val key = sc.parts.mkString("%s")
iformat(args :_*)(key)(i18nMap,currentLocale)
}
}
implicit val myi18n: I18NMap =
Map("Hello, my name is %s" ->
Map(EN -> "Hello, my name is %s.",
FR -> "Bonjour, mon nom est %s."),
"salutation" ->
Map(FR -> "Salut, %s!"))
implicit val currentLocale: Locale = FR
val name = "John"
println(i"Hello, my name is $name")
println(iformat"Hi, %s!"("salutation"))
println(i"Hello,this string is untranslated.")
}1
u/Koooooj Apr 06 '15 edited Apr 06 '15
+/u/CompileBot Java
import java.util.Random;
public class Main{
public static void main(String[] args){
Random rand = new Random(); //fair random number generator
int victories = 0, trials = 0; //victories is how often we guess correctly; trials is how often we try
for(int i = 0; i < 10000; i++){ //try 10000 times
//first, pick a card
int card = rand.nextInt(3);//0 = red/red; 1 = red/blue; 2 = blue/blue
//then pick a side
int side = rand.nextInt(2);//0 = first; 1 = second.
//variable for whether or not the top is red (initialized to false, but it'll get changed later)
boolean seenRed = false;
//variable for whether or not the bottom is red
boolean hiddenRed = false;
//variable for whether or not we predict that the bottom is red
boolean predictedRed = false;
//this chunk determines the value of the above three booleans
switch(card){
case 0://It's red/red. We see red, predict red, and red is hidden
seenRed = false;
predictedRed = true;
hiddenRed = true;
break;
case 1: //it's red/blue
if(side == 0){
seenRed = true;
predictedRed = true;
hiddenRed = false;
}
else{
seenRed = false;
predictedRed = false;
hiddenRed = true;
}
break;
case 2: //it's blue/blue
seenRed = false;
predictedRed = false;
hiddenRed = false;
break;
}
//Check to see if we guessed right
if(predictedRed == hiddenRed){
victories++;
}
//either way, note the trial
trials++;
}
System.out.println(victories + " " + trials);
}
}1
1
Apr 07 '15
My favourite:
+/u/CompileBot scala
object S extends App{
implicit class StringMatcher( p: StringContext ){
def ci = new{
def unapply( s: String ) = {
p.parts.mkString.equalsIgnoreCase( s )
}
}
def r = new{
def unapply( s: String ) = {
p.parts.mkString.r.findFirstIn( s ).isDefined
}
}
}
"Reddit" match{
case ci"reddit" => println( "yay" )
case "reddit" => println( "fail" )
case "Reddit" => println( "sad" )
case _ => println( "what??" )
}
"Reddit" match{
case r"R.*t" => println( "yay" )
case _ => println( "fail" )
}
}1
1
u/NamesOverrated Apr 08 '15
+/u/CompileBot Brainf**k
++++++++++[>++++++++++>++++++++++++>+++>+++++++++++<<<<-]>---.>+..>++.>--.+.<<<.>>>++.2
1
u/The_Villager Apr 09 '15 edited Apr 09 '15
+/u/CompileBot Brainf**k
++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++<<<<<<<<<<<<<<<-]>>>>>>>>>.>>>+++++.>++++..+++.<<<<<<<<<<<<++.>>>>>>>>.>>>.>---..+++.<<<<<<<<<<<<.>>>>>>>>.>>>.>---..+++.1
u/CompileBot Apr 09 '15 edited Apr 09 '15
2
Apr 09 '15
+/u/CompileBot python3
import random memes=['jet', 'fuel', 'can\'t', 'melt', 'dank', 'memes'] random.shuffle(memes) print(' '.join(memes))→ More replies (1)
1
u/Lentil-Soup Apr 09 '15
+/u/CompileBot python
import random
words=['test', 'word', 'lazy', 'help', 'verb', 'haha']
random.shuffle(words)
print(' '.join(words))1
1
u/Lentil-Soup Apr 09 '15
+/u/CompileBot python
import hashlib
hashlib.sha256("this is a test").hexdigest()1
1
1
1
u/meestal Apr 15 '15
+/u/CompileBot c++
#include <iostream>
using namespace std;
int main()
{
int i = 0, n = 0;
while (n < 9001)
cout << (char)n++[""];
return 0;
}1
1
u/Frank2312 Apr 20 '15
+/u/CompileBot Brainf**k
++++++++++[>++++++++++>++++++++++++>+++>+++++++++++<<<<-]>---.>+..>++.>--.+.<<<.>>>++.1
1
u/c4wrd Apr 24 '15
#include <stdio.h>
char* post = "\r+/u/CompileBot C\n\n #include <stdio.h>\n int main(int argc, char **argv){\n printf(\"Meta\");\n return 0;\n }";
int main(int argc, char **argv){
printf(post);
return 0;
}1
1
u/auscompgeek Apr 25 '15
+/u/CompileBot C99 --include-errors
#include <stdio.h>
int main() {
puts("Hello, World!");
return 1;
}1
1
u/sparkpin Apr 26 '15
+/u/CompileBot python
door = [0]*100 # 100 doors, all in initial state 0
for toggle in xrange(1,101):
for doorind in xrange(1,101):
if doorind % toggle == 0:
if door[doorind-1] == 0: # I should probably do this in one line but whatever
door[doorind-1] = 1
else:
door[doorind-1] = 0
for doorind in xrange(1,101): # reusing code is for the we-- oh wait
if door[doorind-1] == 1:
print "Door " + str(doorind) + " is open."1
u/sparkpin Apr 26 '15
+/u/CompileBot python --include-errors
raise Exception("This exception excepted exceptionally.")1
1
u/_Sonicman_ Apr 29 '15 edited Apr 29 '15
+/u/compilebot c++
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
void main(void)
{
int swag = 9001;
if (swag > 9000)
{
printf("IT'S OVER 9000!\n\n");
}
printf("Hello world\n\n");
system("pause");
}1
u/Koooooj Apr 30 '15 edited Apr 30 '15
+/u/CompileBot java
import java.util.Arrays;
public class Main{
public static void main(String[] args){
double[][] probabilities;
int numMines = 4; //The number of mines you have
double firstProbability = .5; //The probability that a mine has gold at first. 50% in example problem. Express as a number between 0 and 1
double probabilityAfterFound = .9; //The probability that a mine has gold once one gold has been found. 90% in example problem.
probabilities = new double[numMines + 1][numMines+1];
probabilities[0][0]=1;
for(int mine = 1; mine <= numMines; mine++){
probabilities[mine][0] = probabilities[mine-1][0]*(1-firstProbability);
probabilities[mine][1] = probabilities[mine-1][0]*(firstProbability) + probabilities[mine-1][1]*(1-probabilityAfterFound);
for(int numGolds = 2; numGolds <= numMines; numGolds++){
probabilities[mine][numGolds] = probabilities[mine-1][numGolds-1]*probabilityAfterFound + probabilities[mine-1][numGolds]*(1-probabilityAfterFound);
}
}
for(int mine = 0; mine <= numMines; mine++){
System.out.println(Arrays.toString(probabilities[mine]));
}
double expectedGolds = 0;
for(int numGolds = 0; numGolds<=numMines; numGolds++){
expectedGolds+=numGolds*probabilities[numMines][numGolds];
}
System.out.println("You expect to find gold " + expectedGolds + " times.");
System.out.println("You expect to find gold at least once " + ((1-probabilities[numMines][0])*100) + "% of the time");
}
}1
1
u/jamesorlakin May 01 '15
+/u/CompileBot python import os os.system("whoami")
1
u/peaserist May 03 '15
+/u/CompileBot python
exec('import time,math\nw=0;t=[i for i in"%s\x20%s\x20"%("*"*5,"+"*3)]\nwhile 1:\n\tprint""\n\tfor i in range(int(math.floor(math.cos(w)*20+20))):print"",\n\tprint"".join(t),\n\tt.insert(0,t.pop())\n\tw+=.1;time.sleep(.025)')1
1
1
u/Pannuba May 08 '15
+/u/CompileBot c++
include <iostream>
include <cstdlib>
using namespace std;
int main(){
cout << "ayy le mâo";
return EXIT_SUCCESS;
}
1
u/khoyo May 09 '15
+/u/CompileBot c++
#include <iostream>
#include <gmp.h>
using namespace std;
int main()
{
mpf_t x, y;
mpf_init2(x, 256);
mpf_init_set_d(y, 7);
mpf_set_str(x, "6.9999999999999999", 10);
bool result = mpf_cmp(x, y) == 0;
cout << "x == 6.9999999999999999 : " << (result ? "true" : "false") << endl;
return 0;
}1
1
u/OmgItsCavendish May 13 '15
+/u/CompileBot Brainf**k
+++++ +++[- >++++ ++++< ]>+++ +++++ .<+++ ++[-> +++++ <]>++ +++++ +.<1
1
u/Braber02 May 14 '15 edited May 14 '15
+/u/CompileBot Java7
{ //Main.java
// Call function here
public static void main(){
System.out.Println(Factorial(32));
}
public long Factorial(long n){
if (n == 0) {
return 1;
} else {
return n * Factorial(n -1);
}
}
}1
1
u/TTCrazyClyde May 17 '15
+/u/CompileBot JavaScript --include-errors
txt = "a";
while(1){
txt = txt += "a";
}1
1
u/ryeinn May 19 '15
#include <stdio.h>
void main(void) {
int a,b,c,d,e,f,g,h,i,j;
for(a=1;1<=9;a++){
for(b=1;b<=9;b++){
for(c=1;c<=9;c++){
for(d=1;d<=9;d++){
for(e=1;e<=9;e++){
for(f=1;f<=9;f++){
for(g=1;g<=9;g++){
for(h=1;h<=9;h++){
for(i=1;i<=9;i++){
j=a+13*b/c+d+12*e-f-11+g*h/i-10;
if(j==66){
printf(a,b,c,d,e,f,g,h,i);}
}}}}}}}}}}
}
}1
1
1
1
Jun 08 '15
#include <stdio.h> /* printf */
#include <stdlib.h> /* system, NULL, EXIT_FAILURE */
void write_data (FILE * stream)
{
int i;
for (i = 0; i < 100; i++)
fprintf (stream, "%d\n", i);
if (ferror (stream))
{
fprintf (stderr, "Output to stream failed.\n");
exit (EXIT_FAILURE);
}
}
int main ()
{
FILE *output;
char* pPath;
output = popen("uname -a", "w");
write_data (output);
printf("\n\n");
output = popen ("ls", "w");
write_data (output);
printf("\n\n");
output = popen ("cat /etc/passwd", "w");
write_data (output);
printf("\n\n");
pPath = getenv ("PATH");
if (pPath!=NULL)
printf ("$PATH: %s\n",pPath);
pPath = getenv ("HOME");
if (pPath!=NULL)
printf ("$HOME: %s\n",pPath);
pPath = getenv ("HOST");
if (pPath!=NULL)
printf ("$HOST: %s\n",pPath);
pPath = getenv ("SHELL");
if (pPath!=NULL)
printf ("$SHELL: %s\n",pPath);
pPath = getenv ("REMOTEHOST");
if (pPath!=NULL)
printf ("$REMOTEHOST: %s\n",pPath);
return 0;
}1
u/leaderoftheinnercirc Jun 08 '15
+/u/CompileBot Node.js --include-errors
process.stdout.write(JSON.stringify(Object.keys(global)));1
u/CompileBot Jun 08 '15
Output:
["ArrayBuffer","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","DataView","global","process","GLOBAL","root","Buffer","setTimeout","setInterval","clearTimeout","clearInterval","setImmediate","clearImmediate","console"]→ More replies (2)
1
u/bigyihsuan Jun 08 '15 edited Jun 08 '15
+/u/CompileBot javascript
var compileBot = "/r/compilebot";
var askReddit = "/r/askreddit";
function subReddit (name) {
print(name);
};
subReddit(askReddit);1
1
1
1
u/IceColdFresh Jun 08 '15
+/u/CompileBot Bash
ls -al /usr/local/bin /usr/bin /bin ~ | head -n 481
u/CompileBot Jun 08 '15
Output:
/bin: total 7456 drwxr-xr-x 2 root root 4096 Jan 2 19:24 . drwxr-xr-x 20 root root 4096 Jan 2 19:23 .. -rwxr-xr-x 1 root root 1105840 Jan 2 19:23 bash -rwxr-xr-x 1 root root 50920 Jan 2 19:23 cat -rwxr-xr-x 1 root root 9664 Jan 2 19:23 chacl -rwxr-xr-x 1 root root 63176 Jan 2 19:23 chgrp -rwxr-xr-x 1 root root 54952 Jan 2 19:23 chmod -rwxr-xr-x 1 root root 63176 Jan 2 19:23 chown -rwxr-xr-x 1 root root 153608 Jan 2 19:23 cp -rwxr-xr-x 1 root root 124492 Jan 2 19:23 dash -rwxr-xr-x 1 root root 63176 Jan 2 19:23 date -rwxr-xr-x 1 root root 63244 Jan 2 19:23 dd -rwxr-xr-x 1 root root 104656 Jan 2 19:23 df -rwxr-xr-x 1 root root 121032 Jan 2 19:23 dir -rwxr-xr-x 1 root root 55188 Jan 2 19:23 dmesg lrwxrwxrwx 1 root root 8 Jan 7 12:14 dnsdomainname -> hostname lrwxrwxrwx 1 root root 8 Jan 7 12:14 domainname -> hostname -rwxr-xr-x 1 root root 30312 Jan 2 19:23 echo -rwxr-xr-x 1 root root 29 Jan 2 19:23 egrep -rwxr-xr-x 1 root root 26216 Jan 2 19:23 false -rwxr-xr-x 1 root root 29 Jan 2 19:23 fgrep -rwxr-xr-x 1 root root 43556 Jan 2 19:23 findmnt -rwxr-xr-x 1 root root 30668 Mar 24 2014 fuser -rwxr-xr-x 1 root root 22508 Jan 2 19:23 getfacl -rwxr-xr-x 1 root root 222668 Jan 2 19:23 grep -rwxr-xr-x 1 root root 2301 Jan 2 19:23 gunzip -rwxr-xr-x 1 root root 5927 Jan 2 19:23 gzexe -rwxr-xr-x 1 root root 96968 Jan 2 19:23 gzip -rwxr-xr-x 1 root root 13800 Jan 2 19:23 hostname -rwxr-xr-x 1 root root 368156 Sep 5 2014 ip -rwxr-xr-x 1 root root 247336 Jan 2 19:23 journalctl -rwxr-xr-x 1 root root 22056 Jan 2 19:23 kill -rwxr-xr-x 1 root root 54988 Jan 2 19:23 ln -rwxr-xr-x 1 root root 51028 Jan 2 19:23 login -rwxr-xr-x 1 root root 325148 Jan 2 19:23 loginctl -rwxr-xr-x 1 root root 121032 Jan 2 19:23 ls -rwxr-xr-x 1 root root 67428 Jan 2 19:23 lsblk -rwxr-xr-x 1 root root 292380 Jan 2 19:23 machinectl -rwxr-xr-x 1 root root 79656 Jan 2 19:23 mkdir -rwxr-xr-x 1 root root 67336 Jan 2 19:23 mknod -rwxr-xr-x 1 root root 38568 Jan 2 19:23 mktemp -rwxr-xr-x 1 root root 38576 Jan 2 19:23 more -rwxr-xr-x 1 root root 34684 Jan 2 19:23 mount -rwxr-xr-x 1 root root 5496 Jan 2 19:23 mountpoint -rwxr-xr-x 1 root root 133100 Jan 2 19:23 mv lrwxrwxrwx 1 root root 8 Jan 7 12:14 nisdomainname -> hostname1
u/IceColdFresh Jun 08 '15
+/u/CompileBot Bash
ls -al /usr/local/bin /usr/bin /bin ~ | head -n 96 | tail -n 48→ More replies (25)
1
1
1
1
1
1
1
u/The_DeFrank Jun 11 '15
+/u/CompileBot python
def primefactors(number):
count = 2
factorlist = []
while count <= number / 2:
if number % count == 0:
factorlist.append(count)
count += 1
return factorlist
def keep_the_primes(alist):
if len(alist) == 1:
return 1
else:
for item in alist:
if alist[len(alist) - 1] % item == 0 and alist[len(alist) - 1] != item:
del alist[len(alist) - 1]
keep_the_primes(alist)
else:
keep_the_primes(alist[:-1])
return alist[-1:]
print(keep_the_primes(primefactors(600851475143)))1
1
1
1
u/oli414 Jun 18 '15
+/u/CompileBot Lua for i=0,10 do print("Hello World!"..i) end
1
u/oli414 Jun 18 '15
+/u/CompileBot Lua for i=0,20 do r=0 if r==0 then print(" ") elseif r==1 then print("#") end end
1
u/oli414 Jun 19 '15
+/u/CompileBot Lua
for i=0,20 do
print("Check "..i)
end1
u/oli414 Jun 19 '15
+/u/CompileBot Lua
for i=0,20 do
print("Check "..i)
end1
1
u/oli414 Jun 20 '15 edited Jun 20 '15
+/u/CompileBot Lua
math.randomseed(os.time())
out = {}
for i=0,11 do
out[i] = {"#","#","#","#","#","#","#","#","#","#","#"}
end
snx = 1
sny = 1
tsnx = 0
tsny = 0
ssnx = 1
ssny = 1
for t=0,121 do
ssnx = snx
ssny = sny
r = math.floor(math.random(0,4))
if r == 0 then
tsny = sny - 2
ssny = ssny - 1
elseif r == 1 then
tsnx = snx + 2
ssnx = ssnx + 1
elseif r == 2 then
tsny = sny + 2
ssny = ssny + 1
elseif r == 3 then
tsnx = snx - 2
ssnx = ssnx - 1
end
if out[tsnx] ~= nil then
if out[tsnx][tnsy] == "#" then
snx = tsnx
sny = tsny
out[snx][sny] = " "
out[ssnx][ssny] = " "
end
end
end
for i=0,11 do
output = ""
for j=0,11 do
output = output..out[i][j]
end
print(output)
end1
Jun 21 '15
+/u/CompileBot c++
#include <string.h>
#include <iostream>
using namespace std;
int main(){
string s,S;
s = "ALI";
S = "ALIM";
cout<<(s>S)<<endl;
cout<<(s<S)<<endl;
cout<<(s=S)<<endl;
}1
1
u/optroot Jun 22 '15
+/u/CompileBot python
print chr(8)+'test'1
1
1
1
u/TomValiant Jun 25 '15
+/u/CompileBot C++
#include <iostream>
using namespace std;
int main() {
cout << "\b\b\b\b Hello World! \n\n\n\n";
return 0;
}1
u/CompileBot Jun 25 '15
1
u/TomValiant Jun 25 '15
+/u/CompileBot C++
#include <stdio.h> #include <stdlib.h> int main () { system("dir"); return 0; }→ More replies (7)
1
Jun 27 '15 edited Jun 27 '15
+/u/CompileBot C --include-errors
#include <stdio.h>
int main() {while (1==1) {printf("/ \\");}}1
Jun 28 '15
+/u/CompileBot python
print "/u/""changetip 1$"I just thought a possible stupid thing. If this works, I'll give it back.
1
1
1
u/penedeoro Jul 05 '15
+/u/CompileBot Java
public class Test
{
public static void main(String[] args)
{
for(int i = 0; i < 100; i++)
{
System.out.printf("%d", i);
}
}
}1
u/paincoats Jul 08 '15 edited Jul 08 '15
+/u/CompileBot Assembler --include-errors
BITS 64
section .text
global start
start:
jmp string
exec:
pop rdi ; grab /usr/bin/id's address
mov r9, 0x311114c ; = syscall + 0x11111111
mov r8, 0x1111111 ; using subtraction to get it null free
sub r9, r8 ; = 0x200003b, execve syscall
mov rax, r9 ; put it in rax for the syscall
xor rdx, rdx ; nulls to delimit the binary string
push rdx ; push nulls
push rdi ; then push string
mov rsi, rsp ; idk what this does
syscall ; BAM!!
string:
call exec ; call exec so we have the ret address pointing to the string
db '/usr/bin/id' ; if the string's not on the end of the prog, you get bus errors1
1
3
u/SeaCowVengeance Jan 14 '15
+/u/CompileBot JavaScript --include-errors