MLUG: Re: [MLUG] N-Queens Problem Solver
Re: [MLUG] N-Queens Problem Solver
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Thu, 17 Apr 2008, Michael Stegeman wrote:

Hey, not sure if any of you will find this at all useful or interesting, but I wrote a program that solves the N-queens problem using a simulated annealing algorithm very, very quickly. I solved a 100x100 problem in just over 5 minutes, running at 1.83 GHz. If you download, open up the source file and change "#define N 20" to whatever number you'd like. Let me know what you think!

I think it's really cool. I was not familiar with this problem. It does seem that some people are interested in the number of possible solutions for an NxN board. For example, for the 20x20 board, there are, supposedly, 39,029,188,884 solutions. It is hard to count them all quickly. This programmer claims to produce that number just given for the 20x20 board in about 20.5 minutes with an 800 MHz processor:


http://jsomers.com/nqueen_demo/nqueens.html

I like your output:

Solution for 30x30 Puzzle:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Q ~ ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Q ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ Q ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Q
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Q ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Q ~ ~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~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