Saturday, May 27, 2017

Bugfixes

While working on my current Programming Challenge, I noticed that something wasn't working as expected. The source of the problem was an if-statement to determine the highest score achieved by a player. Everything seemed to be working, except when player 1 has achieved the highest score. 

The original if-statement:

if (pData[index].pointsScored > players.highscore)

The corrected if-statement:

if (pData[index].pointsScored >= players.highScore)

As it turns out, this is the same stupid mistake I made in both Programming Challenge 11.04 and Programming Challenge 11.05. The difference is that I didn't notice it right away. The reason for not noticing it was, that I never assigned JANUARY the lowest or highest amounts of rainfall to see whether it works. 

if (metData[index].totalRainfall <= yearly.lowestPpt)

if (metData[index].totalRainfall >= yearly.highestPpt)

I fixed the relevant parts of code and updated the Blog-posts, so that everything should work flawlessly now. Sorry everyone!

No comments:

Post a Comment