changeset 9:0d1670ab37df

towards useful output
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 26 May 2021 13:52:53 -0400
parents fcef94b6324c
children 73bb35b96624
files python/safe.py
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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))))