Exemplo n.º 1
0
    def __init__(self, cppthing):
        # FIXME: this shouldn't be needed
        self.mind = cppthing

        # print('init')

        self.knowledge = Knowledge()
        self.mem = Memory(a_map=self.map)
        self.things = {}
        self.pending_things = []
        self._reverse_knowledge()
        self.goals = []
        self.transfers = []
        # A map containing lists of goals which are to be triggered
        self.trigger_goals = {}
        self.entity_appear_goals = set()
        self.jitter = random.uniform(-0.1, 0.1)
        self.message_queue = None
        self.goal_id_counter = 0
        self.relation_rules = []
        self.entities = {}

        # Fill up any existing entities
        existing_entities = self.map.get_all()
        for entity in existing_entities:
            self.entities[entity.id] = entity

        self.add_hook_set("add_map")
        self.delete_hook_set("delete_map")
        self.add_property_callback('_goals', 'goals_updated')
        self.add_property_callback('_knowledge', 'knowledge_updated')
        self.add_property_callback('_relations', 'relations_updated')
        self.add_property_callback('_origin', 'origin_updated')
Exemplo n.º 2
0
    def __init__(self, cppthing):
        # FIXME: this shouldn't be needed
        self.mind = cppthing

        self.print_debug('init')

        self.knowledge = Knowledge()
        self.mem = Memory(map=self.map)
        self.things = {}
        self.pending_things = []
        self._reverse_knowledge()
        self.goals = []
        self.money_transfers = []
        self.transfers = []
        self.trigger_goals = {}
        self.jitter = random.uniform(-0.1, 0.1)
        self.message_queue = None
        # This is going to be really tricky
        self.map.add_hooks_append("add_map")
        self.map.update_hooks_append("update_map")
        self.map.delete_hooks_append("delete_map")
        self.goal_id_counter = 0
        self.add_property_callback('_goals', 'goals_updated')
        self.add_property_callback('_knowledge', 'knowledge_updated')

        # Check if there's an "origin" location, if not add one.
        if not self.get_knowledge("location", "origin"):
            # TODO: store in server
            self.print_debug('Adding origin location.')
            self.add_knowledge("location", "origin",
                               self.entity.location.copy())
Exemplo n.º 3
0
    def __init__(self, cppthing):
        self.mind = cppthing

        self.knowledge=Knowledge()
        self.mem=Memory(map=self.map)
        self.things={}
        self.pending_things=[]
        self._reverse_knowledge()
        self.goals=[]
        self.money_transfers=[]
        self.transfers=[]
        self.trigger_goals={}
        self.jitter=random.uniform(-0.1, 0.1)
        #???self.debug=debug(self.name+".mind.log")
        self.message_queue=None
        #This is going to be really tricky
        self.map.add_hooks_append("add_map")
        self.map.update_hooks_append("update_map")
        self.map.delete_hooks_append("delete_map")
Exemplo n.º 4
0
    def __init__(self, cppthing):
        # FIXME: this shouldn't be needed
        self.mind = cppthing

        print('init')

        self.knowledge = Knowledge()
        self.mem = Memory(map=self.map)
        self.things = {}
        self.pending_things = []
        self._reverse_knowledge()
        self.goals = []
        self.money_transfers = []
        self.transfers = []
        # A map containing lists of goals which are to be triggered
        self.trigger_goals = {}
        self.jitter = random.uniform(-0.1, 0.1)
        self.message_queue = None
        self.goal_id_counter = 0
        self.relation_rules = []
        self.entities = {}

        # Fill up any existing entities
        existing_entities = self.map.get_all()
        for entity in existing_entities:
            self.entities[entity.id] = entity

        self.map.add_hook_set("add_map")
        self.map.update_hook_set("update_map")
        self.map.delete_hook_set("delete_map")
        self.add_property_callback('_goals', 'goals_updated')
        self.add_property_callback('_knowledge', 'knowledge_updated')
        self.add_property_callback('_relations', 'relations_updated')

        # Check if there's an "origin" location, if not add one.
        if not self.get_knowledge("location", "origin"):
            # TODO: store in server
            print('Adding origin location.')
            self.add_knowledge("location", "origin",
                               self.entity.location.copy())