def compute_strategy(self, state, player, teamid): adv = need.obstacle(state, teamid, player) me = player.position advD = need.obstacleD(state, teamid, player, adv) move = state.ball.position - player.position a = state.get_goal_center(need.teamAdverse(teamid)) - player.position shoot = Vector2D(0, 0) if adv: if adv.y < me.y: shoot = Vector2D.create_polar(a.angle + 0.45, 1) else: shoot = Vector2D.create_polar(a.angle - 0.5, 1) if advD == True: shoot = (state.get_goal_center(need.teamAdverse(teamid)) - player.position) return SoccerAction(move, shoot)
def compute_strategy(self, state, player, teamid): move = state.get_goal_center( need.teamAdverse(teamid)) - (player.position) if need.jai_la_balle(state, player): shoot = Vector2D.create_polar(move.angle + random.random() * 2 - 1, 1) return SoccerAction(Vector2D(0, 0), shoot) return SoccerAction(Vector2D(0, 0), Vector2D())
def compute_strategy(self, state, player, teamid): acceleration = state.ball.position - player.position shoot = Vector2D(0, 0) if (PLAYER_RADIUS + BALL_RADIUS) >= (state.ball.position.distance( player.position)): shoot = (state.get_goal_center(need.teamAdverse(teamid)) - player.position) return SoccerAction(acceleration, shoot)
def compute_strategy(self, state, player, teamid): shoot = Vector2D(0, 0) if need.jai_la_balle(state, player): shoot = state.get_goal_center( need.teamAdverse(teamid)) - player.position shoot.x = shoot.x - (GAME_GOAL_HEIGHT / 2.4) shoot.y = shoot.y - (GAME_GOAL_HEIGHT / 2.4) return SoccerAction(Vector2D(0, 0), shoot)
def compute_strategy(self, state, player, teamid): jai_la_balle = need.jai_la_balle(state, player) if jai_la_balle: shoot = state.get_goal_center( need.teamAdverse(teamid)) - player.position #print shoot.angle,shoot.create_polar(shoot.angle, 0.4) return SoccerAction(Vector2D(0, 0), shoot.create_polar(shoot.angle, 1.8)) return SoccerAction(Vector2D(0, 0), Vector2D(0, 0))