def validate(self, knowledge_base): start_uid = logic.get_absolute_start(knowledge_base).uid table = {} for jump in knowledge_base.filter(facts.Jump): if jump.state_from not in table: table[jump.state_from] = [] table[jump.state_from].append(jump.state_to) self._bruteforce([start_uid], table)
def check_quest(self, knowledge_base): start = logic.get_absolute_start(knowledge_base) table = {} for jump in knowledge_base.filter(facts.Jump): if jump.state_from not in table: table[jump.state_from] = [] table[jump.state_from].append(jump) powers = set() self._bruteforce(knowledge_base, [start.uid], table, [], processed=set(), powers=powers) self.check_participants(knowledge_base, powers)
def validate(self, knowledge_base): start_uid = logic.get_absolute_start(knowledge_base).uid riched_states = set() query = [start_uid] while query: state_uid = query.pop(0) if state_uid in riched_states: continue riched_states.add(state_uid) for jump in knowledge_base.filter(facts.Jump): if jump.state_from != state_uid: continue query.append(jump.state_to) all_states = set(state.uid for state in knowledge_base.filter(facts.State)) if riched_states != all_states: raise self.Error(states=all_states-riched_states)
def validate(self, knowledge_base): start_uid = logic.get_absolute_start(knowledge_base).uid riched_states = set() query = [start_uid] while query: state_uid = query.pop(0) if state_uid in riched_states: continue riched_states.add(state_uid) for jump in knowledge_base.filter(facts.Jump): if jump.state_from != state_uid: continue query.append(jump.state_to) all_states = set(state.uid for state in knowledge_base.filter(facts.State)) if riched_states != all_states: raise self.Error(states=all_states - riched_states)