def __init__(self):
     self.flappybird = FlappyBird()
     self.current_observation = None
     self.current_theory = None
     self.action_counter = 0
     self.theories_manager = TheoriesManager()
     self.theories_manager.get_theories_from_json('theories_saved.json')
     self.just_restarted = False
     self.turns_for_jump = 0
예제 #2
0
def main():

	best = None
	best_speed = None
	tmp_speed = None

	fp = FlappyBird()
	bird = Bird()
	best_speed = fp.run(bird, best, best_speed)
	best = bird

	while True:
		
		bird = Bird()
		tmp_speed = fp.run(bird, best, best_speed)

		if bird.fitness > best.fitness:
			best = bird
			best_speed = tmp_speed
예제 #3
0
def main():

    n_birds = 15
    n_generations = 1000
    best_info = None

    fp = FlappyBird()
    ga = GeneticAlgorithm(n_birds, lambda brain: Bird(_brain=brain))
    birds = ga.init_population()

    fp.run(birds, best_info)
    birds, best_info = ga.evolve(birds)
    best_info = best_info + (1, )
    show_best(best_info)

    for i in xrange(n_generations):
        fp.run(birds, best_info)
        birds, tmp = ga.evolve(birds)

        if tmp[2] > best_info[2]:
            best_info = tmp + (i + 2, )
            show_best(best_info)
예제 #4
0
 def flappy_game(self):
     game = FlappyBird()
     game.run()
예제 #5
0
 def __init__(self):
     self.flappybird =  FlappyBird();