Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algorithm doesn't work when all scores are zero #9

Open
adityathebe opened this issue May 10, 2018 · 0 comments
Open

Algorithm doesn't work when all scores are zero #9

adityathebe opened this issue May 10, 2018 · 0 comments

Comments

@adityathebe
Copy link

In your version of flappy bird, the score is assigned based on the distance traveled. Hence, there's no way a bird has score = 0 in a generation. But, in my version, I have assigned points based on the number of pipes crossed. And there's a good chance none of the birds make it in the first generation. Hence, the total score of the generation = 0;

https://github.com/shiffman/NOC-S18/blob/95b801d6e0cefeb9b8d2ac1997d0b68bb46d95d7/week10/neuroevolution-flappybird/ga.js#L75-L79

In this algorithm, since r remains constant the loop runs forever until the index > birds.


https://github.com/shiffman/NOC-S18/blob/95b801d6e0cefeb9b8d2ac1997d0b68bb46d95d7/week10/neuroevolution-flappybird/ga.js#L56-L59

Likewise while calculating the fitness, the scores will be divided by zero resulting in NaN fitness for all birds

How can these issues be solved without changing the scoring system ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant