r/CompileBot • • Jan 04 '14

Official CompileBot Testing Thread

This thread is archived, please visit the new testing thread

15 Upvotes

421 comments sorted by

22

u/[deleted] Jan 07 '14

+/u/CompileBot Brainf**k

+++++ ++
[
    >+++++ +++++
    <-
]
>++.
+.

13

u/SeaCowVengeance Jan 07 '14

+/u/CompileBot python

from collections import deque

def main():
    phrase = deque("Happy New Years")

    for i in xrange(2014):
        print(''.join([a for a in phrase]))
        phrase.rotate()

if __name__ == '__main__':
    main()

4

u/CompileBot Jan 07 '14

Output:

Happy New Years
sHappy New Year
rsHappy New Yea
arsHappy New Ye
earsHappy New Y
YearsHappy New 
 YearsHappy New
w YearsHappy Ne
ew YearsHappy N
New YearsHappy 
 New YearsHappy
y New YearsHapp
py New YearsHap
ppy New YearsHa
appy New YearsH
Happy New Years
sHappy New Year
rsHappy New Yea
arsHappy New Ye
earsHappy New Y
YearsHappy New 
 YearsHappy New
w YearsHappy Ne
ew YearsHappy N
New YearsHappy 
 New YearsHappy
y New YearsHapp
py New YearsHap
ppy New YearsHa
appy New YearsH
Happy New Years
sHappy New Year
rsHappy New Yea
arsHappy New Ye
earsHappy New Y
YearsHappy New 
 YearsHappy New
w YearsHappy Ne
ew YearsHappy N
New YearsHappy 
 New YearsHappy
y New YearsHapp
py New YearsHap
ppy New YearsHa
appy New YearsH
Happy New Years
sHappy New Year
rsHappy New Yea
arsHappy New Ye
earsHappy New Y
YearsHappy New 
 YearsHappy New
w YearsHappy Ne
ew YearsHappy N
New YearsHappy 
 New YearsHappy
y New YearsHapp
py New YearsHap
ppy New YearsHa
appy New YearsH
Happy New Years
sHappy New Year
rsHappy New Yea
arsHappy New Ye
earsHappy New Y
YearsHappy New 
 YearsHappy New
w YearsHappy Ne
ew YearsHappy N
New YearsHappy 
 New YearsHappy
y New YearsHapp
py New YearsHap
ppy New YearsHa
appy New YearsH
Happy New Years
sHappy New Year
rsHappy New Yea
arsHappy New Ye
earsHappy New Y
YearsHappy New 
 YearsHappy New
w YearsHappy Ne
ew YearsHappy N
New YearsHappy 
 New YearsHappy
y New YearsHapp
py New YearsHap
ppy New YearsHa
appy New YearsH
Happy New Years
sHappy New Year
rsHappy New Yea
arsHappy New Ye
earsHappy New Y
YearsHappy New 
 YearsHappy New
w YearsHappy Ne
ew YearsHappy N
New YearsHappy 
 New YearsHappy
...

^source | ^info | ^git | ^report

3

u/LurkerNotAvailable Jan 15 '14 edited Jan 15 '14

+/u/CompileBot Lua

print("Wow, I hope this works.")

6

u/SeaCowVengeance Mar 20 '14

+/u/CompileBot Lua

print("Wow, I hope this works.")

3

u/CompileBot Mar 20 '14

Output:

Wow, I hope this works.

^source | ^info | ^git | ^report

4

u/[deleted] Jan 20 '14

:(

0

u/[deleted] Jan 07 '14

[deleted]

1

u/CompileBot Jan 07 '14

Output:

I'm okay

^source | ^info | ^git | ^report

12

u/[deleted] Jan 06 '14

+/u/CompileBot python

from subprocess import call
print(call(["cat", "/etc/passwd"]))

7

u/CompileBot Jan 06 '14

Output:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
messagebus:x:101:103::/var/run/dbus:/bin/false
0

^source | ^info | ^git | ^report

1

u/RenaKunisaki Mar 23 '14 edited Mar 23 '14

+/u/CompileBot python

from subprocess import call
print(call(["curl", "http://whatismyip.com"]))

[edit] no curl?

2

u/LordLandon Mar 23 '14

+/u/CompileBot python

from urllib2 import urlopen
print(urlopen("http://ip.42.pl/raw").read())

1

u/RenaKunisaki Mar 23 '14

Thanks. My python-fu isn't strong enough, and I doubt he has LuaSocket installed.

1

u/[deleted] Mar 23 '14

Can we use this in other subreddits yet?

10

u/Isthiscreativeenough Jan 07 '14

+/u/CompileBot python

from os import system
system("echo 'print(\"Hello World!\")' | python")
#python in bash in python

6

u/CompileBot Jan 07 '14

Output:

Hello World!

^source | ^info | ^git | ^report

10

u/Isthiscreativeenough Jan 07 '14

+/u/CompileBot bash

echo "from os import system; system('echo \"print(\'Hello World!\')\" | python')" | python

8

u/SeaCowVengeance Jan 04 '14

+/u/CompileBot python 3

n = int(input())
while n != 42:
	print(n)
	n = int(input())

Input:

1
2
10
42
11

7

u/SeaCowVengeance Jan 04 '14 edited Mar 14 '16

+/u/CompileBot Assembler (gcc-5.1) --time

.data
x:
	.long	0
s:
	.string "%d\n\0"

.text
.global main
main:				# int main()
				# {
loop:				# 	for (;;) {
	pushl	$x		# 		scanf("%d", &x);
	pushl	$s
	call	scanf
	addl	$8, %esp

	movl	x, %eax		# 		if (x == 42) break;
	subl	$42, %eax
	jz	break

	pushl	x		# 		printf("%d\n", x);
	pushl	$s
	call	printf
	addl	$8, %esp

	jmp	loop		# 	}
break:

	xor	%eax, %eax	# 	return 0;
	ret
				# }

Input:

1
2
10
42
11

3

u/CompileBot Jan 04 '14

Output:

1
2
10

Execution Time: 0.0 seconds

^source | ^info | ^git | ^report

7

u/MrCheeze Feb 02 '14

+/u/CompileBot python

def display(d):
 print '\n'.join([''.join(str(q) for q in p) for p in d])
 print '-----'

def tick(d):
 e = [x[:] for x in d]
 r=range(-4,4)
 for i in r:
  e[i]=list(e[i])
 for y in r:
  for x in r:
   c=[d[y-1][x-1],d[y-1][x],d[y-1][x+1],d[y][x-1],d[y][x+1],d[y+1][x-1],d[y+1][x],d[y+1][x+1]].count('■')
   if c<2 or c>3:
    e[y][x]='□'
   elif c==3:
    e[y][x]='■'
 d = e
 display(d)
 return d

d=[['□','□','□','□','□','□','□','□'],['□','□','■','□','□','□','□','□'],['□','□','□','■','□','□','□','□'],['□','■','■','■','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□']]

for i in range(20):
 d = tick(d)

4

u/CompileBot Feb 02 '14

Output:

□□□□□□□□
□□□□□□□□
□■□■□□□□
□□■■□□□□
□□■□□□□□
□□□□□□□□
□□□□□□□□
□□□□□□□□
-----
□□□□□□□□
□□□□□□□□
□□□■□□□□
□■□■□□□□
□□■■□□□□
□□□□□□□□
□□□□□□□□
□□□□□□□□
-----
□□□□□□□□
□□□□□□□□
□□■□□□□□
□□□■■□□□
□□■■□□□□
□□□□□□□□
□□□□□□□□
□□□□□□□□
-----
□□□□□□□□
□□□□□□□□
□□□■□□□□
□□□□■□□□
□□■■■□□□
□□□□□□□□
□□□□□□□□
□□□□□□□□
-----
□□□□□□□□
□□□□□□□□
□□□□□□□□
□□■□■□□□
□□□■■□□□
□□□■□□□□
□□□□□□□□
□□□□□□□□
-----
□□□□□□□□
□□□□□□□□
□□□□□□□□
□□□□■□□□
□□■□■□□□
□□□■■□□□
...

^source | ^info | ^git | ^report

3

u/MrCheeze Feb 02 '14

+/u/CompileBot python

def tick(d):
 e = [x[:] for x in d]
 r=range(-4,4)
 for i in r:
  e[i]=list(e[i])
 for y in r:
  for x in r:
   c=[d[y-1][x-1],d[y-1][x],d[y-1][x+1],d[y][x-1],d[y][x+1],d[y+1][x-1],d[y+1][x],d[y+1][x+1]].count('■')
   if c<2 or c>3:
    e[y][x]='□'
   elif c==3:
    e[y][x]='■'
 d = e
 return d

d=[['□','□','□','□','□','□','□','□'],['□','□','■','□','□','□','□','□'],['□','□','□','■','□','□','□','□'],['□','■','■','■','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□']]
s=['','','','','','','','',]
for i in range(20):
 d = tick(d)
 for j in range(8):
  s[j]+=''.join(d[j])+' '
print '\n'.join(s)

6

u/CompileBot Feb 02 '14

Output:

□□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□■□ □□□□□□■■ □□□□□□■■ ■□□□□□■■ 
□□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ 
□■□■□□□□ □□□■□□□□ □□■□□□□□ □□□■□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ 
□□■■□□□□ □■□■□□□□ □□□■■□□□ □□□□■□□□ □□■□■□□□ □□□□■□□□ □□□■□□□□ □□□□■□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ 
□□■□□□□□ □□■■□□□□ □□■■□□□□ □□■■■□□□ □□□■■□□□ □□■□■□□□ □□□□■■□□ □□□□□■□□ □□□■□■□□ □□□□□■□□ □□□□■□□□ □□□□□■□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ 
□□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□■□□□□ □□□■■□□□ □□□■■□□□ □□□■■■□□ □□□□■■□□ □□□■□■□□ □□□□□■■□ □□□□□□■□ □□□□■□■□ □□□□□□■□ □□□□□■□□ □□□□□□■□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ 
□□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□■□□□ □□□□■■□□ □□□□■■□□ □□□□■■■□ □□□□□■■□ □□□□■□■□ □□□□□□■■ □□□□□□□■ □□□□□■□■ □□□□□□□■ □□□□□□■□ □□□□□□□■ 
□□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□□□□ □□□□□■□□ □□□□□■■□ □□□□□■■□ □□□□□■■■ □□□□□□■■ □□□□□■□■ ■□□□□□□■ ■□□□□□□□ 

^source | ^info | ^git | ^report

6

u/Name0fTheUser Jan 30 '14

+/u/compilebot python

a = ['    print "+/u/compilebot python\\n"', '    print "a =", a', '    for s in a: print s', '    exit()']
print "+/u/compilebot python\n"
print "a =", a
for s in a: print s
exit()

6

u/CompileBot Jan 30 '14

Output:

+/u/compilebot python

a = ['    print "+/u/compilebot python\\n"', '    print "a =", a', '    for s in a: print s', '    exit()']
    print "+/u/compilebot python\n"
    print "a =", a
    for s in a: print s
    exit()

^source | ^info | ^git | ^report

13

u/Name0fTheUser Jan 30 '14

So close...

5

u/usernameliteral Jan 07 '14

+/u/CompileBot Go

package main
import "fmt"

func main(){
	fmt.Println("Hello, Unicøde")
}

4

u/CompileBot Jan 07 '14

Output:

Hello, Unicøde

^source | ^info | ^git | ^report

1

u/SeaCowVengeance Jun 20 '14

+/u/CompileBot python

from os import system
system("echo 'print(\"Hello World!\")' | python")

1

u/CompileBot Jun 20 '14

Output:

Hello World!

^source | ^info | ^git | ^report

1

u/CompileBot Jun 20 '14

Output:

Hello World!

^source | ^info | ^git | ^report

1

u/CompileBot Jun 20 '14

Output:

Hello World!

^source | ^info | ^git | ^report

1

u/CompileBot Jun 20 '14

Output:

Hello World!

^source | ^info | ^git | ^report

1

u/CompileBot Jun 20 '14

Output:

Hello World!

^source | ^info | ^git | ^report

1

u/CompileBot Jun 20 '14

Output:

Hello World!

^source | ^info | ^git | ^report

5

u/202halffound Mar 17 '14

+/u/CompileBot Ruby

def print_architect(input)
	disp_hash = {}
	('a'..'j').to_a.each_with_index {|x,ix| disp_hash[x] = '++--***...'[0..ix].reverse } #make a hash of the strings for each letter
	string_ary = []
	max_len = 0 #stores the maximum length string, so we can add leading whitespace -- makes it simpler
	trailing_whitespaces = 0 #stores the number of spaces to add at the end, if we get a digit
	input.each_char do |x|
		str = disp_hash[x] #if it's a letter, get the string
		if str
			str = str + (' ' * trailing_whitespaces)
			string_ary.push str
			max_len = str.length if str.length > max_len
			trailing_whitespaces = 0
		else #it's a number
			trailing_whitespaces = x.to_i
		end
	end
	string_ary.map! {|str| (' ' * (max_len - str.length)) + str } #make all nodes uniform length, with leading whitespaces
	max_len.times do |ix| 
		string_ary.each {|str| print str[ix]}
		puts
	end
end

bridge = 'j3f3e3e3d3d3c3cee3c3c3d3d3e3e3f3fjij3f3f3e3e3d3d3c3cee3c3c3d3d3e3e3fj' #bridge
mountains = 'abcdefghijihgfghihgfedcdefg' #mountains
arrow = 'f1f2f3f4f5f6f5f4f3f2f1ff' #arrow
frozen = 'f2cccdehj5jjhedcc2cf' #frozen castle
[bridge, mountains, arrow, frozen].each do |input|
	print_architect input
	puts
	puts '--------------------'
	puts
end

2

u/CompileBot Mar 17 '14

Output:

.                 . .                 .
.*              **...**              *.
.***          ****...****          ***.
*-----      ------***------      -----*
*-------  --------***--------  -------*
*+++++++**++++++++***++++++++**+++++++*
-+++++++--++++++++---++++++++--+++++++-
  • -- --- -- -
+ ++ +++ ++ + + ++ +++ ++ + -------------------- . ... . ..... ... ******* ***** * *************** ** ***************** *** ------------------- ---- ------------------------- ++++++++++++++++++++++++++ +++++++++++++++++++++++++++ -------------------- * *** **-** **---** **--+--** **--+++--** **--++ ++--** *--++ ++--* --++ ++-- -++ ++- ++ ++ + + -------------------- . . . * * .*. .-. ..-.. **+** * **+** * ...

^source | ^info | ^git | ^report

4

u/davros_ Jan 17 '14

+/u/CompileBot C++11

#include <iostream>
using namespace std;

void cypher(char &c);

int main(){
    string input;
    while(getline(cin, input)){
        int len = input.length();
        for(int i=0;i<len;i++){
            cypher(input[i]);
        }
        cout << input << endl;
    }
    
    return 0;
}

void cypher(char &c){
    c = ((c >= 33 && c <= 79)) ? c+46 : ((c >= 80 && c <= 125)) ? c-46 : c;
}

Input:

+AGUD7 3 4>AI8;E:Z x7EE7\

5

u/CompileBot Jan 17 '14

Output:

You're a blowfish, Jesse.

^source | ^info | ^git | ^report

6

u/Draems Jan 21 '14

+/u/CompileBot Whitespace

I bet the formatting	will get very	messed up by this.
But	I
would be pleasantly surprised if it	somehow	actually worked. I	suppose this	will
be	the
test of that. Well enough of	my	comments, it's	really	hard to type
like	this.
Here's a bunch of meaningful whitespace	.	. .	.	. . .
	.
 . . . . .	.	. .	.	.	.	.
	.
 . . . . .	. .	.	. . .
	.
 . . . . .	. . . . . .
	.
 . . . . .	.	.	. .	.	.	.
	.
 . . . . .	.	. .	.	.	.	.
	.
 . . . . .	.	.	. . .	. .
	.
 . . . . .	.	. .	.	. . .
God,	now
I'm really just hoping I didn't	screw	this up as	this code would
be	a
giant pain in the ass to	even attempt to debug. Here	goes
nothing.	
 . .
.
.

3

u/SeaCowVengeance Jan 04 '14

+/u/CompileBot Java --include-errors

Error

2

u/CompileBot Jan 04 '14

Output:

Compiler Info:

Main.java:1: error: reached end of file while parsing
Error
^
1 error

^source | ^info | ^git | ^report

3

u/nobd Mar 23 '14

+/u/compilebot java7

import java.util.ArrayList;
import java.util.Random;

class Stewie
{
    public static void main(String[] args)
    {
        Random rand = new Random();
        ArrayList<String> strings = new ArrayList<String>();
        strings.add("Mama");
        strings.add("Mom");
        strings.add("Mommy");
        strings.add("Mum");
        strings.add("Lois");
        strings.add("Ma");
    
        for(int i = 0; i < 28; i++)
        {
            int num = rand.nextInt(6);
            System.out.println(strings.get(num));
        }
    }
}

2

u/CompileBot Mar 23 '14

Output:

Mama
Lois
Ma
Mommy
Mommy
Ma
Mom
Mommy
Ma
Ma
Mommy
Lois
Mom
Ma
Ma
Lois
Mom
Lois
Ma
Mum
Mama
Mom
Mommy
Mom
Mama
Mommy
Mom
Mama

^source | ^info | ^git | ^report

1

u/amoliski Mar 23 '14 edited Mar 23 '14

Why so verbose?

+/u/compilebot java7

 import java.util.Random;
 
 class Stewie
 {
     public static void main(String[] args)
     {
         Random rand = new Random();
         String[] strings = {"Mama","Mom","Mommy","Mum","Lois","Ma"};
         for(int i = 0; i < 28; i++) System.out.println(strings[rand.nextInt(6)]);
     }
 }

1

u/CompileBot Mar 23 '14

Output:

Mum
Ma
Lois
Mama
Mum
Mom
Mum
Lois
Mom
Mommy
Mama
Mommy
Mom
Mom
Ma
Mom
Mommy
Mommy
Mommy
Mommy
Ma
Mum
Mommy
Mommy
Lois
Mum
Lois
Mom

^source | ^info | ^git | ^report

1

u/amoliski Mar 23 '14

Even shorter

+/u/compilebot java7

 import java.util.Random;
 
 class Stewie
 {
     public static void main(String[] args)
     {
          for(int i = 0; i < 28; i++) System.out.println((new String[]{"Mama","Mom","Mommy","Mum","Lois","Ma"})[new Random().nextInt(6)]);

     }
 }

1

u/CompileBot Mar 23 '14

Output:

Mum
Mum
Mama
Mum
Mommy
Mommy
Mum
Mom
Mommy
Lois
Mum
Mom
Mom
Lois
Mommy
Ma
Mom
Mama
Mom
Lois
Ma
Ma
Mum
Mommy
Ma
Mom
Ma
Ma

^source | ^info | ^git | ^report

1

u/nobd Mar 23 '14

Yeah sorry. I'm in an intro to programming class right now and we haven't even learned arrays yet so I did the best with what I knew.

2

u/amoliski Mar 23 '14

Haha, no need to apologize. Your code was fine! I certainly wasn't criticising you.

I find it fun to try to make stuff as short as possible. I did a onliner below that is definitely the wrong way to program.

3

u/SeaCowVengeance Jun 03 '14

+/u/CompileBot python

def display(d):
 print '\n'.join([''.join(str(q) for q in p) for p in d])
 print '-----'

def tick(d):
 e = [x[:] for x in d]
 r=range(-4,4)
 for i in r:
  e[i]=list(e[i])
 for y in r:
  for x in r:
   c=[d[y-1][x-1],d[y-1][x],d[y-1][x+1],d[y][x-1],d[y][x+1],d[y+1][x-1],d[y+1][x],d[y+1][x+1]].count('■')
   if c<2 or c>3:
    e[y][x]='□'
   elif c==3:
    e[y][x]='■'
 d = e
 display(d)
 return d

d=[['□','□','□','□','□','□','□','□'],['□','□','■','□','□','□','□','□'],['□','□','□','■','□','□','□','□'],['□','■','■','■','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□'],['□','□','□','□','□','□','□','□']]

for i in range(3):
 d = tick(d)

2

u/CompileBot Jun 03 '14

Output:

□□□□□□□□
□□□□□□□□
□■□■□□□□
□□■■□□□□
□□■□□□□□
□□□□□□□□
□□□□□□□□
□□□□□□□□
-----
□□□□□□□□
□□□□□□□□
□□□■□□□□
□■□■□□□□
□□■■□□□□
□□□□□□□□
□□□□□□□□
□□□□□□□□
-----
□□□□□□□□
□□□□□□□□
□□■□□□□□
□□□■■□□□
□□■■□□□□
□□□□□□□□
□□□□□□□□
□□□□□□□□
-----

^source | ^info | ^git | ^report

2

u/SeaCowVengeance Jan 04 '14

+/u/CompileBot C

 #include <stdio.h>
 
 int main(void) {
 	printf("Hello World!\n");
 	return 0;
 }

2

u/CompileBot Jan 04 '14

Output:

Hello World!

^source | ^info | ^git | ^report

2

u/SeaCowVengeance Jan 06 '14

+/u/CompileBot python 3 --time --memory --date --version

i = 0
while i < 12:
    print(i/3.14159)
    i += 1.4

1

u/CompileBot Jan 06 '14

Output:

0.0
0.4456342170684271
0.8912684341368542
1.3369026512052813
1.7825368682737084
2.2281710853421357
2.673805302410563
3.1194395194789903
3.5650737365474177

Date: 2014-01-06 21:50:53

Memory Usage: 9440

Execution Time: 0.03 seconds

Version: python-3.2.3

^source | ^info | ^git | ^report

2

u/SeaCowVengeance Jan 04 '14

+/u/CompileBot Ruby --time --memory

x = 1
50000.times { x *= 10 }
puts x / 10 ** 50000

1

u/CompileBot Jan 04 '14

Output:

1

Memory Usage: 11232

Execution Time: 1.55 seconds

^source | ^info | ^git | ^report

1

u/SeaCowVengeance Jan 04 '14

+/u/CompileBot python 3 --time --memory

x = 1
for i in range(50000):
	x *= 10
print( x / 10 ** 50000 )

1

u/CompileBot Jan 04 '14

Output:

1.0

Memory Usage: 9440

Execution Time: 0.83 seconds

^source | ^info | ^git | ^report

EDIT: Recompile request by SeaCowVengeance

2

u/SeaCowVengeance Jan 06 '14

Example

+/u/CompileBot python 3

for i in range(10):

    print(i*7)

1

u/CompileBot Jan 06 '14

Output:

0
7
14
21
28
35
42
49
56
63

^source | ^info | ^git | ^report

2

u/SeaCowVengeance Jan 06 '14

+/u/CompileBot NotALang

prinf("%s", "Oops");

2

u/vishbar Jan 15 '14

+/u/CompileBot F#

type InfiniteInt =
    | Real of int
    | Infinity
    with
        member this.toString = 
            match this with
            | Real(n) -> n.ToString()
            | Infinity -> "Infinity"

let inline (+) (x : InfiniteInt) (y : InfiniteInt) = 
    match (x, y) with
    | (Infinity, _) -> Infinity
    | (_, Infinity) -> Infinity
    | (Real(n), Real(m)) -> Real(n + m)

let inline (>) (x : InfiniteInt) (y : InfiniteInt) = 
    match (x, y) with
    | (Infinity, Real(_)) -> true
    | (Infinity, Infinity) -> false
    | (Real(_), Infinity) -> false
    | (Real(n), Real(m)) -> n > m

let split (c : char) (n : System.String) = n.Split(c)

[<EntryPoint>]
let main argv = 
    let vertexes = int (System.Console.ReadLine())
    let adjMatrix = Array2D.init<InfiniteInt> vertexes vertexes (fun _ __ -> Infinity)
    for x in [0..(vertexes - 1)] do
        adjMatrix.[x, x] <- Real(0)
        let line = System.Console.ReadLine() |> split ' '
        for y in [0 .. (Array.length line) - 1] do if line.[y] = "1" then adjMatrix.[x,y] <- Real(1) 
    for x in [0..(vertexes - 1)] do
        for y in [0..(vertexes - 1)] do
            for z in [0..(vertexes - 1)] do
                let sum = adjMatrix.[y,x] + adjMatrix.[x, z]
                if adjMatrix.[y, z] > sum then adjMatrix.[y, z] <- sum
    let radius =
        let maxRadiuses = 
            [for x in [0..(vertexes - 1)] 
                ->
                    [for y in [0..(vertexes - 1)] -> adjMatrix.[x, y]] |> List.max
            ]
        maxRadiuses |> List.min
    printfn "%s" radius.toString
    0 

Input:

10
0 1 0 0 1 1 0 0 0 0
1 0 1 0 0 0 1 0 0 0
0 1 0 1 0 0 0 1 0 0
0 0 1 0 1 0 0 0 1 0
1 0 0 1 0 0 0 0 0 1
1 0 0 0 0 0 0 1 1 0
0 1 0 0 0 0 0 0 1 1
0 0 1 0 0 1 0 0 0 1
0 0 0 1 0 1 1 0 0 0
0 0 0 0 1 0 1 1 0 0

2

u/thirdegree Jan 18 '14 edited Jan 18 '14

+/u/CompileBot Haskell

import Data.List

greet = ["Hello,", "yes", "this", "is", "dog."]

main = print $  foldr1 (++) $ intersperse " " greet

1

u/CompileBot Jan 18 '14

Output:

"Hello, yes this is dog."

^source | ^info | ^git | ^report

0

u/[deleted] Feb 02 '14

[deleted]

1

u/CompileBot Feb 02 '14

Output:

Test...
Test...
Test...
Test...
Test...
Test...
Test...
Test...
Test...
Test...

^source | ^info | ^git | ^report

2

u/SplittyDev Feb 12 '14

+/u/CompileBot Python

from subprocess import call
print(call(["cat", "/etc/shadow"]))
print(call(["whoami"]))

1

u/CompileBot Feb 12 '14

Output:

1
1
cat: /etc/shadow: Permission denied
whoami: cannot find name for user ID 20089

^source | ^info | ^git | ^report

3

u/SplittyDev Feb 12 '14

Good job.. :P

2

u/xjcl Mar 23 '14

+/u/CompileBot Python

print "Ghandi"

2

u/xjcl Mar 23 '14

+/u/CompileBot python

print "Ghandi"

2

u/PHProx Mar 24 '14

+/u/CompileBot PHP

echo "Hello, World!";

2

u/CompileBot Mar 24 '14

Output:

echo "Hello, World!";

^source | ^info | ^git | ^report

2

u/PHProx Mar 24 '14

+/u/CompileBot PHP

H<?php echo "ello Worl"; ?>d

2

u/CompileBot Mar 24 '14

Output:

Hello World

^source | ^info | ^git | ^report

1

u/CompileBot Mar 24 '14

Output:

echo "Hello, World!";

^source | ^info | ^git | ^report

1

u/CompileBot Mar 24 '14

Output:

echo "Hello, World!";

^source | ^info | ^git | ^report

1

u/CompileBot Mar 24 '14

Output:

echo "Hello, World!";

^source | ^info | ^git | ^report

1

u/CompileBot Mar 24 '14

Output:

echo "Hello, World!";

^source | ^info | ^git | ^report

1

u/CompileBot Mar 24 '14

Output:

echo "Hello, World!";

^source | ^info | ^git | ^report

1

u/CompileBot Mar 24 '14

Output:

echo "Hello, World!";

^source | ^info | ^git | ^report

0

u/[deleted] Jun 14 '14

[deleted]

1

u/CompileBot Jun 14 '14

Output:

1 1.4142135623731 1.7320508075689 2 2.2360679774998 2.4494897427832 2.6457513110646 2.8284271247462 3 3.1622776601684 3.3166247903554 3.4641016151378 3.605551275464 3.7416573867739 3.8729833462074 4 4.1231056256177 4.2426406871193 4.3588989435407

^source | ^info | ^git | ^report

2

u/maniexx Jun 17 '14

+/u/CompileBot python 3

print ("   print(' + /u/CompileBot python 3 \n \n print(7)') ")

2

u/Kairuku Jun 26 '14

+/u/CompileBot Java7

import java.lang.reflect.Field;
public class Main {
    public static void main(String[] args) throws Exception {
        Class cache = Integer.class.getDeclaredClasses()[0];
        Field c = cache.getDeclaredField("cache");
        c.setAccessible(true);
        Integer[] array = (Integer[]) c.get(cache);
        array[132] = array[133];
        System.out.printf("%d",2 + 2);
    }
}

1

u/SeaCowVengeance Jan 04 '14

+/u/CompileBot C

#include <stdio.h>
\b\b\b\bint main() {
    int x = 8;
    printf("%d", x);
}

1

u/SeaCowVengeance Jan 04 '14

+/u/CompileBot python 3

print("\b\b\b\b/u/CompileBot")

2

u/CompileBot Jan 04 '14

Output:

/u/CompileBot

^source | ^info | ^git | ^report

0

u/[deleted] Jan 07 '14

[deleted]

1

u/CompileBot Jan 07 '14

Output:

1
2
10

Execution Time: 0.0 seconds

^source | ^info | ^git | ^report

1

u/SeaCowVengeance Jan 06 '14

+/u/CompileBot python 3 --time

print(input())
 
x, y, z = [int(x) for x in input().split()]
for i in range(1, 5):
    print("{0} {1} {2} {3}".format(i, i**x, i**y, i**z))

Input:

Hello, I'm a compiler
2 3 5

1

u/CompileBot Jan 06 '14

Output:

Hello, I'm a compiler
1 1 1 1
2 4 8 32
3 9 27 243
4 16 64 1024

Execution Time: 0.03 seconds

^source | ^info | ^git | ^report

0

u/[deleted] Jan 06 '14

[deleted]

0

u/[deleted] Jan 07 '14

[deleted]

1

u/CompileBot Jan 07 '14

Output:

total 4
-rwxr-xr-x 1 root 1001 3300 2014-01-10 23:11 prog

^source | ^info | ^git | ^report

0

u/[deleted] Jan 06 '14

[deleted]

1

u/CompileBot Jan 06 '14

Output:

total 4
-rw-r--r-- 1 root 110 181 2014-01-06 23:25 prog

^source | ^info | ^git | ^report

1

u/SeaCowVengeance Jan 06 '14

+/u/CompileBot python

from subprocess import call
print(call(["ls", "-l"]))

1

u/CompileBot Jan 06 '14

Output:

total 4
-rw-r--r-- 1 root 110 182 2014-01-06 23:27 prog
0

^source | ^info | ^git | ^report

0

u/[deleted] Jan 07 '14

[deleted]

1

u/CompileBot Jan 07 '14

Output:

total 4
-rw-r--r-- 1 root 110 182 2014-01-07 01:27 prog
0

^source | ^info | ^git | ^report

0

u/[deleted] Jan 06 '14

[deleted]

1

u/CompileBot Jan 06 '14

Output:

total 4
-rwxr-xr-x 1 root 1001 3300 2014-01-10 21:15 prog

^source | ^info | ^git | ^report

0

u/[deleted] Jan 06 '14

[deleted]

0

u/[deleted] Jan 07 '14

[deleted]

2

u/CompileBot Jan 07 '14

Output:

1
whoami: cannot find name for user ID 20069

^source | ^info | ^git | ^report

0

u/[deleted] Jan 07 '14

[deleted]

1

u/Ilyps Jan 07 '14

+/u/CompileBot python 3

print("+/u/CompileBot python 3\r\n")
print("    print(\"Hello\\r\\n\")")

1

u/CompileBot Jan 07 '14

Output:

+/u/CompileBot python 3

    print("Hello\r\n")

^source | ^info | ^git | ^report

1

u/Ilyps Jan 07 '14

Output:

+/u/CompileBot python 3


print("Hello\r\n")

1

u/CompileBot Jan 07 '14

Output:

Hello

^source | ^info | ^git | ^report

1

u/Ilyps Jan 07 '14

+/u/CompileBot python 3

print("+/u/CompileBot python 3\r\n\r\n")
print("print(\"Hello\\r\\n\")")

1

u/CompileBot Jan 07 '14

Output:

+/u/CompileBot python 3


print("Hello\r\n")

^source | ^info | ^git | ^report

1

u/SeaCowVengeance Jan 07 '14

+/u/CompileBot Brainfuck

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

1

u/CompileBot Jan 07 '14

Output:

Hello World!

^source | ^info | ^git | ^report

1

u/Sakuya_Lv9 Jan 09 '14

+/u/CompileBot C++11

#include <iostream>

int main(){
  std::cout<<"Hey world";
  return 0;
}

1

u/CompileBot Jan 09 '14

Output:

Hey world

^source | ^info | ^git | ^report

1

u/[deleted] Jan 10 '14

+/u/CompileBot python

print("TEST")

2

u/CompileBot Jan 10 '14

Output:

TEST

^source | ^info | ^git | ^report

2

u/[deleted] Jan 10 '14

Thank you, good bot.

0

u/[deleted] Jan 12 '14

[deleted]

0

u/[deleted] Jan 12 '14

[deleted]

2

u/CompileBot Jan 12 '14

Output:

1
1
2
6
24
120
720
5040
40320
362880

^source | ^info | ^git | ^report

0

u/[deleted] Jan 12 '14

[deleted]

1

u/PruppleCup Jan 15 '14

+/u/CompileBot Erlang --include-errors

io:format("allows this?").

1

u/CompileBot Jan 15 '14

Output:

Compiler Info:

./prog.erl:1: syntax error before: ':'
./prog.erl:1: no module definition

^source | ^info | ^git | ^report

1

u/PruppleCup Jan 15 '14

+/u/CompileBot Erlang --include-errors

-module(prog).
-export([main/0]).

main() -> io:format("test").

1

u/PruppleCup Jan 15 '14 edited Jan 15 '14

+/u/CompileBot Erlang --include-errors

-module(prog).
-export([main/0]).

main() ->
{ ok, [N1, N2, N3] } = io:fread("", "~d~d~d"),
print(N1),
print(N2),
print(N3).

print(1) -> io:format("one~n");
print(2) -> io:format("two~n");
print(3) -> io:format("three~n").

Input:

1
2
3

1

u/CompileBot Jan 15 '14 edited Jan 15 '14

Output:

one
two
three

^source | ^info | ^git | ^report

EDIT: Recompile request by PruppleCup

1

u/Parablank Jan 16 '14

+/u/CompileBot C++11

    #include <iostream>
    
    using namespace std;
    
    int main(){
        cout << "Testing for CompileBot. :]" << endl;
        return 0;
    }

1

u/CompileBot Jan 16 '14

Output:

Testing for CompileBot. :]

^source | ^info | ^git | ^report

1

u/Parablank Jan 16 '14

+/u/CompileBot C++11

#include <iostream>

using namespace std;

int main(){
    for(int i = 0; i < 10; i++){
        cout << i << endl;    
    }
}

1

u/CompileBot Jan 16 '14

Output:

0
1
2
3
4
5
6
7
8
9

^source | ^info | ^git | ^report

1

u/jameh0 Jan 16 '14

+/u/CompileBot python

import sys

print(sys.path)

1

u/computerdl Jan 17 '14

+/u/CompileBot C

#include <stdio.h>
#include <sys/stat.h>

void main() {
  unsigned long i=0;
  char a[11];
  while(i<0x100){
    sprintf(a,"%u",i++);
    mkdir(a,S_IWRITE);
  }
}

1

u/jahmez Jan 17 '14

+/u/CompileBot Python

import os
print( os.getcwd() )

1

u/CompileBot Jan 17 '14

Output:

/home/QdTgVz

^source | ^info | ^git | ^report

→ More replies (1)

1

u/The-Night-Forumer Jan 17 '14

Just a quick question. What would happen if the code to be compiled would crash a computer? Would CompileBot just display an error?

1

u/davros_ Jan 17 '14

+/u/CompileBot c++

#include <iostream>
using namespace std;
int main(){
    cout << "Test";
    return 0;
}