Beispiel #1
0
    def __init__(self, team_type, *args):
        """
        Create an agent brain
        """
        # this line is crucial, otherwise the class is not recognized as an
        # AgentBrainPtr by C++
        OpenNero.AgentBrain.__init__(self)

        NeroAgent.__init__(self, team_type)

        self.omit_friend_sensors = False

        if len(args) > 0:
            stream = io.BytesIO(string.join(args, '\n').encode('utf-8'))
            self.org = OpenNero.Organism(stream)
        else:
            NEATAgent.count += 1
            genome = self.base_genome.clone(NEATAgent.count, 1)
            self.org = OpenNero.Organism(0, genome, 1)