#This file is distributed under the terms of the GNU General Public license. #Copyright (C) 1999 Aloril (See the file COPYING for details). class Knowledge: def __init__(self): self.place={} self.location={} self.goal={} self.importance={} def add(self, what, key, value): if not hasattr(self, what): setattr(self, what, {}) d=getattr(self,what) d[key]=value def remove(self, what, key): if not hasattr(self, what): return d=getattr(self,what) if d.has_key(key): del d[key] if len(d)==0: delattr(self,what) def __str__(self): s="\n"