working , rc release !

This commit is contained in:
2019-10-29 10:13:29 +01:00
parent f0580a988c
commit 51f719184d
4 changed files with 37 additions and 14 deletions

12
main.py
View File

@@ -7,12 +7,12 @@ import time
from car import Car
from genetics import genetic_selection, genetic_reproduction
from maps import map1
from params import CELL_COLOR, screen
from params import CELL_COLOR, GX, GY, screen
# https://medium.com/intel-student-ambassadors/demystifying-genetic-algorithms-to-enhance-neural-networks-cde902384b6e
clock = pygame.time.Clock()
font = pygame.font.SysFont("hack", 24)
map_lines = map1
@@ -40,6 +40,8 @@ def run_round(all_cars):
for line in map_lines:
pygame.draw.line(screen, (255, 255, 255), line[0], line[1])
text = font.render(f"Generation {loop}", True, (128, 128, 128))
screen.blit(text, (GX - 50 - text.get_width(), text.get_height() // 2))
pygame.display.flip()
clock.tick(48)
@@ -66,7 +68,9 @@ def run_round(all_cars):
pygame.display.flip()
loop = 0
while True:
loop += 1
run_round(all_cars)
pygame.display.flip()
clock.tick(24)
# pygame.display.flip()
# clock.tick(24)