FleaInNYCbanner.jpg

? Oxymoron | Main | Waffle ?

March 06, 2004

Queens

I assume there is an obvious trick to this "8 Queens of Death" game but I have not yet spotted it. Or maybe not. I can place seven Queens but not eight.

Posted by Ghost of a flea at March 6, 2004 12:48 PM

Comments

No obvious trick that I know of. This is a classic programming exercise for recursive programming. The horizontal/vertical move of the queen means there can be only one queen on each column and on each row. After that the problem is to find a placement that doesn't put queens on the same diagonal. SO, the approach is to place a queen somewhere on the first row followed by a queen on the second row that does not attack the first followed by a queen on the third row and so on until all the queens are placed or no solution is possible. If no solution is found go back one row from where you quit and move that queen if possible and go forward again. If that queen can't be moved go back one more row and move that queen and continue forward from there and so on and so on.

This was one of the first programs I wrote for my 6502 based Ohio Scientific single board computer circa 1978. It had 4K of memory, cassette tape storage for programs, Basic, DOS, and used a TV for a monitor. Wonderful machine.

Posted by: Fred Boness at March 7, 2004 01:40 AM

I found a solution by a combination of the knight's move, and a little trial and error:
2,4,6,8,3,1,7,5

I can't see any DOD3 logo, though.

Posted by: Simon Jester at March 8, 2004 12:58 PM