# HG changeset patch # User Henry S. Thompson # Date 1622051573 14400 # Node ID 0d1670ab37df583d7950befb299da4c3128bd03e # Parent fcef94b6324c97d87e7a62f14caa3b3041ff9be4 towards useful output diff -r fcef94b6324c -r 0d1670ab37df python/safe.py --- a/python/safe.py Wed May 26 13:16:36 2021 -0400 +++ b/python/safe.py Wed May 26 13:52:53 2021 -0400 @@ -84,15 +84,22 @@ dy=p1[2]-p2[2] return math.sqrt((dx*dx)+(dy*dy)+(dz*dz)) -def unsafe(p): +def safety(p): ka=[(a[0],a[2]) for a in A.points if d(a,p)<=n] return [(k,A.columns[k],L.columns[k]) for k in ka if k in L.columns] readHeaders(sys.modules['__main__'],sys.stdin,False) for l in sys.stdin: c=eval(l) - s=[(p,unsafe(p)) for p in c] - - print(s if s else 'No air',c) - - + ss=[] + hits={} + misses=[] + for p in c: + s=safety(p) + if s: + pass + else: + misses.append(p) + print(c) + print(' %s nearby landing zones'%( + (lambda nm,nc:'No' if nm==nc else nc-nm)(len(misses),len(c))))