method that return travel as correct list work
This commit is contained in:
parent
b63be724f5
commit
80c72f1ba0
@ -33,6 +33,12 @@ class GeneticAlgorithm:
|
|||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
if self.stopCondition(i):
|
if self.stopCondition(i):
|
||||||
return theBestMatch
|
return str(theBestMatch)
|
||||||
|
|
||||||
|
|
||||||
|
def listOfTravel(self):
|
||||||
|
strTravel = self.run()
|
||||||
|
import ast
|
||||||
|
return ast.literal_eval(strTravel)
|
||||||
|
|
||||||
|
|
||||||
|
@ -421,13 +421,12 @@ class Game:
|
|||||||
mutationProbability = float(0.1)
|
mutationProbability = float(0.1)
|
||||||
|
|
||||||
ga = GeneticAlgorithm(firstGeneration, mutationProbability)
|
ga = GeneticAlgorithm(firstGeneration, mutationProbability)
|
||||||
movementList = ga.run()
|
movementList = ga.listOfTravel()
|
||||||
print(movementList)
|
print(movementList)
|
||||||
|
print(type(movementList))
|
||||||
|
print(movementList[0])
|
||||||
|
|
||||||
# for i in movementList:
|
|
||||||
# self.map.getEntityOnCoord()
|
|
||||||
# Start game loop
|
# Start game loop
|
||||||
|
|
||||||
self.mainLoop()
|
self.mainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user