1.19 Queens: "show-queen.rkt"
|(require htdp/show-queen)||package: htdp-lib|
The teachpack provides the function show-queen, which implements a GUI for exploring the n-queens problem.
(show-queen board) → true
board : (list-of (list-of boolean?))
The function show-queen 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 trues correspond to positions where queens are, and the falses correspond to empty squares. The function returns nothing.
In the GUI window that show-queen 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.