|
-
October 19th, 2002, 07:34 AM
#1
help
help me with coding the problem of "eitht queens"not using recursion
-
October 19th, 2002, 03:53 PM
#2
Re: help
Originally posted by jamescode
help me with coding the problem of "eitht queens"not using recursion
What is "eitht queens"?
SolarFlare
Those who cling to life die and those who defy death live. -Sun Tzu
cout << endl;
return 0;
}
-
October 19th, 2002, 05:50 PM
#3
you probably meant the eight queens problem
You're talking about the classic problem of placing eight queens on a chess board so that none of them attack each other. Do you want all solutions or just one solution. The basic algorithm is to use a knight move as the separation. Start on an edge(row or column) and place a queen down. Now to figure where to put the queen in the next row or column next to the edge, move two steps parallel to the edge (either way) and one step perpendicular. Continue the same direction choice you made in the first step until all rows or columns (parallel to starting edge) have a queen. You need to use toroidal math, though, and wrap any moves that take you outside the board to the opposite side. This wasn't completely clear, but I hope it gives you a start.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|