diff --git a/src/AI/GaTravelingForHerbs/GeneticAlgorithm.py b/src/AI/GaTravelingForHerbs/GeneticAlgorithm.py index 31bab59..bdd2c2f 100644 --- a/src/AI/GaTravelingForHerbs/GeneticAlgorithm.py +++ b/src/AI/GaTravelingForHerbs/GeneticAlgorithm.py @@ -33,6 +33,12 @@ class GeneticAlgorithm: i += 1 if self.stopCondition(i): - return theBestMatch + return str(theBestMatch) + + + def listOfTravel(self): + strTravel = self.run() + import ast + return ast.literal_eval(strTravel) diff --git a/src/game/Game.py b/src/game/Game.py index 566fe08..a5be113 100644 --- a/src/game/Game.py +++ b/src/game/Game.py @@ -421,13 +421,12 @@ class Game: mutationProbability = float(0.1) ga = GeneticAlgorithm(firstGeneration, mutationProbability) - movementList = ga.run() + movementList = ga.listOfTravel() print(movementList) + print(type(movementList)) + print(movementList[0]) - # for i in movementList: - # self.map.getEntityOnCoord() # Start game loop - self.mainLoop()