update: small twiks

This commit is contained in:
KOSMOGOR
2025-04-14 19:20:18 +03:00
parent 90f8c08796
commit ff2ddc98fb
2 changed files with 3 additions and 3 deletions
+1 -2
View File
@@ -106,8 +106,7 @@ class Horse(GameObject):
def count_fitness(self): def count_fitness(self):
if self.stopped == False: if self.stopped == False:
self.fitness += 1 self.fitness += 1
if self.vacceleration == 0: if self.vspeed == 0: self.fitness -= 0.9
self.fitness -= 0.9
class Background(GameObject): class Background(GameObject):
def __init__(self, image_path, x, y): def __init__(self, image_path, x, y):
+2 -1
View File
@@ -7,7 +7,7 @@ POPULATION_SIZE = 100
MUTATION_RATE = 0.5 MUTATION_RATE = 0.5
POPULATION_NEW = 0.1 POPULATION_NEW = 0.1
POPULATION_BEST = 0.3 POPULATION_BEST = 0.3
FRAME_RATE = 160 # TODO: FIX THE INCORRECT FRAME RATE CORRELATION FRAME_RATE = 300 # TODO: FIX THE INCORRECT FRAME RATE CORRELATION
BARRIER_SPEED = 10 BARRIER_SPEED = 10
BARRIER_DELAY = 100 BARRIER_DELAY = 100
@@ -66,6 +66,7 @@ def get_features(horse: Horse):
horse.rect.topleft[0], horse.rect.topleft[1], horse.rect.topleft[0], horse.rect.topleft[1],
horse.rect.bottomright[0], horse.rect.bottomright[1], horse.rect.bottomright[0], horse.rect.bottomright[1],
0, HEIGHT, horse.vspeed, horse.vacceleration, BARRIER_SPEED] 0, HEIGHT, horse.vspeed, horse.vacceleration, BARRIER_SPEED]
features = [x / HEIGHT for x in features]
return features return features