<h3>Lucky Guess? Or Calculated Risk?</h3>
<h4>(λ)</h4>
<p>From the example on the previous page, it looks like our game will need at least 3 different kinds of expressions:<code>guess</code>, <code>smaller</code>, and <code>bigger</code>.</p>
<p>For the expressions to do what we want, we need to define the functions behind them.</p>
<p>Before we do that, let's think about the strategy behind this simple game. The basic steps are:
<ul>
  <li><span>set the upper and lower limits of the player's number</span></li>
  <li><span>guess a number halfway between the upper and lower limits</span></li>
  <li><span>lower the upper limit if the player says the number is smaller</span></li>
  <li><span>raise the lower limit if the player says the number is bigger</span></li>
</ul>
</p>
<p>I'll let you in on a secret: your program won't actually <em>guess</em> the number, it will <em>find</em> it using a simple and effective <font class="red">binary search</font> algorithm.</p>
<p>The risk? There isn't one&#8230; seemed like a cool title.</p>
<p>Now type: <code class="expr">(define lower 1)</code></p>
<aside id="info">
  <span><font class="red">binary search</font><br>divides a range of values into halves, and continues to narrow down the field of search until the unknown value is found. It is the classic example of a "divide and conquer" algorithm.</span>
</aside>
