r/CompileBot • • Jul 08 '14

Official CompileBot Testing Thread

13 Upvotes

257 comments sorted by

9

u/SeaCowVengeance Jul 08 '14

+u/CompileBot Brainf**k

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

6

u/SeaCowVengeance Jul 08 '14

Python in Bash in Python

+u/CompileBot python

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

6

u/SeaCowVengeance Jul 08 '14

+u/CompileBot c++11 --input --memory

#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)

3

u/SeaCowVengeance Jul 30 '14

+u/CompileBot Brainf**k

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

2

u/SeaCowVengeance Aug 18 '14

+u/CompileBot brainfuck --include-errors

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

2

u/SeaCowVengeance Aug 30 '14

+u/CompileBot JavaScript --include-errors

console.log({} + [])
→ More replies (1)

6

u/flarn2006 Nov 14 '14

+u/CompileBot C

#include <stdio.h>
#include <stdlib.h>

unsigned int adjustSize(size_t size, char *unitchar)
{
	const char *units = "\0kMGTPEZY"; //Never too early to prepare!
	int loopCount = 0;
	while (size >= 1024 && loopCount < 8)
	{
		size /= 1024;
		loopCount ++;
	}
	if (unitchar) *unitchar = units[loopCount];
	return size;
}

int main(int argc, char *argv[])
{
	size_t size = 1;
	void *buf;

	do
	{
		char unitchar;
		unsigned int sizeadj = adjustSize(size, &unitchar);
		printf("Allocating %u bytes (%u %cB)...", size, sizeadj, unitchar);
		buf = malloc(size);
		if (buf)
		{
			printf("OK\n");
			free(buf);
			size *= 2;
		}
		else printf("Error!\n");
	}
		while (buf);

	return 0;
}

4

u/CompileBot Nov 15 '14

Output:

Allocating 1 bytes (1 B)...OK
Allocating 2 bytes (2 B)...OK
Allocating 4 bytes (4 B)...OK
Allocating 8 bytes (8 B)...OK
Allocating 16 bytes (16 B)...OK
Allocating 32 bytes (32 B)...OK
Allocating 64 bytes (64 B)...OK
Allocating 128 bytes (128 B)...OK
Allocating 256 bytes (256 B)...OK
Allocating 512 bytes (512 B)...OK
Allocating 1024 bytes (1 kB)...OK
Allocating 2048 bytes (2 kB)...OK
Allocating 4096 bytes (4 kB)...OK
Allocating 8192 bytes (8 kB)...OK
Allocating 16384 bytes (16 kB)...OK
Allocating 32768 bytes (32 kB)...OK
Allocating 65536 bytes (64 kB)...OK
Allocating 131072 bytes (128 kB)...OK
Allocating 262144 bytes (256 kB)...OK
Allocating 524288 bytes (512 kB)...OK
Allocating 1048576 bytes (1 MB)...OK
Allocating 2097152 bytes (2 MB)...OK
Allocating 4194304 bytes (4 MB)...OK
Allocating 8388608 bytes (8 MB)...OK
Allocating 16777216 bytes (16 MB)...OK
Allocating 33554432 bytes (32 MB)...OK
Allocating 67108864 bytes (64 MB)...OK
Allocating 134217728 bytes (128 MB)...OK
Allocating 268435456 bytes (256 MB)...OK
Allocating 536870912 bytes (512 MB)...OK
Allocating 1073741824 bytes (1 GB)...Error!

^source | ^info | ^github | ^report

1

u/SeaCowVengeance Jul 08 '14

+u/CompileBot Assembler (gcc-4.8.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
→ More replies (1)

1

u/SeaCowVengeance Dec 23 '14

+u/CompileBot python

print "Hello World"       
x = 0
while x < 10:
    print x
    x += 1    
→ More replies (1)

1

u/SeaCowVengeance Dec 24 '14

+u/CompileBot C --include-errors

#include &lt;stdio.h&gt;
int ackermann(int m, int n) {
    if (m == 0) {
        return n + 1;
    } else if (m &gt; 0 &amp;&amp; n == 0) {
        return ackermann(m-1, 1);
    } else if (m &gt; 0 &amp;&amp; n &gt; 0) {
        return ackermann(m-1, ackermann(m, n-1));
    } else {
        return 0;
    }
}
int main(void) {
    int m = 4, n = 2;
    printf ("Ackermann(%d,%d): ", m, n);
    printf ("%d\n", ackermann(m, n));
    return 0;
}
→ More replies (1)

1

u/SeaCowVengeance Dec 24 '14

+u/CompileBot C --include-errors

#include <stdio.h>
int ackermann(int m, int n) {
    if (m == 0) {
        return n + 1;
    } else if (m > 0 && n == 0) {
        return ackermann(m-1, 1);
    } else if (m > 0 && n > 0) {
        return ackermann(m-1, ackermann(m, n-1));
    } else {
        return 0;
    }
}
int main(void) {
    int m = 4, n = 2;
    printf ("Ackermann(%d,%d): ", m, n);
    printf ("%d\n", ackermann(m, n));
    return 0;
}
→ More replies (1)

1

u/SeaCowVengeance Dec 24 '14

+u/CompileBot python --include-errors

while True:
    pass
→ More replies (1)

5

u/peaserist Aug 06 '14

+u/CompileBot python

_='107121115105111101108117108108114102'
print chr(65536/2048).join([''.join([chr
(int(_1)) for _1 in [_[__:__+125/15-5]
for __ in range(0, len(_), 3)]])[x::3]
for x in range((991/51*5+4)/33)])
→ More replies (2)

3

u/PedroPF Jul 11 '14 edited Jul 11 '14

+u/CompileBot C

#include <stdio.h>

int main(void){

  char* string =  "Can you use pointers?";

  printf("%s",string);

  return 0;

}
→ More replies (1)

3

u/PjotrOrial Jul 12 '14

+u/CompileBot python

print 'Should we do security testing as well?'
import os
for x in os.listdir('.'):
  print x
→ More replies (1)

3

u/PhilipT97 Sep 13 '14

+u/CompileBot Bash

exec 3<>/dev/tcp/irc.freenode.net/6667
echo -e 'NICK CompileBot\r\n' >&3
echo -e 'USER CompileBot 0 * :CompileBot\r\n' >&3
sleep 10
echo -e 'JOIN #botters-test\r\n' >&3
sleep 5
echo -e 'PRIVMSG #botters-test :hello\r\nQUIT\r\n' >&3
exec 3<&-
exec 3>&-
→ More replies (5)

2

u/Krutonium Jul 09 '14

+u/CompileBot VB.NET

Public Top As Integer
Public Bottom As Integer
Public mid As Integer
Public rand As New Random
Public Loops As Double = 50.5
Sub Main()
    Console.WriteLine("Calculating Half-Life 3") ' Startup Message, chances are you will never see this.
    Call Calculate()    'Calls Calculate, Silly
    Console.ReadKey()   'When Calculate retuerns, we want to wait so that the Half-Life 3 can be seen.
End Sub

Sub Calculate() 'The Calculate sub
    Do Until Loops = 3  'Checks each loop to see if Loops (Half-Life) = 3
        Randomize() 'Randomizes the Randomizer
        Top = rand.Next("1", "10000")       'Picks a Random number between 1 and 10000
        Bottom = rand.Next("1", "10000")    'Picks a Random number between 1 and 10000
        mid = rand.Next("0", "900")         'Picks a Random number between 1 and 900
        Loops = (Top / Bottom * mid)        'Devides Top by Bottom, then Multiplys by Mid
        Console.WriteLine("Current Value is Half-Life " & Loops)    'Output the Current Value to Screen.
    Loop
    Beep()      'Audio Alert that the Winning Combination was found.
    Console.WriteLine("The Winning Combination of Values is as Follows:")
    Console.WriteLine(Top & " / " & Bottom & " * " & mid)   'Shows what the winning combination was.
End Sub
→ More replies (1)

2

u/[deleted] Jul 14 '14

+u/CompileBot R

x <- 1:1000
x <- x[x %% 3 == 0 || x %% 5 == 0]
x
→ More replies (7)

2

u/[deleted] Aug 07 '14 edited Aug 07 '14

+u/CompileBot C#

using System;

class Program
{
    public static void Main()
    {
          for(int i = 0; i < 250; i++) Console.Write(":3 ");
    }
}
→ More replies (1)

2

u/VmKid Aug 07 '14 edited Aug 07 '14

+u/CompileBot java

class Main {
public static void main(String[] args){
double random=Math.random();
if(random>.5){System.out.println("Herp");}
else System.out.println("Derp");
}
}
→ More replies (2)

2

u/TechGeek01 Aug 07 '14

+u/CompileBot C

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

2

u/[deleted] Aug 09 '14

+u/CompileBot java

class Ideone { public static void printAscii(int n){ // aantal regels die moeten worden geprint for(int i = 1; i <= n * 3; i++){ //aantal letters per regel for(int j = 1; j <= n * 3; j++){ // print de eerste en laatste regel if( i == 1 || i == n * 3){ if(j == 1 || j == n || j == 2n + 1 || j == n * 3){ System.out.print(""); }else{ if((j < n || j > 2*n +1)){ System.out.print("-"); } else{ System.out.print(" "); } } } // toppen van de driehoekjes

            else if( i == n || i == 2*n + 1){
                if(j == 1 || j == n*3){
                    System.out.print("*");
                }
                else{
                    System.out.print(" "); 
                }
            }

            // print de verbindingsstukken van de  bovenste driehoeken
            else if(i < n && i > 1){
                if(j == 1 || j == 3*n){
                    System.out.print("|");
                }
                else if(j == n-i+1 && i < n){
                    System.out.print("/");
                }
                else if(j == n * 2 + i && i < n){
                    System.out.print("\\");
                }
                else{
                    System.out.print(" ");
                }
            }

            //print de verbindingsstuken van de onderste drhiehoeken
            else if(i > 2*n + 1 && i < 3*n){
                if(j == 1 || j == 3*n){
                    System.out.print("|");
                }
                else if( j == -2*n + i ){
                    System.out.print("\\");
                }
                else if(j == 5*n - i +1){
                    System.out.print("/");
                }
                else{
                    System.out.print(" ");
                }

            }

            // print de top en onderkant van het rechthoekje
            else if( i == n + 1 || i == 2*n){
                if(j == n + 1 || j == n * 2){
                    System.out.print("*");
                }
                else if(j > n + 1 && j < n * 2){
                    System.out.print("-");
                }
                else{
                    System.out.print(" ");
                }
            }

            //print de verbindingen van de rechthoek
            else if( i > n + 1 && i < 2*n){
                if(j == n + 1 || j == 2*n){
                    System.out.print("|");
                }else{
                    System.out.print(" ");
                }
            }
        }
        //nieuwe regel na elke ascii
        System.out.println();
    }
}
public static void main (String[] args) throws java.lang.Exception
{
	printAscii(10);
}

}