Example #1
0
def create_ai(population, target):
    """

    :param population: the population which the individuals will be assigned to the bots
    :param target: the obstacle which the bots must pass
    :return: two list, first with hte bots and the second with their observers
    """
    ai_list = []
    observers = []
    for index, indv in enumerate(population.get_pool()):
        new_ai = Bot(settings.AI_SKINS[0], indv.threshold, 200,
                     50 + index * 30, 290, "Ai %d" % index)
        new_obs = Observer(new_ai, [target])

        new_obs.ai = indv
        new_ai.set_target(target)
        new_ai.obs = new_obs

        observers.append(new_obs)
        ai_list.append(new_ai)

    return [ai_list, observers]