def mutate(self): r = Random() for i in range(len(self.state)): if random() < self._mutation_rate: self.state[i] = r.randint(1,8)