All of my cells are moving left in my genetic algorithm and I have no idea why. https://github.com/PaulMercer5555/CellGeneticAlgorithim. It uses pygame just for display purposes. I'm So confused. class Cell: def __init__(self,name,parent1,parent2, coordinates): self.name = f"cell,{name}" self.coordinates = coordinates self.size = (Config.cellWidth*Config.simulationScale, Config.cellHeight*Config.simulationScale) self.color = Config.cellColor self.energyLevel = Config.cellStartingEnergy self.visionRadius = Config.cellVisionRadius*Config.simulationScale self.weight = 0 self.genes = { "gene1": parent1["gene1"], "gene2": parent1["gene2"], "gene3": parent2["gene1"], "gene4": parent2["gene2"], } def Move(self,direction): print(direction) (x,y) = self.coordinates if direction == "UP": y += Config.simulationScale elif direction == "DOWN": y -= Config.simulationScale elif direction == "LEFT": x -= Config.simulationScale Config.leftExecutionCount += 1 elif direction == "RIGHT": x += Config.simulationScale print(self.coordinates,(x,y), "MOVE") self.coordinates = (x,y) def decisionMaker(self): gene1Output = self.weight + self.genes["gene1"] gene2Output = self.weight + self.genes["gene2"] gene3Output = self.weight + self.genes["gene3"] gene4Output = self.weight + self.genes["gene4"] totalOutput = gene1Output + gene2Output + gene3Output + gene4Output direction = "direction" if -100 < totalOutput < -50: direction = "LEFT" self.Move(direction) elif -50 < totalOutput < 0: direction = "RIGHT" self.Move(direction) elif 0 < totalOutput < 50: direction = "UP" self.Move(direction) elif 50 < totalOutput < 100: direction = "DOWN" self.Move(direction) print(self.coordinates, "DECISIONMAKER", direction, totalOutput) def Brain(self): if self.coordinates[0] < 0: x = list(self.coordinates) x[0] += Config.screenSize self.coordinates = tuple(x) for obj1 in Config.foodList: if self.coordinates == obj1.coordinates: self.eatFood(obj1) break else: continue for obj1 in Config.cellList: if self.coordinates == obj1.coordinates: self.breed(obj1) break else: continue if self.energyCheck(): Config.cellList.remove(self) del self return self.weight = 0 self.weight += self.visualInput(Config.foodList,Config.cellList) self.weight += self.selfCoordinatesToWeight() self.weight += self.energyLevelToWeight() self.decisionMaker() self.loseEnergy(Config.energyLossPerTick) print(self.coordinates, "BRAIN") I've tried commenting out the actual move left block of code in the move function and it still moved left. I tried outputting the number that should go left vs the ones that actually did, there was no difference. I did the math, genetical, about 0.3 percent of cells should be moving left. But instead all of them are. Why? Continue reading...