Skip to content

Instantly share code, notes, and snippets.

@GypsyDangerous
Created April 4, 2019 16:02
Show Gist options
  • Save GypsyDangerous/4082256f2341ff4538a2f9682bcc21da to your computer and use it in GitHub Desktop.
Save GypsyDangerous/4082256f2341ff4538a2f9682bcc21da to your computer and use it in GitHub Desktop.
GA created by davidsnyder1 - https://repl.it/@davidsnyder1/GA
import numpy as np
import random
import math
def nextGeneration(population):
print('next generation')
size = len(population)
calculateFitness()
for i in range(size):
population[i] = pickOne(population)
def pickOne(population):
index = 0;
r = random(1);
while r > 0:
r = r - population[index].fitness;
index+=1
index-=1
bird = population[index];
child = mitosis(bird)
return child
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment