コード例 #1
0
 def removeState(self, state):
     try:
         self.states.remove(state)
         self.edges.pop(state)
         for s in self.states:
             for edge in self.edges[s]:
                 if edge[1] == state:
                     self.edges[s].remove(edge)
         Log.succes(f'Removed {state}')
     except Exception:
         Log.fail(
             f'Failed to remove {state}. Probabily not part of the list.')
コード例 #2
0
 def removeDeadStates(self):
     deadStates = list(set(self.states).difference(self.getAliveStates()))
     Log.warning(f'Dead states: {deadStates}')
     for state in self.states:
         i = 0
         while i < len(self.edges[state]):
             if self.edges[state][i][1] in deadStates:
                 self.edges[state].remove(self.edges[state][i])
             else:
                 i += 1
     for state in deadStates:
         Log.succes(f'Removed (dead) {state}')
         self.removeState(state)