# Thread: Need formula help to calculate the edge of a range / unknown number.

1. ## Need formula help to calculate the edge of a range / unknown number.

Hi, first post, as I'm at a total loss with this. I'm sure I'm missing something obvious but can't get my head round it. Hopefully someone here will.

We have an unknown number between 1 and 999, which we'll call x

x falls midway within a range of 100

I am allowed to make a guess at x, after which I get an indication of how close I am ranging from -3 through to +3 including 0. If my feedback is zero, I am within the range of 100.

I need to work out a formula, to calculate my next guess, to calculate one edge of the range in as few attempts as possible. eg guess = 341, feedback = +1. Guess 340, feedback = 0.

I think this revolves around some sort of iteration formula, but am needing help on this one.

Many Thanks

2. ## Re: Need formula help to calculate the edge of a range / unknown number.

I don't understand the setup. Is there a precise statement about what this "indication" from -3 to 3 means? You say that, if the feedback is 0 then your guess is within a range of 100 (presumably meaning that your guess is at most 49 units away from the true value). What would a value of +1 mean? That you're 50 units away? What would you get for feedback if you're 200 units away? Would that just register as a +3 or something?

Also, does this mean that x could be 1 and therefore if you guess 0 (even though 0 is not a possible value of x) the feedback would be 0?

3. ## Re: Need formula help to calculate the edge of a range / unknown number.

Lets say that +3 is 3 times 50 (half of the range), +2 is 2 x 50 and +1 is 1 x 50. and the same on the negative side. Assume the range goes from 0 - 999 which will eliminate that issue, and negative guesses are not valid.

What I need to do narrow down the field so:

Assume my first guess is 650, x = 499

My feedback will be level +3, so I take off 150, and guess at 500. Now I get a feedback of 0.

I now need to go up again to get a value in +1, so that I can narrow down the range to the point where I have a guess at 0 and a guess one number greater is +1. Then I know the edge of the range. I also need this formula / equation to take into account that my guess could be too low. Hence why the feedback is - / + so you can use this to work with Range / 2, range / 4 etc to progessively converge on the edge of it.

M