• Four To The Floor

 

Hi folk, I have a problem with checking result. There is error message: "ErrorTooLongForProcess". It's my code:

def is_covered(room, sensors):

   coord_room = []
   for i in range(0,room[0]+1):
       for j in range(0,room[1]+1):
           coord_room.append([i,j])

   cover_points = []
   count_sen_point = len(sensors)
   test = 0

   for count_sen in range(count_sen_point):
       center_x_dev = sensors[count_sen][0]
       center_y_dev = sensors[count_sen][1]
       r_dev = sensors[count_sen][2]
       for m in range(center_x_dev - r_dev, center_x_dev + r_dev + 1):
           for n in range(center_y_dev - r_dev, center_y_dev + r_dev + 1):
               test += 1
               hypo = ((center_x_dev - m)**2 + (center_y_dev - n)**2)**0.5
               if r_dev >= hypo and m >= 0 and n >= 0:
                   cover_points.append([m,n])
   #rez= list(set(coord_room).difference(set(cover_points)))
   rez = True
   for r in range(len(coord_room)):
       if coord_room[r] not in cover_points:
           rez = False
           break
   return rez

How can i improve my code?

.