racket/teachpack/htdp/Docs/guess.thtml
2005-05-27 17:52:04 +00:00

50 lines
1.9 KiB
Plaintext

{ (define LIBNAME "Guess")
(include "head.tinc") }
<p>The teachpack <code>guess.ss</code> provides operations to play a
guess-the-number game. Each operation display a GUI in which a player
can choose specific values for some number of digits and then check the
guess. The more advanced operations ask students to implement more of the
game. </p>
<p> The teachpack provides three operations:
<menu>
<li><code>{(idx guess-with-gui)} : check-guess -> true; </code> <br>
The check-guess function consumes two numbers: <code>guess</code>, which
is the user's guess, and <code>target</code>, which is the randomly
chosen number-to-be-guessed. The result is a symbol that reflects the
relationship of the player's guess to the target.
<br><br>
<li><code>{(idx guess-with-gui-3)} : check-guess -> true; </code> <br>
The check-guess function consumes three digits and one number:
<code>digit0, digit1, digit2</code>, which make up the user's guess, and
<code>target</code>, which is the randomly chosen
number-to-be-guessed. The result is a symbol that reflects the
relationship of the player's guess (the digits converted to a number) to
the target.
<br><br>
Note: <code>digit0</code> is the <em>least</em> significant digit that
the user chose and <code>digit2</code> is the <em>most</em> significant
one.
<li><code>{(idx guess-with-gui-list)} : check-guess -> true; </code> <br>
The check-guess function consumes a list of digits and one number:
<code>digits</code>, a list that makes up the user's guess, and
<code>target</code>, which is the randomly chosen
number-to-be-guessed. The result is a symbol that reflects the
relationship of the player's guess (the digits converted to a number) to
the target.
<br><br>
Note: the first item on <code>digits</code> is the <em>least</em>
significant digit that the user chose, and the last one is the
<em>most</em> significant digit.
</menu>
{(include "foot.tinc")}