Почему при начальных данных:
1
2
1 1
2 2
3 3
0
Выдает Take_coin, а не Go_to_coin ?
Исходный код:
class Position: def __init__(self, x, y): self.x = x self.y = y def __eq__(self, other): return self.x == other.x and self.y == other.y class Coin: def __init__(self, position): self.position = position class Seeker: def __init__(self, position, has_coin): self.position = position self.has_coin = has_coin def take_coin_condition(coins, seeker): return seeker.__eq__(coins) and not has_coin def go_to_coin_condition(coins, seeker): return (not seeker.__eq__(coins)) and not has_coin def get_action(maze, coins, seeker, opponent_seeker): if take_coin_condition(coins, seeker): return "Take_coin" if go_to_coin_condition(coins, seeker): return "Go_to_coin" return "Go_to_base" # Input number_of_queries = int(input()) for i in range(number_of_queries): number_of_coins = int(input()) coins = [] for j in range(number_of_coins): x, y = [int(x) for x in input().split()] coins.append(Coin(Position(x, y))) x, y = [int(x) for x in input().split()] has_coin = bool(int(input())) seeker = Seeker(Position(x, y), has_coin) print(get_action(None, coins, seeker, None))