def min_steps_to_goal(Gx, Gy): if Gx == 0 or Gy == 0: luke_steps = 1 else: luke_steps = 2 if Gx == Gy or Gx == -Gy: bishop_steps = 1 elif (Gx + Gy) % 2 != 0: bishop_steps = float('inf') # Cannot reach else: bishop_steps = 2 return min(luke_steps, bishop_steps)