Fix printing

This commit is contained in:
George Lacey 2017-09-27 23:39:44 +01:00
parent 67a0a69350
commit b75b1c8e02

View File

@ -19,7 +19,7 @@ class Individual(object):
def __str__(self): def __str__(self):
return "x: %f\ty: %f\tfit: %f\n" %\ return "x: %f\ty: %f\tfit: %f\n" %\
(self.x, self.y, self.fitness) (self.x, self.y, self.fitness())
def fitness(self): def fitness(self):
x = self.x x = self.x
@ -33,6 +33,7 @@ class Individual(object):
return one, two return one, two
def mutate(self): def mutate(self):
rand.randint(1, 10)
if rand.randint(1, 10) % 2 == 0: if rand.randint(1, 10) % 2 == 0:
self.x = self.get_rand_param() self.x = self.get_rand_param()
else: else: