def __init__(self, p_game_state): super().__init__(p_game_state) self.passing_ID = 5 self.player_ID_no1 = 2 self.player_ID_no2 = 3 self.goal_ID = None self.goal = (Pose(Position(self.game_state.const["FIELD_GOAL_YELLOW_X_LEFT"], 0), 0)) self.add_tactic(self.passing_ID, Stop(self.game_state, self.passing_ID)) self.add_tactic(self.passing_ID, PassToPlayer(self.game_state, self.passing_ID, target_id=self.player_ID_no1)) self.add_tactic(self.passing_ID, PassToPlayer(self.game_state, self.passing_ID, target_id=self.player_ID_no2)) self.add_tactic(self.passing_ID, GoKick(self.game_state, self.passing_ID, self.goal)) self.add_condition(self.passing_ID, 0, 1, partial(self.is_best_receiver, self.player_ID_no1)) self.add_condition(self.passing_ID, 0, 2, partial(self.is_best_receiver, self.player_ID_no2)) self.add_condition(self.passing_ID, 0, 3, partial(self.is_best_receiver, None)) self.add_condition(self.passing_ID, 1, 0, partial(self.condition, self.passing_ID)) self.add_condition(self.passing_ID, 2, 0, partial(self.condition, self.passing_ID)) self.add_condition(self.passing_ID, 3, 0, partial(self.condition, self.passing_ID)) for i in range(PLAYER_PER_TEAM): if not (i == self.passing_ID): self.add_tactic(i, Stop(self.game_state, i))
def __init__(self, p_game_state): super().__init__(p_game_state) goalkeeper = self.game_state.get_player_by_role(Role.GOALKEEPER) roles_to_consider = [Role.FIRST_ATTACK, Role.SECOND_ATTACK, Role.MIDDLE] role_by_robots = [(i, self.game_state.get_player_by_role(i)) for i in roles_to_consider] self.goal_ID = None self.goal = (Pose(Position(self.game_state.const["FIELD_THEIR_GOAL_X_EXTERNAL"], 0), 0)) self.add_tactic(Role.FIRST_ATTACK, PassToPlayer(self.game_state, self.game_state.get_player_by_role(Role.FIRST_ATTACK), target_id=self.game_state.get_player_by_role(Role.SECOND_ATTACK).id)) self.add_tactic(Role.FIRST_ATTACK, PassToPlayer(self.game_state, self.game_state.get_player_by_role(Role.FIRST_ATTACK), target_id=self.game_state.get_player_by_role(Role.MIDDLE).id)) self.add_tactic(Role.FIRST_ATTACK, GoKick(self.game_state, self.game_state.get_player_by_role(Role.FIRST_ATTACK), self.goal)) self.add_condition(Role.FIRST_ATTACK, 0, 1, partial(self.is_best_receiver, Role.SECOND_ATTACK)) self.add_condition(Role.FIRST_ATTACK, 0, 2, partial(self.is_best_receiver, Role.MIDDLE)) self.add_condition(Role.FIRST_ATTACK, 0, 0, partial(self.condition, Role.FIRST_ATTACK)) self.add_condition(Role.FIRST_ATTACK, 1, 0, partial(self.condition, Role.FIRST_ATTACK)) self.add_condition(Role.FIRST_ATTACK, 2, 0, partial(self.condition, Role.FIRST_ATTACK)) for i in roles_to_consider: if not (i == Role.FIRST_ATTACK): self.add_tactic(i, Stop(self.game_state, self.game_state.get_player_by_role(i)))
def __init__(self, p_game_state): super().__init__(p_game_state) self.goalkeeper = 3 self.passing_robot = 5 self.receiver = 4 goal1 = Pose(Position(-1636, 0)) goal2 = Pose(Position(1636, 0)) self.add_tactic(self.goalkeeper, GoalKeeper(self.game_state, self.goalkeeper)) receiver_pose = Pose(Position(-500, -500)) self.add_tactic( self.receiver, PositionForPass(self.game_state, self.receiver, receiver_pose)) self.add_tactic(self.receiver, GoKick(self.game_state, self.receiver, goal1)) self.add_condition( self.receiver, 0, 1, partial(self.is_passing_robot_success, self.receiver)) self.add_condition( self.receiver, 1, 0, partial(self.has_receiver_kicked_to_goal, self.receiver)) self.add_tactic( self.passing_robot, Capture(self.game_state, self.passing_robot, receiver_pose)) self.add_tactic( self.passing_robot, GoKick(self.game_state, self.passing_robot, receiver_pose)) self.add_tactic(self.passing_robot, Stop(self.game_state, self.passing_robot)) self.add_condition(self.passing_robot, 0, 1, partial(self.is_receiver_ready, self.passing_robot)) self.add_condition( self.passing_robot, 1, 2, partial(self.is_passing_robot_success, self.passing_robot)) self.add_condition( self.passing_robot, 2, 0, partial(self.has_receiver_kicked_to_goal, self.passing_robot)) self.add_condition(self.passing_robot, 2, 1, partial(self.is_receiver_ready, self.passing_robot)) for i in range(PLAYER_PER_TEAM): if not (i == self.goalkeeper or i == self.passing_robot or i == self.receiver): self.add_tactic(i, Stop(self.game_state, i))
def __init__(self, p_game_state): super().__init__(p_game_state) middle_player = self.assigned_roles[Role.MIDDLE] self.clear_graph_of_role(Role.MIDDLE) self.create_node( Role.MIDDLE, GoKick(self.game_state, middle_player, self.game_state.field.their_goal_pose))
def go_kick_high(self): if not self._is_close_enough_from_goal(): self.go_kick_tactic = None self.next_state = self.go_kick_low return Idle if self.go_kick_tactic is None: self.go_kick_tactic = GoKick(self.game_state, self.player, kick_force=KickForce.HIGH, auto_update_target=True) if self.go_kick_tactic.status_flag == Flags.SUCCESS: self.go_kick_tactic.status_flag = Flags.INIT return self.go_kick_tactic.exec()
def go_kick_low(self): if self._is_close_enough_from_goal(): self.go_kick_tactic = None self.next_state = self.go_kick_high return Idle if self.go_kick_tactic is None: self.go_kick_tactic = GoKick( self.game_state, self.player, kick_force=KickForce.LOW, target=self.game_state.field.their_goal_pose) if self.go_kick_tactic.status_flag == Flags.SUCCESS: self.go_kick_tactic.status_flag = Flags.INIT return self.go_kick_tactic.exec()
def go_kick(self): self.compute_wall_segment() if self.go_kick_tactic is None: self.go_kick_tactic = GoKick(self.game_state, self.player, target=self.game_state.field.their_goal_pose) if not self._should_ball_be_kick_by_wall() \ or self.game_state.field.is_ball_in_our_goal_area() \ or not self._is_closest_not_goaler(self.player) \ or not self._no_enemy_around_ball(): self.go_kick_tactic = None self.next_state = self.main_state return Idle else: return self.go_kick_tactic.exec()
def __init__(self, p_game_state): super().__init__(p_game_state, keep_roles=False) # TODO: HARDCODED ID FOR QUALIFICATION, REMOVE LATER self.roles_graph = {r: Graph() for r in Role} role_mapping = { Role.GOALKEEPER: 2, Role.MIDDLE: 4, Role.FIRST_ATTACK: 6 } self.game_state.map_players_to_roles_by_player_id(role_mapping) ourgoal = Pose( Position(GameState().const["FIELD_OUR_GOAL_X_EXTERNAL"], 0), 0) self.theirgoal = Pose( Position(GameState().const["FIELD_THEIR_GOAL_X_EXTERNAL"], 0), 0) roles_to_consider = [Role.MIDDLE, Role.FIRST_ATTACK, Role.GOALKEEPER] role_by_robots = [(i, self.game_state.get_player_by_role(i)) for i in roles_to_consider] self.robots = [ player for _, player in role_by_robots if player is not None ] goalkeeper = self.game_state.get_player_by_role(Role.GOALKEEPER) self.add_tactic( Role.GOALKEEPER, GoalKeeper(self.game_state, goalkeeper, ourgoal, penalty_kick=True)) for index, player in role_by_robots: if player: self.add_tactic( index, PositionForPass(self.game_state, player, auto_position=True, robots_in_formation=self.robots)) self.add_tactic( index, GoKick(self.game_state, player, target=self.theirgoal)) self.add_condition(index, 0, 1, partial(self.is_closest, player)) self.add_condition(index, 1, 0, partial(self.is_not_closest, player)) self.add_condition(index, 1, 1, partial(self.has_kicked, player))
def clear(self): # Move the ball to outside of the penality zone if self.go_kick_tactic is None: self.go_kick_tactic = GoKick( self.game_state, self.player, auto_update_target=True, go_behind_distance=1.2 * GRAB_BALL_SPACING, forbidden_areas=self.forbidden_areas) # make it easier if not self._is_ball_safe_to_kick(): self.next_state = self.defense self.go_kick_tactic = None return Idle else: return self.go_kick_tactic.exec()
def __init__(self, game_state: GameState, number_of_players: int = 3): super().__init__(game_state) role_mapping = { Role.GOALKEEPER: 4, Role.FIRST_ATTACK: 3, Role.SECOND_ATTACK: 2 } self.game_state.map_players_to_roles_by_player_id(role_mapping) self.number_of_players = number_of_players self.robots = [] ourgoal = Pose( Position(GameState().const["FIELD_OUR_GOAL_X_EXTERNAL"], 0), 0) self.theirgoal = Pose( Position(GameState().const["FIELD_THEIR_GOAL_X_EXTERNAL"], 0), 0) roles_to_consider = [Role.FIRST_ATTACK, Role.SECOND_ATTACK] goalkeeper = self.game_state.get_player_by_role(Role.GOALKEEPER) self.add_tactic( Role.GOALKEEPER, GoalKeeper(self.game_state, goalkeeper, target=ourgoal)) role_by_robots = [(i, self.game_state.get_player_by_role(i)) for i in roles_to_consider] self.robots = [ player for _, player in role_by_robots if player is not None ] for role, player in role_by_robots: if player: self.add_tactic( role, AlignToDefenseWall(self.game_state, player, self.robots)) self.add_tactic( role, GoKick(self.game_state, player, target=self.theirgoal)) self.add_condition(role, 0, 1, partial(self.is_closest, player)) self.add_condition(role, 1, 1, partial(self.is_closest, player)) self.add_condition(role, 1, 0, partial(self.is_not_closest, player))
def __init__(self, game_state): super().__init__(game_state) our_goal = game_state.field.our_goal_pose their_goal = game_state.field.their_goal_pose role_to_positions = {Role.SECOND_ATTACK: Pose.from_values(our_goal.position.x / 8, GameState().field.top * 2 / 3), Role.MIDDLE: Pose.from_values(our_goal.position.x / 8, GameState().field.top / 3), Role.FIRST_DEFENCE: Pose.from_values(our_goal.position.x / 8, GameState().field.bottom / 3), Role.SECOND_DEFENCE: Pose.from_values(our_goal.position.x / 8, GameState().field.bottom * 2 / 3)} kicker = self.assigned_roles[Role.FIRST_ATTACK] self.create_node(Role.FIRST_ATTACK, GoKick(game_state, kicker, their_goal, kick_force=KickForce.HIGH)) goalkeeper = self.assigned_roles[Role.GOALKEEPER] self.create_node(Role.GOALKEEPER, GoalKeeper(game_state, goalkeeper, penalty_kick=True)) self.assign_tactics(role_to_positions)
def __init__(self, p_game_state): super().__init__(p_game_state) our_goal = self.game_state.field.our_goal_pose self.create_node(Role.GOALKEEPER, GoalKeeper(self.game_state, self.assigned_roles[Role.GOALKEEPER])) attacker = self.assigned_roles[Role.FIRST_ATTACK] node_idle = self.create_node(Role.FIRST_ATTACK, Stop(self.game_state, attacker)) node_go_kick = self.create_node(Role.FIRST_ATTACK, GoKick(self.game_state, attacker, target=our_goal, kick_force=KickForce.HIGH)) player_has_kicked = partial(self.has_kicked, Role.FIRST_ATTACK) node_idle.connect_to(node_go_kick, when=self.ball_is_outside_goal) node_go_kick.connect_to(node_idle, when=self.ball_is_inside_goal) node_go_kick.connect_to(node_go_kick, when=player_has_kicked)
def __init__(self, p_game_state): super().__init__(p_game_state) robots_in_formation = [ p for r, p in self.assigned_roles.items() if r != Role.GOALKEEPER ] for role, player in self.assigned_roles.items(): if role is Role.GOALKEEPER: self.create_node(role, GoalKeeper(self.game_state, player)) else: node_pass = self.create_node( role, PositionForPass(self.game_state, player, auto_position=True, robots_in_formation=robots_in_formation)) node_go_kick = self.create_node( role, GoKick(self.game_state, player, auto_update_target=True)) node_wait_for_pass = self.create_node( role, ReceivePass(self.game_state, player)) player_is_closest = partial(self.is_closest_not_goalkeeper, player) player_is_not_closest = partial(self.is_not_closest, player) player_has_kicked = partial(self.has_kicked, player) player_is_receiving_pass = partial( self.ball_going_toward_player, player) player_is_not_receiving_pass = partial( self.ball_not_going_toward_player, player) player_has_received_ball = partial(self.has_received, player) node_pass.connect_to(node_go_kick, when=player_is_closest) node_pass.connect_to(node_wait_for_pass, when=player_is_receiving_pass) node_wait_for_pass.connect_to(node_go_kick, when=player_has_received_ball) node_wait_for_pass.connect_to( node_pass, when=player_is_not_receiving_pass) node_go_kick.connect_to(node_pass, when=player_is_not_closest) node_go_kick.connect_to(node_go_kick, when=player_has_kicked)
def __init__(self, p_game_state): super().__init__(p_game_state) their_goal = self.game_state.field.their_goal_pose node_pass_to_second_attack = self.create_node( Role.FIRST_ATTACK, PassToPlayer(self.game_state, self.assigned_roles[Role.FIRST_ATTACK], args=[self.assigned_roles[Role.SECOND_ATTACK].id])) node_pass_to_middle = self.create_node( Role.FIRST_ATTACK, PassToPlayer(self.game_state, self.assigned_roles[Role.FIRST_ATTACK], args=[self.assigned_roles[Role.MIDDLE].id])) node_go_kick = self.create_node( Role.FIRST_ATTACK, GoKick(self.game_state, self.assigned_roles[Role.FIRST_ATTACK], their_goal)) second_attack_is_best_receiver = partial(self.is_best_receiver, Role.SECOND_ATTACK) middle_is_best_receiver = partial(self.is_best_receiver, Role.MIDDLE) current_tactic_succeeded = partial(self.current_tactic_succeed, Role.FIRST_ATTACK) node_pass_to_second_attack.connect_to( node_pass_to_middle, when=second_attack_is_best_receiver) node_pass_to_second_attack.connect_to(node_go_kick, when=middle_is_best_receiver) node_pass_to_second_attack.connect_to(node_pass_to_second_attack, when=current_tactic_succeeded) node_pass_to_middle.connect_to(node_pass_to_second_attack, when=current_tactic_succeeded) node_go_kick.connect_to(node_pass_to_second_attack, when=current_tactic_succeeded) self.create_node( Role.GOALKEEPER, GoalKeeper(self.game_state, self.assigned_roles[Role.GOALKEEPER]))
def __init__(self, p_game_state): super().__init__(p_game_state) self.theirgoal = Pose( Position(GameState().const["FIELD_THEIR_GOAL_X_EXTERNAL"], 0), 0) roles_to_consider = [ Role.FIRST_ATTACK, Role.SECOND_ATTACK, Role.GOALKEEPER, Role.FIRST_DEFENCE, Role.SECOND_DEFENCE ] role_by_robots = [(i, self.game_state.get_player_by_role(i)) for i in roles_to_consider] middle_player = self.game_state.get_player_by_role(Role.MIDDLE) self.add_tactic(Role.MIDDLE, GoKick(self.game_state, middle_player, self.theirgoal)) for index, player in role_by_robots: if player: self.add_tactic(index, Stop(self.game_state, player))
def __init__(self, p_game_state): super().__init__(p_game_state) ourgoal = Pose(Position(GameState().const["FIELD_OUR_GOAL_X_EXTERNAL"], 0), 0) self.theirgoal = Pose(Position(GameState().const["FIELD_THEIR_GOAL_X_EXTERNAL"], 0), 0) roles_to_consider = [Role.FIRST_ATTACK, Role.SECOND_ATTACK, Role.MIDDLE, Role.FIRST_DEFENCE, Role.SECOND_DEFENCE] role_by_robots = [(i, self.game_state.get_player_by_role(i)) for i in roles_to_consider] goalkeeper = self.game_state.get_player_by_role(Role.GOALKEEPER) self.add_tactic(Role.GOALKEEPER, GoalKeeper(self.game_state, goalkeeper, ourgoal)) for index, player in role_by_robots: if player: self.add_tactic(index, PositionForPass(self.game_state, player, auto_position=True)) self.add_tactic(index, GoKick(self.game_state, player, auto_update_target=True)) self.add_condition(index, 0, 1, partial(self.is_closest, player)) self.add_condition(index, 1, 0, partial(self.is_not_closest, player)) self.add_condition(index, 1, 1, partial(self.has_kicked, player))
def __init__(self, p_game_state): super().__init__(p_game_state) ourgoal = Pose(Position(GameState().const["FIELD_OUR_GOAL_X_EXTERNAL"], 0), 0) self.theirgoal = Pose(Position(GameState().const["FIELD_THEIR_GOAL_X_EXTERNAL"], 0), 0) roles_in_waiting_line = [Role.SECOND_ATTACK, Role.MIDDLE, Role.FIRST_DEFENCE, Role.SECOND_DEFENCE] position_list = [Pose(Position(ourgoal.position.x / 8, GameState().const["FIELD_Y_TOP"] * 2 / 3)), Pose(Position(ourgoal.position.x / 8, GameState().const["FIELD_Y_TOP"] / 3)), Pose(Position(ourgoal.position.x / 8, GameState().const["FIELD_Y_BOTTOM"] / 3)), Pose(Position(ourgoal.position.x / 8, GameState().const["FIELD_Y_BOTTOM"] * 2 / 3))] postions_for_roles = dict(zip(roles_in_waiting_line, position_list)) goalkeeper = self.game_state.get_player_by_role(Role.GOALKEEPER) self.add_tactic(Role.GOALKEEPER, GoToPositionPathfinder(self.game_state, goalkeeper, ourgoal)) kicker = self.game_state.get_player_by_role(Role.FIRST_ATTACK) self.add_tactic(Role.FIRST_ATTACK, GoKick(self.game_state, kicker, self.theirgoal)) for role in roles_in_waiting_line: position = postions_for_roles[role] player = self.game_state.get_player_by_role(role) if player: self.add_tactic(role, GoToPositionPathfinder(self.game_state, player, position))
def __init__(self, p_game_state, can_kick_in_goal): super().__init__(p_game_state) formation = [ p for r, p in self.assigned_roles.items() if r != Role.GOALKEEPER ] forbidden_areas = [ self.game_state.field.free_kick_avoid_area, self.game_state.field.our_goal_forbidden_area ] initial_position_for_pass_center = {} for role, player in self.assigned_roles.items(): if role == Role.GOALKEEPER: self.create_node(Role.GOALKEEPER, GoalKeeper(self.game_state, player)) else: node_pass = self.create_node( role, PositionForPass( self.game_state, player, robots_in_formation=formation, auto_position=True, forbidden_areas=self.game_state.field.border_limits + forbidden_areas)) node_wait_for_pass = self.create_node( role, ReceivePass(self.game_state, player)) initial_position_for_pass_center[ role] = node_pass.tactic.area.center # Hack node_go_kick = self.create_node( role, GoKick( self.game_state, player, auto_update_target=True, can_kick_in_goal=can_kick_in_goal, forbidden_areas=self.game_state.field.border_limits + forbidden_areas)) player_is_not_closest = partial(self.is_not_closest, player) player_has_kicked = partial(self.has_kicked, player) player_is_receiving_pass = partial( self.ball_going_toward_player, player) player_is_not_receiving_pass = partial( self.ball_not_going_toward_player, player) player_has_received_ball = partial(self.has_received, player) player_is_closest = partial(self.is_closest_not_goalkeeper, player) node_pass.connect_to(node_wait_for_pass, when=player_is_receiving_pass) node_pass.connect_to(node_go_kick, when=player_is_closest) node_wait_for_pass.connect_to(node_go_kick, when=player_has_received_ball) node_wait_for_pass.connect_to( node_pass, when=player_is_not_receiving_pass) node_go_kick.connect_to(node_pass, when=player_is_not_closest) node_go_kick.connect_to(node_go_kick, when=player_has_kicked) # Find position for ball player closest to ball self.closest_role = None ball_position = self.game_state.ball_position for r, position in initial_position_for_pass_center.items(): if self.closest_role is None \ or (initial_position_for_pass_center[self.closest_role] - ball_position).norm > (position - ball_position).norm: self.closest_role = r self.has_ball_move = False
def __init__(self, game_state: GameState, can_kick=True, multiple_cover=True, stay_away_from_ball=False): super().__init__(game_state) their_goal = self.game_state.field.their_goal_pose # If we can not kick, the attackers are part of the defense wall # TODO find a more useful thing to do for the attackers when we are in a no kick state self.can_kick = can_kick self.multiple_cover = multiple_cover self.defensive_role = DEFENSIVE_ROLE.copy() self.cover_role = COVER_ROLE.copy() self.robots_in_wall_formation = [] self.robots_in_cover_formation = [] self.attackers = [] self.cover_to_coveree = {} self.cover_to_formation = {} self._dispatch_player() for role, player in self.assigned_roles.items(): if role == Role.GOALKEEPER: self.create_node(Role.GOALKEEPER, GoalKeeper(self.game_state, player)) elif player in self.attackers: node_position_pass = self.create_node( role, PositionForPass(self.game_state, player, robots_in_formation=self.attackers, auto_position=True)) node_go_kick = self.create_node( role, GoKick(self.game_state, player, target=their_goal)) node_wait_for_pass = self.create_node( role, ReceivePass(self.game_state, player)) attacker_should_go_kick = partial(self.should_go_kick, player) attacker_should_not_go_kick = partial(self.should_not_go_kick, player) attacker_has_kicked = partial(self.has_kicked, role) player_is_receiving_pass = partial( self.ball_going_toward_player, player) player_is_not_receiving_pass = partial( self.ball_not_going_toward_player, player) player_has_received_ball = partial(self.has_received, player) node_position_pass.connect_to(node_go_kick, when=attacker_should_go_kick) node_position_pass.connect_to(node_wait_for_pass, when=player_is_receiving_pass) node_wait_for_pass.connect_to(node_go_kick, when=player_has_received_ball) node_wait_for_pass.connect_to( node_position_pass, when=player_is_not_receiving_pass) node_go_kick.connect_to(node_position_pass, when=attacker_should_not_go_kick) node_go_kick.connect_to(node_go_kick, when=attacker_has_kicked) elif role in self.cover_role: enemy_to_block = self.cover_to_coveree[player] formation = self.cover_to_formation[player] node_align_to_covered_object = self.create_node( role, AlignToDefenseWall( self.game_state, player, robots_in_formation=formation, object_to_block=enemy_to_block, stay_away_from_ball=stay_away_from_ball)) node_position_pass = self.create_node( role, PositionForPass( self.game_state, player, robots_in_formation=self.robots_in_cover_formation, auto_position=True)) node_go_kick = self.create_node( role, GoKick(self.game_state, player, target=their_goal)) node_wait_for_pass = self.create_node( role, ReceivePass(self.game_state, player)) player_is_receiving_pass = partial( self.ball_going_toward_player, player) player_is_not_receiving_pass = partial( self.ball_not_going_toward_player, player) player_has_received_ball = partial(self.has_received, player) player_has_kicked = partial(self.has_kicked, role) node_align_to_covered_object.connect_to( node_position_pass, when=self.game_state.field.is_ball_in_our_goal_area) node_position_pass.connect_to( node_align_to_covered_object, when=self.game_state.field.is_ball_outside_our_goal_area) node_wait_for_pass.connect_to(node_go_kick, when=player_has_received_ball) node_wait_for_pass.connect_to( node_align_to_covered_object, when=player_is_not_receiving_pass) node_position_pass.connect_to(node_wait_for_pass, when=player_is_receiving_pass) node_go_kick.connect_to(node_align_to_covered_object, when=player_has_kicked) else: node_align_to_defense_wall = \ self.create_node(role, AlignToDefenseWall(self.game_state, player, robots_in_formation=self.robots_in_wall_formation, object_to_block=GameState().ball, stay_away_from_ball=stay_away_from_ball)) node_position_pass = self.create_node( role, PositionForPass( self.game_state, player, robots_in_formation=self.robots_in_wall_formation, auto_position=True)) node_go_kick = self.create_node( role, GoKick(self.game_state, player, target=their_goal)) node_wait_for_pass = self.create_node( role, ReceivePass(self.game_state, player)) player_is_receiving_pass = partial( self.ball_going_toward_player, player) player_is_not_receiving_pass = partial( self.ball_not_going_toward_player, player) player_has_received_ball = partial(self.has_received, player) player_has_kicked = partial(self.has_kicked, role) node_align_to_defense_wall.connect_to( node_position_pass, when=self.game_state.field.is_ball_in_our_goal_area) node_position_pass.connect_to( node_align_to_defense_wall, when=self.game_state.field.is_ball_outside_our_goal_area) node_wait_for_pass.connect_to(node_go_kick, when=player_has_received_ball) node_go_kick.connect_to(node_align_to_defense_wall, when=player_has_kicked) node_position_pass.connect_to(node_wait_for_pass, when=player_is_receiving_pass) node_position_pass.connect_to( node_align_to_defense_wall, when=player_is_not_receiving_pass)