title: Guessing a number knowing only if the number proposed is lower or higher?
body: <p>I need to guess a number. I can only see if the number I'm proposing is lower or higher. Performance matters a whole lot, so I thought of the following algorithm:</p>
  <p>Let's say the number I'm trying to guess is 600.</p>
  <ul>
  <li><p>I start out with the number 1000 (or for even higher performance, the average result of previous numbers).</p>
  </li>
  <li><p>I then check if 1000 is higher or lower than 600. It is higher.</p>
  </li>
  <li><p>I then divide the number by 2 (so that it is now 500), and check if it is lower or higher than 600. It is lower.</p>
  </li>
  <li><p>I then find the difference and divide it by 2 in the following way to retrieve a new number: (1000 + 500) / 2. The result is 750. I then check that number.</p>
  </li>
  </ul>
  <p>And so on.</p>
  <p>Is this the best approach or is there a smarter way of doing this? For my case, every guess takes approximately 500 milliseconds, and I need to guess quite a lot of numbers in as low time as possible.</p>
  <p>I can roughly assume that the average result of previous guesses is close to the upcoming numbers too, so there's a pattern there which I can use for my own advantage.</p>