Number Guessing Game - Build a Number Guessing Game

Tell us what’s happening:

My code doesn’t pass the test and I don’t know why. Its functionality seems to check every task but it doesn’t…

I’ve even read the 1.1.test.js file to understand how the code is tested, and I’ve looked for help by reading the forum but I still don’t get it.

Hope you can help me! Here’s my repo:

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Number Guessing Game - Build a Number Guessing Game

Make sure you count the invalid guesses too in the guess count.

Thanks for your reply! I didn’t see it :woozy_face:

I do, I count the invalid guesses too (I’ve tried it both ways). But the Run button even throws:

“The next line printed should be Guess the secret number between 1 and 1000: and input from the user should be read”

as an uncheck task. And my program actually does it, that’s why I’m so stuck, I can’t find out how to check a task that my program actually does.

you definitely have to add up all the guesses including the bad ones.
But, I noticed you’re updating the tables a lot!
Don’t update the table until the end. (when the person guesses the correct number)
Just keep a running count of their guesses locally till that happens.

Thank you!!! It worked. :heart_eyes:

I’d never have known that the bug was related to this, and my code is much more functional now btw (it took a lot every time I pressed the Run button…)

Greetings from Argentina! :person_raising_hand:

1 Like

well done! you did it!

ps. it may be that the testcases would time out if your run time was too long.

1 Like