def fixed_evolve(opp_strat, ticks): POP = genetic.make_pop(50,ticks,5) counter = 0 while True: POP = genetic.newGen(POP, opp_strat, ticks, genetic.breed_discrete_select) print POP[0] counter = counter +1 print "itter: {}".format(counter) raw_input() return 0
def ymove(Led, time): Led.append((False, time)) def Adapt(pop, badLed, Led, time): k = 0 if badLed != []: k = Led_strat(badLed) z = democracy(pop, time, Led, k) if z > .5: Led.append((True, time)) badLed = filter(lambda x: not x[1], Led) Kids = genetic.TrainChildren(pop, Led, 10, time) print "LED: {}, badLed: {}, time: {}".format(Led, badLed, time) for k in Kids: print k print "umm" raw_input() elif opstrat(y): Led.append((False, time)) return list(pop), list(badLed) pop = genetic.make_pop(40, 500, 6) bled, Led = [], [] y = 1 while True: pop, bled = Adapt(pop, bled, Led, y) y = y+1