56 new_head[1] >= SCREEN_SIZE or
57 new_head.tolist() in self.snake.tolist()
58 ):
59 # self.fitness -= FPS/2 60 return False
61
62 # eat fruit
85
86 # 0 - 1 ... danger - safe
87 for i, p_dir in enumerate(possible_dirs):
88 # sensor range = 5 89 for j in range(5):
90 guess_head = head + p_dir * (j + 1)
91
138 if e.type == pygame.QUIT:
139 pygame.quit()
140 elif e.type == pygame.KEYDOWN:
141 # QUIT142 if e.key == pygame.K_ESCAPE:
143 pygame.quit()
144 exit()
142 if e.key == pygame.K_ESCAPE:
143 pygame.quit()
144 exit()
145 # PAUSE146 if e.key == pygame.K_SPACE:
147 pause = True
148 while pause:
167 self.direction = 3
168 prev_key = e.key
169
170 # action171 if __name__ != '__main__':
172 inputs = self.get_inputs()
173 outputs = self.genome.forward(inputs)
Comment indentation should be a multiple of four.