i made half of the program but i can not make the computer guessing system more efficient can you make it solve by only if computer takes less than 7 guesses and solves it
I am confused lol i think i need to do something with the range of rand number for example if given number is 65 and computer guesses 45 , i should set the range from 45 to 100 and never go lower than the number already guessed . i face problem in the how to put 45 to 100 in rand genrator range area
Start with min and max at 0 and 100. Guess at (min+max)/2, then depending on if it's too high or too low, change min or change max. It's just binary search but without an array ;)
Even with the most effective binary search, it cannot be done in under 7 guesses, but it can always be done in 7 guesses exactly. Are you sure <=7 guesses is not what is required?
Yes if its exactly 7 its still ok but it gives an average of 28 counts may be i am implementing the min and max logic in a wrong way could you modify the code to give count 7 or under 7