コード例 #1
0
    def __init__(
        self,
        db_file=":memory:",
        db_log_path=None,
        schema_paths=SCHEMAS,
        load_minecraft_specs=True,
        load_block_types=True,
        load_mob_types=True,
        preception_range=PERCEPTION_RANGE,
        agent_time=None,
    ):
        super(MCAgentMemory, self).__init__(
            db_file=db_file,
            schema_paths=schema_paths,
            db_log_path=db_log_path,
            nodelist=NODELIST,
            agent_time=agent_time,
        )
        self.banned_default_behaviors = []  # FIXME: move into triple store?
        self._safe_pickle_saved_attrs = {}
        self._load_schematics(load_minecraft_specs)
        self._load_block_types(load_block_types)
        self._load_mob_types(load_mob_types)

        self.dances = {}
        dance.add_default_dances(self)

        self.perception_range = preception_range
コード例 #2
0
    def __init__(self,
                 db_file=":memory:",
                 db_log_path=None,
                 schema_paths=SCHEMAS):
        super(LocoAgentMemory, self).__init__(db_file=db_file,
                                              schema_paths=schema_paths,
                                              db_log_path=db_log_path,
                                              nodelist=NODELIST)

        self.banned_default_behaviors = []  # FIXME: move into triple store?
        self._safe_pickle_saved_attrs = {}

        self.dances = {}
        dance.add_default_dances(self)
コード例 #3
0
ファイル: memory.py プロジェクト: snyxan/craftassist
    def __init__(
        self,
        db_file=":memory:",
        db_log_path=None,
        task_db={},
        load_minecraft_specs=True,
        load_block_types=True,
    ):
        self.db = sqlite3.connect(db_file)

        self.task_db = task_db

        self.banned_default_behaviors = []  # FIXME: move into triple store?
        self.other_players = {}
        self.pending_agent_placed_blocks = set()
        self.updateable_mems = []
        self._safe_pickle_saved_attrs = {}

        if db_log_path:
            self._db_log_file = gzip.open(db_log_path + ".gz", "w")
            self._db_log_idx = 0

        with open(SCHEMA, "r") as f:
            self._db_script(f.read())

        self._load_schematics(load_minecraft_specs)
        self._load_block_types(load_block_types)

        # self.memids = {}  # TODO: key is memid, value is sql table name or memory dict name
        self.all_tables = [
            c[0] for c in self._db_read(
                "SELECT name FROM sqlite_master WHERE type='table';")
        ]

        self.dances = {}
        dance.add_default_dances(self)

        # create a "self" memory to reference in Triples
        self.self_memid = "0" * len(uuid.uuid4().hex)
        self._db_write("INSERT INTO Memories VALUES (?,?,?)", self.self_memid,
                       "Memories", 0)
        self.tag(self.self_memid, "_agent")
        self.tag(self.self_memid, "_self")
        self.time = util.Time(mode="clock")