def _avoid_opponent(self, active, opponent, target):
    """Computes movement action to avoid a given opponent.

    Args:
      active: Active player.
      opponent: Opponent to be avoided.
      target: Original movement direction of the active player.

    Returns:
      Action to perform to avoid the opponent.
    """
    # Choose a perpendicular direction to the opponent, towards the target.
    delta = opponent - active
    delta_t = target - active
    new_delta = [delta[1], -delta[0]]
    if delta_t[0] * new_delta[0] < 0:
      new_delta = [-new_delta[0], -new_delta[1]]

    return self._direction_action(new_delta)
Computes movement action to avoid a given opponent.

    Args:
      active: Active player.
      opponent: Opponent to be avoided.
      target: Original movement direction of the active player.

    Returns:
      Action to perform to avoid the opponent.
    
gfootball/env/players/bot.py