22 lines
853 B
Plaintext
22 lines
853 B
Plaintext
{ (define LIBNAME "Show Queen")
|
|
(include "head.tinc") }
|
|
|
|
<p>The teachpack <code>show-queen.ss</code> provides the
|
|
operation <code>{(idx show-queen)}</code>. It implements a GUI for
|
|
exploring the n-queens problem.</p>
|
|
|
|
<p>The function <code>show-queen</code> consumes a list of
|
|
lists of booleans that describes a board. Each of the inner
|
|
lists must have the same length as the outer list. The
|
|
<code>true</code>s correspond to positions where queens are,
|
|
and the <code>false</code>s correspond to empty squares. The
|
|
function returns nothing.
|
|
|
|
<p>In the GUI window that <code>show-queen</code> opens, the
|
|
red and orange dots show where the queens are. The green dot
|
|
shows where the mouse cursor is. Each queen that threatens
|
|
the green spot is shown in red, and the queens that do not
|
|
threaten the green spot are shown in orange.
|
|
|
|
{(include "foot.tinc")}
|