added CHECKPOINT_OPTIMIZATION_ROUNDS config parameter

This commit is contained in:
Felix Bargfeldt 2019-07-17 18:55:06 +02:00
parent 2bca2b1b65
commit d337ddd503
No known key found for this signature in database
GPG key ID: 99184F5FDC589A67
2 changed files with 3 additions and 1 deletions

View file

@ -6,6 +6,7 @@ WIDTH: int = 640
HEIGHT: int = 480
POPULATION_SIZE: int = 1000
CHECKPOINT_OPTIMIZATION_ROUNDS: int = 20
LEVEL: Level = [
Level(

View file

@ -1,6 +1,7 @@
import random
from typing import List
from config import CHECKPOINT_OPTIMIZATION_ROUNDS
from dot import Dot
from game import Game
@ -72,7 +73,7 @@ class Population:
self.game.current_target += 1
self.game.target_countdown = None
elif not self.best_dot.reached_final_goal and self.best_dot.reached_goal:
self.game.target_countdown: int = 20
self.game.target_countdown: int = CHECKPOINT_OPTIMIZATION_ROUNDS
if self.game.target_countdown:
print(f" Optimizing this checkpoint for {self.game.target_countdown} more generations")