def __init__(self): pygame.init() self.screen = pygame.display.set_mode(SCREEN_SIZE) self.clock = pygame.time.Clock() pygame.display.set_caption('是AI就躲个飞机 AI Plane Avoiding obstacles') self.ai = neuro_evolution.NeuroEvolution() self.generation = 0 self.max_enemes = 1 # 加载飞机、敌机图片 Load pictures of aircraft and enemy aircraft self.plane_image = pygame.image.load('plane.png').convert_alpha() self.enemy_image = pygame.image.load('emmy.png').convert_alpha()
def __init__(self): pygame.init() self.screen = pygame.display.set_mode(SCREEN_SIZE) self.clock = pygame.time.Clock() pygame.display.set_caption('是AI就躲个飞机') self.ai = neuro_evolution.NeuroEvolution() self.generation = 0 self.max_enemes = 1 # 加载飞机、敌机图片 self.plane_image = pygame.image.load('plane.png').convert_alpha() self.enemy_image = pygame.image.load('enemy.png').convert_alpha()
def __init__(self): pygame.init() self.screen = pygame.display.set_mode(SCREEN_SIZE) self.clock = pygame.time.Clock() pygame.display.set_caption('AI') self.ai = neuro_evolution.NeuroEvolution() self.generation = 0 self.max_enemes = 1 # load image of plane and enemy self.plane_image = pygame.image.load('plane.png').convert_alpha() self.enemy_image = pygame.image.load('enemy.png').convert_alpha() self.score_list = []
def __init__(self): pygame.init() self.screen = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT)) pygame.display.set_caption('Pygame Flappy Bird') self.clock = pygame.time.Clock() self.score_font = pygame.font.SysFont(None, 32, bold=True) # default font self.images = load_images() # set ai self.ai = neuro_evolution.NeuroEvolution() self.generation = 0 # set pipes self.pipes = deque() self.record = [] self.logpath = 'scores.txt' self.maxscore = 0