Number Guessing Game - Random fails in tests

I’ve done every task in my script, but when it comes to the tests, it randomly fails (tasks N° 7 to N° 13). I’ve carried out 20 runs, and here are the results:
image
I know there are similar topics, but I’ve made those recommendations that did not work.
Is there any way to see how those tests are?

Here is my repo’s link: Github Repo - Guess the number

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: Number Guessing Game - Build a Number Guessing Game

Link to the challenge:

you should not increment the number of guesses unless the guess is a valid number value.

1 Like

Hi! Thanks for your answer!
I’ve changed the script to only count for valid numbers (I put line 14 into line 20 from number_guess.sh), but it still passes random tasks. It was my first try, but then I followed this solution..
What seems odd to me is that all tasks pass at least one test.

The logic of the code seems circular to me because one function calls another which then calls the function that called it which call the same function in a roundabout way.

So I would put some extra echo statements in the functions to track what is happening to the number of guesses in each function (print out the name of the function when the function is called and print out the number of guesses after each increment statement)

Also post what tasks 7-13 are so we can see if there is a clue there.

1 Like

Well, thanks a lot finally worked!
I paid attention to what you said about calling each function several times, so I eliminated one of them. Now it works straightforwardly.

1 Like