def flip_observation(observation, config):
  """Observation corresponding to the field rotated by 180 degrees."""
  flipped_observation = {}
  flipped_observation['ball'] = rotate_3d_point(observation['ball'])
  flipped_observation['ball_direction'] = rotate_3d_point(
      observation['ball_direction'])
  flipped_observation['ball_rotation'] = observation['ball_rotation']
  flipped_observation['ball_owned_team'] = 1 - observation[
      'ball_owned_team'] if observation['ball_owned_team'] > -1 else -1
  flipped_observation['ball_owned_player'] = observation['ball_owned_player']
  flipped_observation['score'] = [
      observation['score'][1], observation['score'][0]
  ]
  flipped_observation['game_mode'] = observation['game_mode']
  flipped_observation['steps_left'] = observation['steps_left']
  flip_team_observation(observation, flipped_observation, config, 'left',
                        'right')
  flip_team_observation(observation, flipped_observation, config, 'right',
                        'left')
  return flipped_observation
Observation corresponding to the field rotated by 180 degrees.
gfootball/env/observation_rotation.py