#Problem with neat AI

15 messages · Page 1 of 1 (latest)

north cloud
#

don't remove items from a list while iterating through the list. idk how exactly it works but from personal experience that breaks loops

ruby lichen
#

@wind wing can u send the code through some paste

#

T.tag paste

shy oliveBOT
rustic trench
#

If you're popping items from the list while iterating, you end up shifting all the indexes and you skip birds and try to pop indexes that don't exist anymore

#

The first thing I can think of is creating a copy of your list, and deleting items from the copy instead of the original - but that isn't space efficient

#

What are you trying to do exactly?

#

That's ok - everyone starts somewhere - although I don't think going straight into AI is a good idea

#
for bird in birds:
            if bird.y + bird.img.get_height() > 730 or bird.y < 0:
                    birds.pop(x)
                    nets.pop(x)
                    ge.pop(x)


Your problem is in this bit of code.

x isn't defined anywhere here - it's using the last x from your other loop above so you end up removing the wrong bird

#

Line 248

#

I'm assuming you're making a model that trains a flappy bird - if it hits a pipe or goes too low or high then the bird is not successful

#

I'm not 100% sure if that iterates correctly but glad I could help resolve at least one issue 🙂

#

Uh I think keeping things on this server would be better

#

You can chat to me in any of the channels cheemsadidas

#

I'm from the UK