I'm stucking on the logical approach for the following exercise, can choose between JS and Python :
(I already find a lot of ways to generate the random number that's not the point of my question)
Find a secret integer between 1 and 1000000 in less than 50 run of function verify()
This function solves the game without user input
It returns the solution by using the function verify() that takes the number to verify as argument and returns three values: -1 if number to guess is greater, 1 if number to guess is smaller and 0 if it's the right number
The function verify() can't be called more than 50 times
More than a definitive answer I'm looking to upgrade my logical so please describe it,
Thanks in advance !
Aucun commentaire:
Enregistrer un commentaire