def launch_simulation_with_strategy(strat, team): """ Launch a simulation with the given stategy and return the result. """ n = 0 while n < 30: # Prevent simulation where there are less than 30 corner kicks (generally ~40) r_team = team + " " + settings.OPPONENT_PARAM print(r_team) ce.copy_formation(settings.CORNERKICK_PRE, strat[1][1]) ce.copy_formation(settings.CORNERKICK_POST, strat[1][2]) launcher.launch_simulation(l_team, r_team, settings.LOG_DIRECTORY, 1, 1, True, 0, 0) log = [ f for f in os.listdir(settings.LOG_DIRECTORY) if os.path.isfile(os.path.join(settings.LOG_DIRECTORY, f)) and f.endswith(".rcg") ][0] log_reader = lr.LogReader(os.path.join(settings.LOG_DIRECTORY, log.replace(".rcg", "")), no_cache=True) sim_result = log_reader.number_of_successful_corner_kicks_with_mini(settings.TEAM_NAME) os.remove(settings.LOG_DIRECTORY + "/" + log) os.remove(settings.LOG_DIRECTORY + "/" + log[:-1] + "l") n = sim_result[1] z = sim_result[0] return n, z
import launcher l_team = "/robocup/opuSCOM2D/src/trainerOpu.sh -p {port} -PT {coach_port} -P {olcoach_port}" #r_team = ["/robocup/A_TSU_BI2-/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/HillStone2014/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/KU_BOST./src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/KU_BOST2015/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/Ri-one/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/Ri-one_A/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/Ri-one_B/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/TsubameGaeshi-JO2015/start-tg.sh -p {port} -P {olcoach_port}",\ # "/robocup/agent2d-3.1.1/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/ants2014/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/helios_agent2d/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/neo_FiftyStorms/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/toyosu-galaxy_2014/toyosu-galaxy_2014/src/start.sh -p {port} -P {olcoach_port}",\ # "/robocup/toyosu_galaxy_2015/toyosu_galaxy/src/start.sh -p {port} -P {olcoach_port}"] r_team = ["/robocup/toyosu-galaxy_2015/toyosu-galaxy/src/start.sh -p {port} -P {olcoach_port}"] log_dir = "/robocup/implementation" for r in r_team: launcher.launch_simulation(l_team, r, log_dir, 1, 1, True, 0, 0)