コード例 #1
0
ファイル: Deduction.py プロジェクト: andyrooger/auto-cluedo
 def add(self, info):
     if not isinstance(info, Deduction):
         raise TypeError("Can only add deductions to deduction store.")
     if info.deductionstore is not self:
         raise ValueError("Deduction is not from this store.")
     for item in info.relieson:
         if isinstance(item, Fact.Fact) and info.factstore is not self.factstore:
             raise ValueError("A fact we rely on is from the wrong store.")
         if isinstance(item, Deduction) and info.deductionstore is not self:
             raise ValueError("A deduction we rely on is from the wrong store.")
     InformationStore.add(self, info)
コード例 #2
0
ファイル: Fact.py プロジェクト: andyrooger/auto-cluedo
 def add(self, info):
     if not isinstance(info, Fact):
         raise TypeError("Can only add facts to fact store.")
     if info.factstore is not self:
         raise ValueError("Fact is not from this store.")
     InformationStore.add(self, info)