diff --git a/config.txt b/config.txt index 147a27f..c0f578d 100644 --- a/config.txt +++ b/config.txt @@ -1,7 +1,7 @@ [NEAT] fitness_criterion = max fitness_threshold = 100000000 -pop_size = 80 +pop_size = 30 reset_on_extinction = True [DefaultGenome] diff --git a/map.png b/map.png index ee5c6c3..85d403b 100644 Binary files a/map.png and b/map.png differ diff --git a/map2.png b/map2.png new file mode 100644 index 0000000..f28a8ba Binary files /dev/null and b/map2.png differ diff --git a/map3.png b/map3.png new file mode 100644 index 0000000..8034c5e Binary files /dev/null and b/map3.png differ diff --git a/map4.png b/map4.png new file mode 100644 index 0000000..6fc2a92 Binary files /dev/null and b/map4.png differ diff --git a/map5.png b/map5.png new file mode 100644 index 0000000..ba3ece3 Binary files /dev/null and b/map5.png differ diff --git a/map_easy.png b/map_easy.png deleted file mode 100644 index 6f43fc9..0000000 Binary files a/map_easy.png and /dev/null differ diff --git a/simulation.py b/newcar.py similarity index 94% rename from simulation.py rename to newcar.py index b5bf33a..d6a7317 100644 --- a/simulation.py +++ b/newcar.py @@ -10,11 +10,14 @@ import neat import pygame # Constants -WIDTH = 1600 -HEIGHT = 880 +# WIDTH = 1600 +# HEIGHT = 880 -CAR_SIZE_X = 30 -CAR_SIZE_Y = 30 +WIDTH = 1920 +HEIGHT = 1080 + +CAR_SIZE_X = 60 +CAR_SIZE_Y = 60 BORDER_COLOR = (255, 255, 255, 255) # Color To Crash on Hit @@ -28,7 +31,8 @@ class Car: self.sprite = pygame.transform.scale(self.sprite, (CAR_SIZE_X, CAR_SIZE_Y)) self.rotated_sprite = self.sprite - self.position = [690, 740] # Starting Position + # self.position = [690, 740] # Starting Position + self.position = [830, 920] # Starting Position self.angle = 0 self.speed = 0 @@ -46,7 +50,7 @@ class Car: def draw(self, screen): screen.blit(self.rotated_sprite, self.position) # Draw Sprite - # self.draw_radar(screen) OPTIONAL FOR SENSORS + self.draw_radar(screen) #OPTIONAL FOR SENSORS def draw_radar(self, screen): # Optionally Draw All Sensors / Radars @@ -83,7 +87,7 @@ class Car: # Set The Speed To 20 For The First Time # Only When Having 4 Output Nodes With Speed Up and Down if not self.speed_set: - self.speed = 10 + self.speed = 20 self.speed_set = True # Get Rotated Sprite And Move Into The Right X-Direction @@ -158,7 +162,7 @@ def run_simulation(genomes, config): # Initialize PyGame And The Display pygame.init() - screen = pygame.display.set_mode((WIDTH, HEIGHT)) + screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN) # For All Genomes Passed Create A New Neural Network for i, g in genomes: @@ -214,7 +218,7 @@ def run_simulation(genomes, config): break counter += 1 - if counter == 30 * 20: # Stop After About 20 Seconds + if counter == 30 * 40: # Stop After About 20 Seconds break # Draw Map And All Cars That Are Alive @@ -226,12 +230,12 @@ def run_simulation(genomes, config): # Display Info text = generation_font.render("Generation: " + str(current_generation), True, (0,0,0)) text_rect = text.get_rect() - text_rect.center = (100, 100) + text_rect.center = (900, 450) screen.blit(text, text_rect) text = alive_font.render("Still Alive: " + str(still_alive), True, (0, 0, 0)) text_rect = text.get_rect() - text_rect.center = (100, 150) + text_rect.center = (900, 490) screen.blit(text, text_rect) pygame.display.flip()