algorithm for attackable and reachable
algorithm for attackable and reachable fix