Suppose I said "I'm thinking of a number from 1 to 1000. You can "guess" 10 numbers, and I'll tell you if it is my number, or if it is too high or too low". I'll also say that the right algorithm will always converge to my chosen number. How would you do that?
The algorithm is called "Binary Search", and I'll leave it to you to either figure it out (hint -- Binary Search) or look it up.
Bob Schor