dimanche 1 octobre 2017

Why "for i in list" loop is infinite?

Complier says the mistake is in if self.char_graph[j][0] != 'wall': line

def effect(self, i, decay, round, sw):
    round = round + 1
    for j in self.st_graph[i]:
        if self.char_graph[j][0] != 'wall': # ----**
            prop = 1 * (decay ** round)
            if (0 < self.char_graph[j][sw]) & (self.char_graph[j][sw] < prop):
                self.char_graph[j][sw] = prop
                break
            else:
                self.char_graph[j][sw] = 1 * decay ** round
                self.effect(j, decay, round, sw)
    return self.char_graph

Aucun commentaire:

Enregistrer un commentaire