Ejemplo n.º 1
0
def fitnesscheck(data):

    with open("output.txt", "w") as txt_file:
        for line in data:
            txt_file.write(" ".join(str(line)) + "\n")

    # initializes environment with ai player using random controller, playing against static enemy
    env = Environment(experiment_name=experiment_name, player_controller=player_controller(), speed="fastest")
    env.play()

    return env.fitness_single()
Ejemplo n.º 2
0
import matplotlib.pyplot as plt

index = 0

experiment_name = 'dummy_demo'
if not os.path.exists(experiment_name):
    os.makedirs(experiment_name)

import glob
import errno
path = '/Users/Julia/Dropbox/Master/Evolutionary computing/EvolutionaryComputing/bestresults/bestresultsDensitylevel1mutation0.01/*.txt'
files = glob.glob(path)

for file in files:

    index += 1
    f = open(file, "r")
    copy = open("output.txt", "w")
    for line in f:
        copy.write(line)

# initializes environment with ai player using random controller, playing against static enemy
    env = Environment(experiment_name=experiment_name,
                      player_controller=player_controller(),
                      speed="fastest",
                      enemies=[1])
    alle = env.play()

    with open("run/test.txt", "a") as txt_file:
        txt_file.write(str(index) + ": " + str(alle) + "\n")