Open unnir opened 7 years ago
you should provide the method '__gt__' so that the 'max' function can choice an greater instance of WordDNA when running:
class WordDNA(genetics.arrayed_segment(len(solution), LetterComponent)):
def score(self):
return sum(comp.value == letter for comp, letter in zip(self, solution))
def __str__(self):
return ''.join(comp.value for comp in self)
def __gt__(self, other):
return self.score() > other.score()
I have these error messages for the hello world example.