update: changed NN and number of features
This commit is contained in:
@@ -7,6 +7,7 @@ POPULATION_SIZE = 50
|
||||
MUTATION_RATE = 0.5
|
||||
POPULATION_BEST = 0.2
|
||||
FRAME_RATE = 160 #TODO: FIX THE INCORRECT FRAME RATE CORRELATION
|
||||
BARRIER_SPEED = 10
|
||||
|
||||
pygame.init()
|
||||
|
||||
@@ -32,8 +33,6 @@ def init_game():
|
||||
grass = Background("images/Grass.jpg", 0, 0)
|
||||
grass.set_size(WIDTH, HEIGHT)
|
||||
|
||||
BARRIER_SPEED = 1
|
||||
|
||||
gameobjects = []
|
||||
|
||||
barriers = []
|
||||
@@ -65,12 +64,12 @@ def get_features(horse):
|
||||
last_barrier.rect.bottomright[0], last_barrier.rect.bottomright[1],
|
||||
horse.rect.topleft[0], horse.rect.topleft[1],
|
||||
horse.rect.bottomright[0], horse.rect.bottomright[1],
|
||||
HEIGHT, BARRIER_SPEED]
|
||||
0, HEIGHT, BARRIER_SPEED]
|
||||
return features
|
||||
|
||||
genecticAlg = GeneticAlgorithm(POPULATION_SIZE, MUTATION_RATE, POPULATION_BEST, 10)
|
||||
horses = [Horse("images/Horse_1.png", 50, HEIGHT/2 + 0 * i) for i in range(POPULATION_SIZE)]
|
||||
init_game()
|
||||
genecticAlg = GeneticAlgorithm(POPULATION_SIZE, MUTATION_RATE, POPULATION_BEST, len(get_features(horses[0])))
|
||||
while True:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT: # Handle window close event
|
||||
|
||||
Reference in New Issue
Block a user