def satisfy_one(self, algorithm='dpll'): if algorithm == 'backtrack': return backtrack(self) elif algorithm == 'dpll': return dpll(self) else: raise ValueError("invalid algorithm")
def satisfy_one(self, algorithm='backtrack'): if algorithm == 'backtrack': return sat.backtrack(self) elif algorithm == 'dpll': if self.is_cnf(): return sat.dpll(self) else: raise TypeError("expression is not a CNF") else: raise ValueError("invalid algorithm")