Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Trying to solve N-Queens

by demerphq (Chancellor)
on Sep 09, 2002 at 16:47 UTC ( [id://196346]=note: print w/replies, xml ) Need Help??


in reply to Trying to solve N-Queens

I havent looked at this program in a long time. Sigh. Yet another thing to do when I get the chance. Anyway, just a thought for you (you may have dealt with this already I havent reviewd the code in depth yet) but the closest two queens can get to each other is a knight hop away. (Knights move in an L)

In other words the queen in the middle can only have other queens at the locations indicated by '?' (or further away). No queen can possibly be at any of the X locations. Adjust the "circle" of knight hops as is appropriate for the actual amount of the board available given the current queen position.
x?x?x
?xxx?
xxQxx
?xxx?
x?x?x

--- demerphq
my friends call me, usually because I'm late....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://196346]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found