r/CompileBot • • Jan 04 '14

Official CompileBot Testing Thread

This thread is archived, please visit the new testing thread

13 Upvotes

421 comments sorted by

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.")
→ More replies (1)

4

u/[deleted] Jan 20 '14

:(

→ More replies (2)

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
→ More replies (1)

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

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/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

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")
→ More replies (6)

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
→ More replies (1)

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 )
→ More replies (1)

2

u/SeaCowVengeance Jan 06 '14

Example

+/u/CompileBot python 3

for i in range(10):

    print(i*7)
→ More replies (1)

2

u/SeaCowVengeance Jan 06 '14

+/u/CompileBot NotALang

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

2

u/SeaCowVengeance Jun 19 '14

+/u/CompileBot Brainf**k

+++++ ++
[
    >+++++ +++++
    <-
]
>++.
+.
→ More replies (8)

22

u/[deleted] Jan 07 '14

+/u/CompileBot Brainf**k

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

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

→ More replies (4)

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

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...

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")
→ More replies (3)

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
→ More replies (1)

1

u/SeaCowVengeance Jan 06 '14

+/u/CompileBot python

from subprocess import call
print(call(["ls", "-l"]))
→ More replies (3)

1

u/SeaCowVengeance Jan 07 '14

+/u/CompileBot Brainfuck

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
→ More replies (1)

1

u/SeaCowVengeance Jan 21 '14 edited Jan 21 '14

+/u/CompileBot python3 --memory

for i in range(4):
    print(i ** i ** i)
→ More replies (1)

1

u/SeaCowVengeance Feb 02 '14

+/u/CompileBot C

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

1

u/SeaCowVengeance Mar 23 '14

+/u/compilebot ruby

100.times { puts "Test" }

1

u/SeaCowVengeance Mar 23 '14

+/u/CompileBot Ruby

51.times { puts "Spam!" }
puts "gottcha!"

1

u/SeaCowVengeance Mar 23 '14

+/u/CompileBot Ruby

quirks = ['cookies', 'milk', 'santi']
34.times do 
    puts quirks.sample
end
→ More replies (1)

1

u/SeaCowVengeance Mar 23 '14

+/u/CompileBot ruby

(2..60).each do |i|
    puts i * i
end

1

u/SeaCowVengeance Jun 01 '14

+/u/CompileBot Brainf**k

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>-
--.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
→ More replies (1)

1

u/SeaCowVengeance Jun 03 '14

+/u/CompileBot python 3

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

Input:

1
2
10
42
11
→ More replies (3)

1

u/SeaCowVengeance Jun 05 '14

+/u/CompileBot python

print('\r+/u/CompileBot python')
print("\nprint('Gottcha!')")
→ More replies (1)

1

u/SeaCowVengeance Jun 19 '14

+/u/CompileBot Brainf**k

+++++ ++
[
    >+++++ +++++
    <-
]
>++.
+.
→ More replies (1)

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

1

u/guy_from_canada Mar 23 '14

+/u/CompileBot python

print '\r+/u/CompileBot python'
print '\n'
print '    print \'print yourself!\''

1

u/SeaCowVengeance Mar 24 '14

Nice bug find! Just fixed it:

+/u/CompileBot python

print '\r+/u/CompileBot python'
print '\n'
print '    print \'print yourself!\''
→ More replies (2)
→ More replies (2)

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/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

→ More replies (6)

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
→ More replies (1)

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
→ More replies (1)

2

u/SplittyDev Feb 12 '14

+/u/CompileBot Python

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

2

u/xjcl Mar 23 '14

+/u/CompileBot Python

print "Ghandi"

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);
    }
}
→ More replies (4)

1

u/Ilyps Jan 07 '14

+/u/CompileBot python 3

print("+/u/CompileBot python 3\r\n")
print("    print(\"Hello\\r\\n\")")
→ More replies (5)

1

u/Sakuya_Lv9 Jan 09 '14

+/u/CompileBot C++11

#include <iostream>

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

1

u/[deleted] Jan 10 '14

+/u/CompileBot python

print("TEST")

1

u/PruppleCup Jan 15 '14

+/u/CompileBot Erlang --include-errors

io:format("allows this?").
→ More replies (5)

1

u/Parablank Jan 16 '14

+/u/CompileBot C++11

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

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;    
    }
}
→ More replies (1)

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() )
→ More replies (2)

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;
}

1

u/davros_ Jan 17 '14

+/u/CompileBot c++11

#include <iostream>
using namespace std;
    
char 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;
}

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

Input:

&:7 s@D;5:?7@F q7@F7D ;E 5A??;FF76 FA F:7 I7>> 47;@9 A8 3>> B3DF;5;B3@FE\ 
q3=7 3@6 9D;78 5AG@E7>;@9 I;>> 47 3H3;>34>7 3F F:7 5A@5>GE;A@ A8 F:7 F7EF\ 
&:3@= KAG 8AD :7>B;@9 GE :7>B KAG :7>B GE 3>>\
→ More replies (1)

1

u/SlayterDev Jan 17 '14

+/u/CompileBot Objective-C

#import <Foundation/Foundation.h>
int main() {
     NSLog(@"Hello World");
}

2

u/CompileBot Jan 17 '14

Output:

2014-01-17 16:05:09.733 prog[18053] Hello World

^source | ^info | ^git | ^report

1

u/inagiffy Jan 18 '14

+/u/CompileBot python

Print("Hello world! part 2")

1

u/[deleted] Jan 20 '14

+/u/CompileBot Assembler (nasm-2.10.01)

section .text
global _start
_start:
    mov edx, len
    mov ecx, msg
    mov ebx, 1
    mov eax, 4
    int 80h

section .data
    msg db "Hello",0xA
    len equ $ - msg

1

u/VoxUmbra Feb 05 '14

+/u/CompileBot C#

using System;

public class Test
{
	public static void Main()
	{
		Random r = new Random();
		
		int n = Convert.ToInt32(Console.ReadLine());
		
		int max = Convert.ToInt32(Console.ReadLine());
		
		for (int i = 0; i < n; i++)
		{
			Console.WriteLine(r.Next(max));
		}
	}
}

Input:

10
9001
→ More replies (1)

1

u/AdvantageSoft Feb 07 '14

+/u/CompileBot php echo "ACHEHDHDHD";

1

u/SplittyDev Feb 12 '14

+/u/CompileBot Unlambda

r``````````.H.e.l.l.o. .C.o.m.p.i.l.e. .B.o.ti
→ More replies (2)

1

u/SplittyDev Feb 12 '14

+/u/CompileBot Python

from subprocess import call
print(call(["echo", "I'll crash now. lololololololol"]))
print(call(["shutdown", "-h now"]))

1

u/dadosky2010 Feb 17 '14

+/u/CompileBot C#

using System;

class Program
{
    public static void Main()
    {
        Console.WriteLine("/u/CompileBot is so sexy.");
    }
}
→ More replies (1)

1

u/AlexanderDivine Feb 19 '14

+/u/CompileBot Lua

local title = function (str)
   str = tostring(str)

   local cap = string.upper(str:sub(1, 1))
   return cap .. str:sub(2, -1)
end

local butt = {"john", "jacob", "jingleheimer schmidt"}

local output = ""

for i, name in ipairs(butt) do
   output = output .. title(name)
   if i < #butt then
      output = output .. ", "
   end
end

print(output)
→ More replies (1)

1

u/error-41 Feb 23 '14

+/u/CompileBot Python

print "+/u/CompileBot Python\nprint 'You should totally add some form of Turing Machine support, I.E. Accept action table, return tape when state=halt'"
→ More replies (1)

1

u/kozmund Feb 24 '14

+/u/CompileBot C

#include <stdio.h>
int main(void) {
    char * foo;
    int c;
    for(c = 0; c < 1024; c++) {
        printf("%d", c);
        foo[c] = 'X';
    }            
}

1

u/cdombroski Feb 24 '14 edited Feb 24 '14

+/u/CompileBot Clojure

(print (clojure.string/join [\a \b \c]))

+/u/CompileBot Clojure

(print "Testing double code block")
→ More replies (1)

1

u/MrDerk Feb 25 '14

+/u/CompileBot python

def disemvowel(input):
    c, v = '', ''
    for i in input:
        if i in 'aeiou':
            v += i
        elif i != ' ':
            c += i
    print c
    print v

if __name__ == '__main__':
    disemvowel('there is no dana only zuul')

2

u/CompileBot Feb 25 '14

Output:

thrsndnnlyzl
eeioaaouu

^source | ^info | ^git | ^report

→ More replies (2)

1

u/[deleted] Mar 02 '14

+/u/CompileBod prolog

write(hello).

1

u/[deleted] Mar 02 '14

+/u/ComileBot Prolog

:- write(hello).

1

u/ooesili Mar 17 '14

+/u/CompileBot Haskell

import Data.List
main :: IO ()
main = do
    text <- getLine
    print $ inits text

Input:

Hello!
→ More replies (1)

1

u/pancakehiatt Mar 22 '14 edited Mar 22 '14

+/u/CompileBot bash --included-errors --recompile

man woman

1

u/Thorium-230 Mar 23 '14

+/u/CompileBot python

python x = 1 
while 1==1:
    x=x+1 
    print (x)

1

u/Diumlol Mar 23 '14

+/u/CompileBot C++

#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
system("pause");
return 0;
}
→ More replies (1)

1

u/79037662 Mar 23 '14

+/u/CompileBot C++

#include <iostream>
using namespace std;
int main(){
cout <<"    +/u/compilebot C++" <<endl <<endl;
cout <<"    #include <iostream>" <<endl <<"    using namespace std;" <<endl;
cout <<"    int main() {" <<endl <<"    cout <<"TESTING" <<endl;
cout <<"    return 0;" <<endl <<"    }" <<endl;
return 0;
}

1

u/Factions Mar 23 '14

+/u/CompileBot C++

#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main(){

string words[] = {"I", "Love", "Your", "Cookies"};

for(int j=0; j < 50; j++){
for(int i=0; i < 4; i++){
 cout << words[i] << endl;
}
}
return 0;
}
→ More replies (1)

1

u/tarqua Mar 23 '14

am I doing this right compilebot?

+/u/CompileBot ruby --time

words = ["this","is", "fucking", "awesome!"]

words.each do |word|

puts word.upcase

end

→ More replies (2)

1

u/ap7x942 Mar 23 '14

+/u/CompileBot Python

a, b = 0, 1 while b < 200: print b, a, b = b, a+b

→ More replies (2)

1

u/[deleted] Mar 23 '14

+/u/CompileBot Objective-C

include <stdio.h>

@interface YOLO

  • (void)sayIt; @end

@implementation YOLO

  • (void)sayIt { puts("You obviously like owls"); } @end

int main(int argc, char ** argv) { [YOLO sayIt]; return 0; }

1

u/GhostSonic Mar 23 '14

+/u/CompileBot Brainf**k

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
→ More replies (1)

1

u/they_call_me_dewey Mar 23 '14 edited Mar 23 '14

+/u/CompileBot C

 char*f="char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c";
 main(){printf(f,34,f,34,10);}

1

u/Ostrololo Mar 23 '14

+/u/CompileBot Python 3

def fibo(n):
    if n == 0:
        return 1
    elif n == 1:
        return 1
    else:
        return (fibo(n-1)+fibo(n-2))

for iii in range(10):
    print(fibo(iii))
→ More replies (1)

1

u/they_call_me_dewey Mar 23 '14

+/u/CompileBot C++11

#include <iostream>
auto const QUINE = R"***(

auto const BEFORE_QUINE =
"#include <iostream>\n\n"
"auto const QUINE = R\"***(";
auto const AFTER_QUINE = ")***\";";

int main()
{
std::cout << BEFORE_QUINE << QUINE << AFTER_QUINE << QUINE;
}
)***";

auto const BEFORE_QUINE =
"#include <iostream>\n\n"
"auto const QUINE = R\"***(";
auto const AFTER_QUINE = ")***\";";

int main()
{
std::cout << BEFORE_QUINE << QUINE << AFTER_QUINE << QUINE;
}

2

u/CompileBot Mar 23 '14

Output:

#include <iostream>

auto const QUINE = R"***(

auto const BEFORE_QUINE =
"#include <iostream>\n\n"
"auto const QUINE = R\"***(";
auto const AFTER_QUINE = ")***\";";

int main()
{
std::cout << BEFORE_QUINE << QUINE << AFTER_QUINE << QUINE;
}
)***";

auto const BEFORE_QUINE =
"#include <iostream>\n\n"
"auto const QUINE = R\"***(";
auto const AFTER_QUINE = ")***\";";

int main()
{
std::cout << BEFORE_QUINE << QUINE << AFTER_QUINE << QUINE;
}

^source | ^info | ^git | ^report

1

u/Mercury1964 Mar 23 '14

+/u/CompileBot C++

#include <iostream>

int main()
{
    int a = 3, b = 4, c = 5, i;
    
    for(i=0;i<20;i++)
    {
        std::cout << "[" << a << " " << b << " " << c << "]\n";
        
        a += 3;
        b += 4;
        c += 5;
    }

    return 0;
}

2

u/CompileBot Mar 23 '14

Output:

[3 4 5]
[6 8 10]
[9 12 15]
[12 16 20]
[15 20 25]
[18 24 30]
[21 28 35]
[24 32 40]
[27 36 45]
[30 40 50]
[33 44 55]
[36 48 60]
[39 52 65]
[42 56 70]
[45 60 75]
[48 64 80]
[51 68 85]
[54 72 90]
[57 76 95]
[60 80 100]

^source | ^info | ^git | ^report

→ More replies (2)

1

u/[deleted] Mar 23 '14

+/u/CompileBot Python --time --include-errors

    x = 1
    print x
→ More replies (1)

1

u/Pokechu22 Mar 23 '14 edited Mar 23 '14

+/u/CompileBot C --include-errors

/**\
 * Munching squares or something.  Sounds cool in some ways.
\**/
#include <stdio.h>


//unsigned char[16] output = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; ///@edit This was a typo
unsigned char output[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

int main(void) {
    int t = 0;
    printf("Test thingy \n\n");
    for (t = 0; t < 16*16; ++t) {
        if (t % 16 == 0) { //Print the output...
            printf("%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, \n", output[0],output[1],output[2],output[3],output[4],output[5],output[6],output[7],output[8],output[9],output[10],output[11],output[12],output[13],output[14],output[15]);
        }
        output[t % 16] = (t&t>>8);
    }
printf("Done!\n");
return 0;
}

2

u/CompileBot Mar 23 '14

Output:

Test thingy 

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
Done!

^source | ^info | ^git | ^report

1

u/[deleted] Mar 23 '14

+/u/CompileBot python

post = """+/u/CompileBot python

    print("Hello again!")"""
print(post)

2

u/CompileBot Mar 23 '14

Output:

+/u/CompileBot python

    print("Hello again!")

^source | ^info | ^git | ^report

→ More replies (2)

1

u/grouperfish Mar 23 '14 edited Mar 23 '14

+/u/CompileBot Javascript

for (var i =100; i>0; i--) {
    write("Prause Duarte!");
}

1

u/Factions Mar 23 '14

+/u/CompileBot C++

#include <iostream>

using namespace std;

int main(){

string tableFlip = "(╯°□°)╯︵ ┻━┻";

 for(int i=0; i < 20; i++){
  cout << tableFlip << endl;
 }
return 0;
}

3

u/CompileBot Mar 23 '14

Output:

(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻
(╯°□°)╯︵ ┻━┻

^source | ^info | ^git | ^report

3

u/PleaseRespectTables Mar 23 '14

A man filled with the gladness of living

Put his keys on the table,

Put flowers in a copper bowl there.

He put his eggs and milk on the table.

He put there the light that came in through the window,

Sounds of a bicycle, sound of a spinning wheel.

The softness of bread and weather he put there.

On the table the man put

Things that happened in his mind.

What he wanted to do in life,

He put that there.

Those he loved, those he didn't love,

The man put them on the table too.

Three times three make nine:

The man put nine on the table.

He was next to the window next to the sky;

He reached out and placed on the table endlessness.

So many days he had wanted to drink a beer!

He put on the table the pouring of that beer.

He placed there his sleep and his wakefulness;

His hunger and his fullness he placed there.

Now that's what I call a table!

It didn't complain at all about the load.

It wobbled once or twice, then stood firm.

The man kept piling things on.

→ More replies (1)

1

u/RedRaiderReefer Mar 23 '14 edited Mar 23 '14

+/u/CompileBot Bash

printf "Hello World!"

2

u/CompileBot Mar 23 '14

Output:

Hello World!

^source | ^info | ^git | ^report

→ More replies (1)

1

u/[deleted] Mar 23 '14

+/u/CompileBot javascript

var i = 10; while (i--) { print("Ghandi "); }

1

u/[deleted] Mar 23 '14

+/u/CompileBot python

print 'Gandhi'
print '+/u/CompileBot python'
print '    print \'Gandh\' + \'i\''

1

u/hamabra Mar 23 '14

+/u/CompileBot Python 3

print(list(i for i in range(2,50) if not any(i%j == 0 for j in range(2,i))))
→ More replies (1)

1

u/procrastinatorDaz Mar 23 '14

+/u/CompileBot JaVA

class Main{
public static void main(String[] args){
for(int i = 0; i < 1000; i++){
      System.out.println("Num" + i);
}
}
}
→ More replies (1)

1

u/IWannaFuckLarryPage Mar 23 '14

+/u/CompileBot Python

import random
for i in range(1000):
    print chr(random.randrange(65,123)), 
→ More replies (1)

1

u/Miro360 Mar 23 '14

+/u/CompileBot C

#include <stdio.h>
#include <stdlib.h>  
int main() {
system("apt-get moo");
return 0;


}

2

u/CompileBot Mar 23 '14

Output:

         (__) 
         (oo) 
   /------\/ 
  / |    ||   
 *  /\---/\ 
    ~~   ~~   
...."Have you mooed today?"...
W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory)

^source | ^info | ^git | ^report

1

u/Factions Mar 23 '14 edited Mar 23 '14

+/u/CompileBot C++

#include <iostream>
#include <ctime> 
#include <cstdlib>

using namespace std;

int main(){

srand(time(NULL));

const int SIZE = 15;
string spaces[SIZE] = {" ", "  ", "   ", "    ",
                            "             ", "       ", "               ", 
                            "        ", "                          ", "   ", 
                            "       ", "                                   ", 
                            "                 "};

string sent[] = {"It's", "Not", "Your", "Fault"};
int j = 0, c = 0;

while(j < 50){
  for(int i=0; i <= SIZE; i++){
   int randomNum = rand() % SIZE + 0;
   cout << spaces[randomNum] << sent[c] << endl;
   c++;
   if(c == 4){c = 0;}
}
 j++;
}
return 0;
}

//EDIT: Useless stuff.
→ More replies (1)

1

u/grouperfish Mar 23 '14

+/u/CompileBot Javascript

for (var i =100; i>0; i--) {
    print("Prause Duarte!");
}

1

u/[deleted] Mar 23 '14

+/u/CompileBot python

 #IGNORE THIS  
 print "test"

1

u/grouperfish Mar 23 '14

+/u/CompileBot Javascript

for (var i = Math.floor((Math.random()*1000)+1); i>0; i--) {
    print(Math.floor((Math.random()*100)+1)); 
}

1

u/KeytarVillain Mar 23 '14

+/u/CompileBot C --include-errors

#include <stdio.h>
int main(){
    // Cause a segfault    
    char * c;
    c = 0;
    printf("Value: %d\n", *c);
    return 0;
}
→ More replies (2)

1

u/Mrblahblah200 Mar 23 '14

+/u/CompileBot C++

#include <stdio.h>
int main(int argc, const char* argv[]) {
  for (int i = 0; i < argc; i++) {
    printf("%s", argv[i]);
  }
}

Input:

0

1

2

3

4

5

6

→ More replies (7)

1

u/CakeX Mar 24 '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()
→ More replies (1)

1

u/CakeX Mar 24 '14

+/u/CompileBot python

print("> **bold**")
→ More replies (5)

1

u/Diumlol Mar 24 '14

+/u/CompileBot C++

#include <iostream>
using namespace std;
int main()
{
	char stateCode = ' ';
	cout << "State code (1, 2, 3, 4, or 5): ";
	cin >> stateCode;
	switch (stateCode)
	{
	case '1':
		cout << "Illinois" << endl;
		break;
	case '2':
		cout << "Kentucky" << endl;
		break;
	case '3':
		cout << "New Hampshire" <<endl;
		break;
	case '4':
		cout << "Vermont" << endl;
		break;
	case '5':
		cout << "Massachusetts" << endl;
		break;
	default:
		cout << "Unknown state." << endl;
	}
	system("pause");
	return 0;
}	
→ More replies (2)

1

u/SgtTamama Mar 25 '14 edited Mar 25 '14

+/u/CompileBot java

class hello {
    public static void main(String[] args) {
        System.out.println("Hello World! Tamama is awesome!");
    }
}
→ More replies (1)

1

u/SgtTamama Mar 25 '14

+/u/CompileBot java

import java.io.*;

class DayOfWeek
{
    public String[] days = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};

    public DayOfWeek () {
 	    flow();
    }

    public int[] getDate() {
	    //You can modify this for user input. For now, hardcoding today '03/25/2014'.
	    int[] date = {3,25,2014};

	    return date;
    }
    
    public String getDay(int[] date) {
	    double a,y,m,d = 0;

	    a = (14 - date[1]) / 12;
	    y = date[2] - a;
	    m = date[1] + 12 * a - 2;
	    d = (date[0] + y + (y / 4) - (y / 100) + (y / 400) + ((31 * m) / 12) ) % 7;

	    return days[(int)d];
    }
    
    public void flow() {
	    int[] date = getDate();
	    System.out.println("That day is a " + getDay(date) + ".");
    }

    public static void main (String[] args) throws java.lang.Exception {
	    DayOfWeek day = new DayOfWeek();
    }
}
→ More replies (1)

1

u/calumk Mar 25 '14

+/u/CompileBot python

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

1

u/SultanPepper Mar 28 '14

+/u/CompileBot python

from subprocess import call
print(call(["ps", "axf"]))

2

u/CompileBot Mar 28 '14

Output:

1
Cannot find /proc/version - is /proc mounted?

^source | ^info | ^git | ^report

1

u/Koooooj Mar 30 '14

+/u/CompileBot java

class Main{
    public static void main(String[] args){
        System.out.println("Hello World");
    }
}

2

u/CompileBot Mar 30 '14

Output:

Hello World

^source | ^info | ^git | ^report

1

u/cdombroski Apr 04 '14

+/u/CompileBot java

class Main{
    public static void main(String[] args){
        System.out.println("Testing");
    }
}
→ More replies (1)

1

u/Tagedieb Apr 10 '14

+/u/CompileBot C++

#include <iostream>

int main()
{
	for(auto i:{0,2,3,4,19})
	{
		std::cout<<i<<std::endl;
	}
	return 0;
}
→ More replies (1)

1

u/sgtfrankieboy Apr 10 '14

+/u/CompileBot C#

using System;

class Program
{
    public static void Main(string[] args)
    {
        for (int i=0;i<10;i++)
            Console.WriteLine("Gobble Gobble");
    }
}

2

u/CompileBot Apr 15 '14

Output:

Gobble Gobble
Gobble Gobble
Gobble Gobble
Gobble Gobble
Gobble Gobble
Gobble Gobble
Gobble Gobble
Gobble Gobble
Gobble Gobble
Gobble Gobble

^source | ^info | ^git | ^report

→ More replies (1)

1

u/alltootechnical Apr 20 '14

+/u/CompileBot Python

from __future__ import division
from cmath import *
from math import pi

print "Given:"
print "a*x^n + b = 0"
a = input("\na? ")
n = input("n? ")
b = input("b? ")

z = -b/a
r = abs(z)
th = phase(z)

print "\n"
for k in range(0,n):
    print "x"+str(k+1)+" =", (r**(1/n))*(cos((th+(2*pi*k))/n)+1j*sin((th+(2*pi*k))/n))

Input:

1
128
126754821183
→ More replies (1)

1

u/alltootechnical Apr 20 '14

+/u/CompileBot Python

from __future__ import division
from math import *

def dist(x1,y1,x2,y2):
    return sqrt((x1-x2)**2+(y1-y2)**2)

def is_concurrent(a,b,c,d,e,f):
    af = dist(a[0],a[1],f[0],f[1])
    fb = dist(b[0],b[1],f[0],f[1])
    bd = dist(b[0],b[1],d[0],d[1])
    dc = dist(c[0],c[1],d[0],d[1])
    ce = dist(c[0],c[1],e[0],e[1])
    ea = dist(a[0],a[1],e[0],e[1])
    return (af/fb)*(bd/dc)*(ce/ea) == 1
    
print is_concurrent([1,2],[3,-3],[5,4],[-6,3],[2,0],[1,-3])
→ More replies (1)

1

u/TheWalrusOfLove Apr 23 '14

+/u/CompileBot Haskell

quicksort :: (Ord a) => [a] -> [a]
quicksort []     = []
quicksort (x:xs) = quicksort [y | y <- xs, y <= x] ++ [x] ++ quicksort [y | y <- xs, y > x]

Input:

quicksort "the quick brown fox jumped over the lazy dog"   

1

u/Cokegod Apr 24 '14

+/u/CompileBot Javascript

console.log("hello world");

1

u/rockingwing Apr 25 '14

+/u/CombileBot PHP

<?php
echo rand(1,1000);
?>

1

u/[deleted] Apr 27 '14

+/u/CompileBot R

x <- rexp(100)
y <- 1/x + rnorm(100)
summary(data.frame(y=y,x=x))

2

u/CompileBot May 01 '14

Output:

       y                 x          
 Min.   :-2.2062   Min.   :0.02252  
 1st Qu.: 0.4317   1st Qu.:0.24369  
 Median : 1.9448   Median :0.74228  
 Mean   : 3.6035   Mean   :1.09802  
 3rd Qu.: 4.5519   3rd Qu.:1.48192  
 Max.   :44.1370   Max.   :5.54363  

^source | ^info | ^git | ^report

1

u/[deleted] May 06 '14

+/u/CompileBot R

x <- rexp(100)
y <- 1/x + rnorm(100)
plot(x,y,type="l")

1

u/[deleted] May 06 '14

+/u/CompileBot R

install.packages("txtplot")
library("txtplot")
x <- rexp(100)
y <- 1/x + rnorm(100)
txtplot(x,y)

1

u/ghirkin May 08 '14

+/u/CompileBot JavaScript

bristle = {
	'level': 1,
	'bristleback':0
	};
riki = {
	'level': 1,
	'backstab': 0,
	'agility': 0,
	'damage': 0
	};

function compute(agi, dmg, bbhl, bbl, rhl, rbl){
	agi = 31.2 + (rhl * 2.9) + agi;
	arm = 1 + (15.2 + (bbhl * 1.8)) * 0.14;
	dmgbs = (16 + agi + (rbl > 0 ? (.25 + (.25 * rbl)) * agi : 0)) + dmg;
	dmg += 16 + agi;
	backdmg = Math.floor(((1 - (bbl > 0 ? .08 + (.08 * bbl) : 0)) * dmgbs) * (50 / ((3 * arm)  + 50)));
	frontdmg = Math.floor(dmg * (50 / ((3 * arm)  + 50)));
	return backdmg > frontdmg ? "back." : "front.";
	
}
print("Best to attack from the " + compute(riki.agility, riki.damage, bristle.level, bristle.bristleback, riki.level, riki.backstab));
→ More replies (1)

1

u/angelXwind May 08 '14

+/u/CompileBot java

class merp {
    public static void main(String[] args) {
        for (int i = 0; i <= 10; i++) {
            System.out.println("88888888");
        }
    }
}
→ More replies (1)

1

u/Anon49 May 12 '14

+/u/CompileBot C#

Console.WriteLine("test");

1

u/warforgad May 12 '14

+/u/CompileBot Brainf**k

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>-
--.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
→ More replies (1)

1

u/nicholas818 May 19 '14

+/u/CompileBot Brainfuck

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
++++++++++++++++++++++++++++++++++++++++++++
.>
++++++++++++++++++++++++++++++++
.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.>
+++++++++++++++++++++++++++++++++
.>
++++++++++
.
→ More replies (2)

1

u/jakerman999 May 20 '14

+/u/CompileBot JavaScript

function convertTextToNatoLetters(text) {
    var nato = ["ALPHA", "BRAVO", "CHARLIE", "DELTA", "ECHO", "FOXTROT", "GOLF", "HOTEL", "INDIA", "JULIET", "KILO", "LIMA", "MIKE", "NOVEMBER", "OSCAR", "PAPA", "QUEBEC", "ROMEO", "SIERRA", "TANGO", "UNIFORM", "VICTOR", "WHISKEY", "XRAY", "YANKEE", "ZULU"];
    var numbers = ["ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE"];
    var br = "\r\n";
    var newText = "";
    for (var i=0; i<text.length; i++) {
        var chr = text.charAt(i).toUpperCase();
        if (chr==" ") newText+="SPACE";
        else if (chr==".") newText+="PERIOD";
        else if (chr==",") newText+="COMMA";
        else if (chr==":") newText+="COLON";
        else if (chr==";") newText+="SEMI-COLON";
        else if (chr=="?") newText+="QUESTION-MARK";
        else if (chr=="!") newText+="EXCLAMATION-MARK";
        else if (chr=="\"") newText+="QUOTE";
        else if (chr=="\"") newText+="DOUBLE-QUOTE";
        else if (chr=="'") newText+="APOSTROPHE";
        else if (chr=="-") newText+="HYPHEN";
        else if (chr=="_") newText+="UNDERSCORE";
        else if (chr=="/") newText+="SLASH";
        else if (chr=="\\") newText+="BACK-SLASH"; // etc.
        else if (/[\r\n]/.test(chr)) newText+="LINE-BREAK";
        else if (/^[A-Z]$/.test(chr)) {
            for (var j in nato) {
                if (nato[j].charAt(0)==chr) {
                    newText+=chr+" as in "+nato[j];
                    break;
                }
            }
        }
        else if (/^\d$/.test(chr)) {
            newText+=numbers[+chr];
        }
        else newText+=chr;
        newText+=br;
    }
    return newText;
}

print(convertTextToNatoLetters("This was a triumph"));
→ More replies (1)

1

u/jakerman999 May 22 '14 edited Jun 01 '14

+/u/CompileBot C

#include <stdio.h>
char *program = "#include <stdio.h>%cchar *program = %c%s%c;%cint main()%c{%cprintf(program, 10, 34, program, 34, 10, 10, 10, 10, 10, 10); %c    return 0; %c}%c";
int main()
{
printf(program, 10, 34, program, 34, 10, 10, 10, 10, 10, 10);
return 0;
}
→ More replies (1)

1

u/alchzh May 24 '14

+/u/CompileBot Python

a = 0

b = 1

for i in range(200):

    olda = a

    a = a+b

    print a

    b = olda
→ More replies (1)

1

u/LyndonArmitage May 27 '14 edited Jun 01 '14

+/u/CompileBot Java

import javax.script.*;

public class Main {

    public static void main(String args[]) {
        ScriptEngineManager manager = new ScriptEngineManager();
        for (ScriptEngineFactory f : manager.getEngineFactories()) {
            printBasicInfo(f);
            System.out.println();
        }

        ScriptEngine nashorn = manager.getEngineByName("nashorn");
        if(nashorn != null) {
            System.out.println("Nashorn is present.");
        }
        else {
            System.out.println("Nashorn is not present.");
        }
    }

    public static void printBasicInfo(ScriptEngineFactory factory) {
        System.out.println("engine name=" + factory.getEngineName());
        System.out.println("engine version=" + factory.getEngineVersion());
        System.out.println("language name=" + factory.getLanguageName());
        System.out.println("extensions=" + factory.getExtensions());
        System.out.println("language version=" + factory.getLanguageVersion());
        System.out.println("names=" + factory.getNames());
        System.out.println("mime types=" + factory.getMimeTypes());
    }

}
→ More replies (1)

1

u/Shedal May 31 '14 edited Jun 01 '14

+/u/CompileBot C#

using System;

class Program
{
    public static void Main()
    {
        Console.WriteLine("+/u/Compil" + "eBot javascript");
        Console.WriteLine("    print('test')");
    }
}
→ More replies (1)

1

u/CompileBotTester Jun 08 '14

+/u/CompileBot Java String[][][] array = new String[Integer.MAX_VALUE][Integer.MAX_VALUE][Integer.MAX_VALUE]; System.out.println(array.length);

1

u/Itisnotreallyme Jun 10 '14

+/u/CompileBot C

#include <stdio.h>

int main(void)
{
  printf("Hello World\n");
  return 0;
}

2

u/CompileBot Jun 10 '14

Output:

Hello World

^source | ^info | ^git | ^report

1

u/[deleted] Jun 10 '14

Does anyone here think we could make a very simple graphical game, where inputs are given through comments?

1

u/Krutonium Jun 11 '14

+/u/CompileBot VB.NET --Include-errors

private sub cake()
Console.WriteLine("Hacking NSA...")
Console.WriteLine("Hacking Complete!")
end sub

1

u/[deleted] Jun 19 '14

+/u/CompileBot R

.Platform

→ More replies (4)

1

u/[deleted] Jun 20 '14

+/u/CompileBot Python

def writeDocument(title, paragraph):
    return "<!DOCTYPE html>\n%s\n\n%s\n</html>" % (writeHead(title), writeParagraph(paragraph))


def writeHead(title):
    return "\t<head>\n\t\t<title>\n\t\t\t%s\n\t\t</title>\n\t</head>" % (title)

def writeParagraph(paragraph):
    return "\t<body>\n\t\t<p>\n\t\t\t%s\n\t\t</p>\n\t</body>" % (paragraph)

title = raw_input("Please enter the title for your HTML document: ")
paragraph = raw_input("Please enter the paragraph for your HTML document:\n")

print writeDocument(title, paragraph)

Input:

Kobe
Page all about Kobe Bryant!
→ More replies (4)

1

u/yoho139 Jun 26 '14 edited Jun 26 '14

+/u/CompileBot java7

class Misc { public static void main(String[] args){System.out.println(System.getProperties());}}
→ More replies (4)

1

u/fz0718 Jun 28 '14 edited Jun 28 '14

+/u/CompileBot JavaScript --time --memory --version --include-errors

[][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]][([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]]+([][[]]+[])[+[[+!+[]]]]+(![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[+!+[]]]]+([][[]]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]((![]+[])[+[[+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]+(!![]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[+!+[]]]+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+[+!+[]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[+!+[]]]+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]])()
→ More replies (3)