I am using the flappy bird game to develop reinforcement learning algorithm. I found that the bird fails at some conditions when it should not fail. So I looked into the code and found that a condition is missing when determining whether the bird hit the tube. Please see my modified code here:
for p in self.pipe_group:
hit = pygame.sprite.spritecollide(
self.player, self.pipe_group, False)
for h in hit:
is_in_pipe = ((p.x - p.width / 2) <= self.player.pos_x < (p.x - p.width / 2))
# do check to see if its within the gap.
top_pipe_check = (
(self.player.pos_y - self.player.height / 2) <= h.gap_start) and is_in_pipe
bot_pipe_check = (
(self.player.pos_y +
self.player.height) > h.gap_start +
self.pipe_gap) and is_in_pipe
I am using the flappy bird game to develop reinforcement learning algorithm. I found that the bird fails at some conditions when it should not fail. So I looked into the code and found that a condition is missing when determining whether the bird hit the tube. Please see my modified code here: