1 Ht DP Teachpacks
2 Ht DC Teachpacks
On this page:
show-queen
Version: 4.0.2

 

1.15 8 Queens: show-queen.ss

The teachpack provides the operation 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.