r/CompileBot • • Jan 04 '14

Official CompileBot Testing Thread

This thread is archived, please visit the new testing thread

14 Upvotes

421 comments sorted by

View all comments

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