def __init__(self, brain=None): self.x = 50 self.y = h // 2 self.score = 0 self.fitness = 0 self.img = random.choice([bird_img1, bird_img2, bird_img3]) if brain: self.brain = brain else: self.brain = network([4, 4, 2])
def __init__(self, layers=4, structure=[10, 10, 10, 10]): self.factor = 20 self.brain = [] jumpx, jumpy = 0, 0 for _ in range(layers): self.brain.append(network(structure, jumpx, jumpy)) jumpy += self.factor if jumpy >= 320: jumpy = 0 jumpx += self.factor
def __init__(self, head=False, x=w // 2, y=h // 2, brain=None): self.x = x self.y = y self.side = 15 self.score = 1e-50 if brain != None: self.brain = brain else: self.brain = network([5, 4, 4]) self.color = (0, 255, 0)
def __init__(self, rep): self.x = random.randint(30, w - 20) self.y = random.randint(30, h - 20) self.rep = rep self.position = np.array([self.x, self.y]) self.radius = 3 if rep == 1: self.color = (255, 255, 0) else: self.color = (255, 0, 0) self.brain = network([2, 2])
def __init__(self, brain=None): self.x = width // 2 self.y = int(0.9956 * height) self.change = 1 self.score = 0 self.bullet = Bullet(self.x, self.y) if brain != None: self.brain = brain else: self.brain = network([4, 10, 3]) self.img = pygame.image.load(rocket_image).convert_alpha()
def __init__(self,pos,col,len=60,width=25,brain=None,j=ch,y=random.randint(0,440)): self.x=pos self.y=y self.width=width self.len=len self.color=col self.displacement=j if brain!=None: self.brain=brain else: self.brain=network([1,4,3]) self.score=0.01
def __init__(self, pos, col, len=50, width=25, brain=None): self.x = pos self.y = random.randint(0, h - len) self.width = width self.len = 60 self.color = col self.displacement = ch if brain != None: self.brain = brain else: self.brain = network([1, 4, 3]) self.score = 0.01
def __init__(self, brain=None): self.x = random.randint(100, 300) self.y = random.randint(100, 300) self.position = np.array([self.x, self.y], dtype='float64') self.radius = 10 self.score = 0 self.r, self.g, self.b = 0, 255, 0 self.color = (self.r, self.g, self.b) if brain: self.brain = brain else: self.brain = network([3, 3, 2]) self.velocity = np.random.uniform(0.1, 0.9, (2, )) self.acceleration = np.array([0, 0], dtype='float64') self.maxforce = 0.09 self.maxspeed = 0.09 self.factor = 5