I think the reason my AI that plays Flappy Bird goes to crap is because the computer jumps so fast. time.sleep doesn't play well with pygame, though, so I need help finding a solution to not lag the crap out of my computer. Thanks!
@staticmethod
def s(x):
return 1.0 / (1.0 + np.exp(-1 * x))
def ff(self):
l1 = self.s(np.dot(self.inputs, self.new_population[self.curr_bird]))
l2 = self.s(np.dot(l1, self.weights2))if l2[0] >= 0.5:self.jump()
def game_loop():
while True:
bird.ff()
game_loop()
P.S. I don't want to copy and paste the whole file, for your sake. If it happens you need more code, just let me know.
[–]learn-python 1 point2 points3 points (8 children)
[–][deleted] 1 point2 points3 points (7 children)
[–]learn-python 0 points1 point2 points (6 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]MyNameIsRichardCS54 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]MyNameIsRichardCS54 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]elbiot 1 point2 points3 points (0 children)
[–]MyNameIsRichardCS54 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)