Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return self._backend_action >= other._backend_action
def __hash__(self):
return self._backend_action
def __repr__(self):
return self._name
action_idle = CoreAction(e_BackendAction.idle, "idle")
action_builtin_ai = CoreAction(e_BackendAction.builtin_ai, "builtin_ai")
action_left = CoreAction(
e_BackendAction.left, "left", sticky=True, directional=True)
action_top_left = CoreAction(
e_BackendAction.top_left, "top_left", sticky=True, directional=True)
action_top = CoreAction(
e_BackendAction.top, "top", sticky=True, directional=True)
action_top_right = CoreAction(
e_BackendAction.top_right, "top_right", sticky=True, directional=True)
action_right = CoreAction(
e_BackendAction.right, "right", sticky=True, directional=True)
action_bottom_right = CoreAction(
e_BackendAction.bottom_right, "bottom_right", sticky=True, directional=True)
action_bottom = CoreAction(
e_BackendAction.bottom, "bottom", sticky=True, directional=True)
action_bottom_left = CoreAction(
e_BackendAction.bottom_left, "bottom_left", sticky=True, directional=True)
action_long_pass = CoreAction(e_BackendAction.long_pass, "long_pass")
action_high_pass = CoreAction(e_BackendAction.high_pass, "high_pass")
action_short_pass = CoreAction(e_BackendAction.short_pass, "short_pass")
action_shot = CoreAction(e_BackendAction.shot, "shot")
action_keeper_rush = CoreAction(
action_switch = CoreAction(e_BackendAction.switch, "switch")
action_sprint = CoreAction(e_BackendAction.sprint, "sprint", sticky=True)
action_dribble = CoreAction(
e_BackendAction.dribble, "dribble", sticky=True)
action_release_direction = CoreAction(
e_BackendAction.release_direction, "release_direction", directional=True)
action_release_long_pass = CoreAction(e_BackendAction.release_long_pass,
"release_long_pass")
action_release_high_pass = CoreAction(e_BackendAction.release_high_pass,
"release_high_pass")
action_release_short_pass = CoreAction(e_BackendAction.release_short_pass,
"release_short_pass")
action_release_shot = CoreAction(e_BackendAction.release_shot, "release_shot")
action_release_keeper_rush = CoreAction(e_BackendAction.release_keeper_rush,
"release_keeper_rush")
action_release_sliding = CoreAction(e_BackendAction.release_sliding,
"release_sliding")
action_release_pressure = CoreAction(e_BackendAction.release_pressure,
"release_pressure")
action_release_team_pressure = CoreAction(e_BackendAction.release_team_pressure,
"release_team_pressure")
action_release_switch = CoreAction(e_BackendAction.release_switch,
"release_switch")
action_release_sprint = CoreAction(e_BackendAction.release_sprint,
"release_sprint")
action_release_dribble = CoreAction(e_BackendAction.release_dribble,
"release_dribble")
# ***** Define some action sets *****
action_set_v1 = [
action_idle, action_left, action_top_left, action_top,
action_top_right, action_right, action_bottom_right,
def __repr__(self):
return self._name
action_idle = CoreAction(e_BackendAction.idle, "idle")
action_builtin_ai = CoreAction(e_BackendAction.builtin_ai, "builtin_ai")
action_left = CoreAction(
e_BackendAction.left, "left", sticky=True, directional=True)
action_top_left = CoreAction(
e_BackendAction.top_left, "top_left", sticky=True, directional=True)
action_top = CoreAction(
e_BackendAction.top, "top", sticky=True, directional=True)
action_top_right = CoreAction(
e_BackendAction.top_right, "top_right", sticky=True, directional=True)
action_right = CoreAction(
e_BackendAction.right, "right", sticky=True, directional=True)
action_bottom_right = CoreAction(
e_BackendAction.bottom_right, "bottom_right", sticky=True, directional=True)
action_bottom = CoreAction(
e_BackendAction.bottom, "bottom", sticky=True, directional=True)
action_bottom_left = CoreAction(
e_BackendAction.bottom_left, "bottom_left", sticky=True, directional=True)
action_long_pass = CoreAction(e_BackendAction.long_pass, "long_pass")
action_high_pass = CoreAction(e_BackendAction.high_pass, "high_pass")
action_short_pass = CoreAction(e_BackendAction.short_pass, "short_pass")
action_shot = CoreAction(e_BackendAction.shot, "shot")
action_keeper_rush = CoreAction(
e_BackendAction.keeper_rush, "keeper_rush", sticky=True)
action_sliding = CoreAction(e_BackendAction.sliding, "sliding")
action_pressure = CoreAction(
e_BackendAction.pressure, "pressure", sticky=True)
action_keeper_rush = CoreAction(
e_BackendAction.keeper_rush, "keeper_rush", sticky=True)
action_sliding = CoreAction(e_BackendAction.sliding, "sliding")
action_pressure = CoreAction(
e_BackendAction.pressure, "pressure", sticky=True)
action_team_pressure = CoreAction(
e_BackendAction.team_pressure, "team_pressure", sticky=True)
action_switch = CoreAction(e_BackendAction.switch, "switch")
action_sprint = CoreAction(e_BackendAction.sprint, "sprint", sticky=True)
action_dribble = CoreAction(
e_BackendAction.dribble, "dribble", sticky=True)
action_release_direction = CoreAction(
e_BackendAction.release_direction, "release_direction", directional=True)
action_release_long_pass = CoreAction(e_BackendAction.release_long_pass,
"release_long_pass")
action_release_high_pass = CoreAction(e_BackendAction.release_high_pass,
"release_high_pass")
action_release_short_pass = CoreAction(e_BackendAction.release_short_pass,
"release_short_pass")
action_release_shot = CoreAction(e_BackendAction.release_shot, "release_shot")
action_release_keeper_rush = CoreAction(e_BackendAction.release_keeper_rush,
"release_keeper_rush")
action_release_sliding = CoreAction(e_BackendAction.release_sliding,
"release_sliding")
action_release_pressure = CoreAction(e_BackendAction.release_pressure,
"release_pressure")
action_release_team_pressure = CoreAction(e_BackendAction.release_team_pressure,
"release_team_pressure")
action_release_switch = CoreAction(e_BackendAction.release_switch,
"release_switch")
action_release_sprint = CoreAction(e_BackendAction.release_sprint,
"release_sprint")
action_top_left = CoreAction(
e_BackendAction.top_left, "top_left", sticky=True, directional=True)
action_top = CoreAction(
e_BackendAction.top, "top", sticky=True, directional=True)
action_top_right = CoreAction(
e_BackendAction.top_right, "top_right", sticky=True, directional=True)
action_right = CoreAction(
e_BackendAction.right, "right", sticky=True, directional=True)
action_bottom_right = CoreAction(
e_BackendAction.bottom_right, "bottom_right", sticky=True, directional=True)
action_bottom = CoreAction(
e_BackendAction.bottom, "bottom", sticky=True, directional=True)
action_bottom_left = CoreAction(
e_BackendAction.bottom_left, "bottom_left", sticky=True, directional=True)
action_long_pass = CoreAction(e_BackendAction.long_pass, "long_pass")
action_high_pass = CoreAction(e_BackendAction.high_pass, "high_pass")
action_short_pass = CoreAction(e_BackendAction.short_pass, "short_pass")
action_shot = CoreAction(e_BackendAction.shot, "shot")
action_keeper_rush = CoreAction(
e_BackendAction.keeper_rush, "keeper_rush", sticky=True)
action_sliding = CoreAction(e_BackendAction.sliding, "sliding")
action_pressure = CoreAction(
e_BackendAction.pressure, "pressure", sticky=True)
action_team_pressure = CoreAction(
e_BackendAction.team_pressure, "team_pressure", sticky=True)
action_switch = CoreAction(e_BackendAction.switch, "switch")
action_sprint = CoreAction(e_BackendAction.sprint, "sprint", sticky=True)
action_dribble = CoreAction(
e_BackendAction.dribble, "dribble", sticky=True)
action_release_direction = CoreAction(
e_BackendAction.release_direction, "release_direction", directional=True)
action_release_long_pass = CoreAction(e_BackendAction.release_long_pass,
return self._name
action_idle = CoreAction(e_BackendAction.idle, "idle")
action_builtin_ai = CoreAction(e_BackendAction.builtin_ai, "builtin_ai")
action_left = CoreAction(
e_BackendAction.left, "left", sticky=True, directional=True)
action_top_left = CoreAction(
e_BackendAction.top_left, "top_left", sticky=True, directional=True)
action_top = CoreAction(
e_BackendAction.top, "top", sticky=True, directional=True)
action_top_right = CoreAction(
e_BackendAction.top_right, "top_right", sticky=True, directional=True)
action_right = CoreAction(
e_BackendAction.right, "right", sticky=True, directional=True)
action_bottom_right = CoreAction(
e_BackendAction.bottom_right, "bottom_right", sticky=True, directional=True)
action_bottom = CoreAction(
e_BackendAction.bottom, "bottom", sticky=True, directional=True)
action_bottom_left = CoreAction(
e_BackendAction.bottom_left, "bottom_left", sticky=True, directional=True)
action_long_pass = CoreAction(e_BackendAction.long_pass, "long_pass")
action_high_pass = CoreAction(e_BackendAction.high_pass, "high_pass")
action_short_pass = CoreAction(e_BackendAction.short_pass, "short_pass")
action_shot = CoreAction(e_BackendAction.shot, "shot")
action_keeper_rush = CoreAction(
e_BackendAction.keeper_rush, "keeper_rush", sticky=True)
action_sliding = CoreAction(e_BackendAction.sliding, "sliding")
action_pressure = CoreAction(
e_BackendAction.pressure, "pressure", sticky=True)
action_team_pressure = CoreAction(
e_BackendAction.team_pressure, "team_pressure", sticky=True)
def _check_direction(self, action, state):
"""Compare (and update) controller's direction with the current direction.
Args:
action: Action to check
state: Current state of the action being checked
"""
assert isinstance(action, football_action_set.CoreAction)
if not action.is_in_actionset(self._env_config):
return
if self._current_direction != football_action_set.action_idle:
return
if state:
self._current_direction = action
action_release_long_pass = CoreAction(e_BackendAction.release_long_pass,
"release_long_pass")
action_release_high_pass = CoreAction(e_BackendAction.release_high_pass,
"release_high_pass")
action_release_short_pass = CoreAction(e_BackendAction.release_short_pass,
"release_short_pass")
action_release_shot = CoreAction(e_BackendAction.release_shot, "release_shot")
action_release_keeper_rush = CoreAction(e_BackendAction.release_keeper_rush,
"release_keeper_rush")
action_release_sliding = CoreAction(e_BackendAction.release_sliding,
"release_sliding")
action_release_pressure = CoreAction(e_BackendAction.release_pressure,
"release_pressure")
action_release_team_pressure = CoreAction(e_BackendAction.release_team_pressure,
"release_team_pressure")
action_release_switch = CoreAction(e_BackendAction.release_switch,
"release_switch")
action_release_sprint = CoreAction(e_BackendAction.release_sprint,
"release_sprint")
action_release_dribble = CoreAction(e_BackendAction.release_dribble,
"release_dribble")
# ***** Define some action sets *****
action_set_v1 = [
action_idle, action_left, action_top_left, action_top,
action_top_right, action_right, action_bottom_right,
action_bottom, action_bottom_left, action_long_pass,
action_high_pass, action_short_pass, action_shot,
action_sprint, action_release_direction, action_release_sprint,
action_sliding, action_dribble, action_release_dribble]
action_set_v2 = action_set_v1 + [action_builtin_ai]
action_bottom_right = CoreAction(
e_BackendAction.bottom_right, "bottom_right", sticky=True, directional=True)
action_bottom = CoreAction(
e_BackendAction.bottom, "bottom", sticky=True, directional=True)
action_bottom_left = CoreAction(
e_BackendAction.bottom_left, "bottom_left", sticky=True, directional=True)
action_long_pass = CoreAction(e_BackendAction.long_pass, "long_pass")
action_high_pass = CoreAction(e_BackendAction.high_pass, "high_pass")
action_short_pass = CoreAction(e_BackendAction.short_pass, "short_pass")
action_shot = CoreAction(e_BackendAction.shot, "shot")
action_keeper_rush = CoreAction(
e_BackendAction.keeper_rush, "keeper_rush", sticky=True)
action_sliding = CoreAction(e_BackendAction.sliding, "sliding")
action_pressure = CoreAction(
e_BackendAction.pressure, "pressure", sticky=True)
action_team_pressure = CoreAction(
e_BackendAction.team_pressure, "team_pressure", sticky=True)
action_switch = CoreAction(e_BackendAction.switch, "switch")
action_sprint = CoreAction(e_BackendAction.sprint, "sprint", sticky=True)
action_dribble = CoreAction(
e_BackendAction.dribble, "dribble", sticky=True)
action_release_direction = CoreAction(
e_BackendAction.release_direction, "release_direction", directional=True)
action_release_long_pass = CoreAction(e_BackendAction.release_long_pass,
"release_long_pass")
action_release_high_pass = CoreAction(e_BackendAction.release_high_pass,
"release_high_pass")
action_release_short_pass = CoreAction(e_BackendAction.release_short_pass,
"release_short_pass")
action_release_shot = CoreAction(e_BackendAction.release_shot, "release_shot")
action_release_keeper_rush = CoreAction(e_BackendAction.release_keeper_rush,
"release_keeper_rush")
action_right = CoreAction(
e_BackendAction.right, "right", sticky=True, directional=True)
action_bottom_right = CoreAction(
e_BackendAction.bottom_right, "bottom_right", sticky=True, directional=True)
action_bottom = CoreAction(
e_BackendAction.bottom, "bottom", sticky=True, directional=True)
action_bottom_left = CoreAction(
e_BackendAction.bottom_left, "bottom_left", sticky=True, directional=True)
action_long_pass = CoreAction(e_BackendAction.long_pass, "long_pass")
action_high_pass = CoreAction(e_BackendAction.high_pass, "high_pass")
action_short_pass = CoreAction(e_BackendAction.short_pass, "short_pass")
action_shot = CoreAction(e_BackendAction.shot, "shot")
action_keeper_rush = CoreAction(
e_BackendAction.keeper_rush, "keeper_rush", sticky=True)
action_sliding = CoreAction(e_BackendAction.sliding, "sliding")
action_pressure = CoreAction(
e_BackendAction.pressure, "pressure", sticky=True)
action_team_pressure = CoreAction(
e_BackendAction.team_pressure, "team_pressure", sticky=True)
action_switch = CoreAction(e_BackendAction.switch, "switch")
action_sprint = CoreAction(e_BackendAction.sprint, "sprint", sticky=True)
action_dribble = CoreAction(
e_BackendAction.dribble, "dribble", sticky=True)
action_release_direction = CoreAction(
e_BackendAction.release_direction, "release_direction", directional=True)
action_release_long_pass = CoreAction(e_BackendAction.release_long_pass,
"release_long_pass")
action_release_high_pass = CoreAction(e_BackendAction.release_high_pass,
"release_high_pass")
action_release_short_pass = CoreAction(e_BackendAction.release_short_pass,
"release_short_pass")
action_release_shot = CoreAction(e_BackendAction.release_shot, "release_shot")