[racket] placing-queen 43.3.1

From: Ken Hegeland (hegek87 at yahoo.com)
Date: Thu Dec 23 00:31:56 EST 2010

I am just about done with the book, only a few more exercises.

The method I went at for this problem was to just set the initial position to false and then recur on the interval.

My thinking is, to make all the spots the queen threatens on a horizontal, you would leave the y and adjust the x.

for putting it at 4, 4, you'd want to set 3, 4.  2, 4 .  1,4.  0,4  5,4  6,4  7,4 ....(board-length), 4.

The verticals are similar, switching the y each time.

I am having trouble with the diagonals. For me it just continually runs until I kill it or my computer freezes up.

My thought is that it should set the initial posn to false, and then recur 4 times, once for each diagonal direction.

so, for 4, 4 it should do, 3,3   5,5  3,5   5, 3.  continually adding numbers until it reaches 0 or vector-length.

I just want to know if I am thinking about this correctly. I feel like it should work perfect but generally when it does something to slow down my computer this much I have something thought out wrong.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101222/0f330ee4/attachment.html>

Posted on the users mailing list.