Fixed Alive Counter Bug

This commit is contained in:
NeuralNine 2021-02-02 21:04:48 +01:00
parent 8bee5d5d67
commit 425a86d285

View File

@ -203,14 +203,14 @@ def run_simulation(genomes, config):
# Check If Car Is Still Alive # Check If Car Is Still Alive
# Increase Fitness If Yes And Break Loop If Not # Increase Fitness If Yes And Break Loop If Not
still_alive = False still_alive = 0
for i, car in enumerate(cars): for i, car in enumerate(cars):
if car.is_alive(): if car.is_alive():
still_alive = True still_alive += 1
car.update(game_map) car.update(game_map)
genomes[i][1].fitness += car.get_reward() genomes[i][1].fitness += car.get_reward()
if still_alive == False: if still_alive == 0:
break break
counter += 1 counter += 1