[racket] Checking (on) queens | Concerns about HtDP exercise 28.2.4

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Jun 8 10:13:22 EDT 2010

On Jun 7, 2010, at 11:33 AM, Horace Dynamite wrote:

> The first concern is speed.

The book is not about designing the fastest possible N queens program.
It's been years (decade?) since I ran this problem but on my old sun3
it didn't take very long to solve the problem.


> My second concern is the behavior in the case when the input board
> contains queens[2].

As I said in a private email, this is an instance of an accumulator
design and I am jumping the gun here with this hint.

The key is that the board must satisfy the constraint that neither
of its queens may threaten another one.

An empty board obviously satisfies this one.

Design a function that checks whether some given board is a valid board.


> And finally, my third concern is testing. How am I to test with any
> assurance that I have a sane design?


You need to figure out how to test the auxiliary functions in your
project. When/if I have time today, I'll write a solution.

-- Matthias



Posted on the users mailing list.