techwithtim / NEAT-Flappy-Bird

An AI that plays flappy bird! Using the NEAT python module.
737 stars 482 forks source link

Small error #12

Open ERogalla opened 4 years ago

ERogalla commented 4 years ago

Hi Tim,

I was going through your code and realized a small formatting error. I don't know if you still keep up with this repo but I though I'd point it out. In your file "Flappy_bird.py", you wrote this starting on line 368

for pipe in pipes:
    ...
    for bird in birds:
        ...

    if not pipe.passed and pipe.x < bird.x:
        pipe.passed = True
        add_pipe = True

The problem on line 381 is that bird.x cannot be referenced because it is not inside the birds for loop. I do not know if this was meant on purpose or if this error even occurs. I would suggest changing it to

if not pipe.passed and pipe.x < birds[0].x:

Thank you for your time and thanks for the videos!

ostap-tymchenko commented 4 years ago

i recommend just making this into a pull request.