6
2
You've probably heard of the classic Eight Queens Puzzle. For those of you who haven't it goes something like this:
Position 8 queens on an 8×8 chessboard so that no two queens threaten each other (no two queens appear on the same row, column or diagonal as each other).
Here is one answer that is very close:
X - - - - - - -
- - - - X - - -
- X - - - - - -
- - - - - X - -
- - X - - - - -
- - - - - - X -
- - - X - - - -
- - - - - - - X
As you can see, two queens appear on the long diagonal between the top left corner and the bottom right corner.
Your task is to solve the Eight Queens Puzzle (using any programming language) in a unique or obfuscated manner. The first answer to 15 up-votes wins (the number may be subject to change depending on the popularity of this question).
Your output must be like the example above (empty squares represented by -
, queens represented by X
and a space between each X
or -
). Good luck!!
2I'm voting to close this question as off-topic because there are only 12 possible outputs, and a correct solution just has to print one of them. There's no variation of inputs, and therefore none of outputs. – wizzwizz4 – 2016-02-01T08:10:00.750
How much obfuscation is required? – jdstankosky – 2013-04-12T13:17:40.413
2Can I use pre-solved results, or do I HAVE to solve this programmatically? Just wondering because I found a solution in my head pretty quickly. – jdstankosky – 2013-04-12T13:25:07.957
It's a popularity contest so, as much or as little as you like @jdstankosky – LazySloth13 – 2013-04-12T13:43:16.853
5This is not very interesting, because there are 12 unique, known solutions. There is no variability at all, so just printing out a solution will always win. Why not generalize it, like: chess board size and number of queens are taken as input, and the program has to solve or say there is no solution? Also, why not give a good winning criterion? – None – 2013-04-12T14:59:26.217
Similar to http://codegolf.stackexchange.com/questions/10/n-queens-problem
– Gareth – 2013-04-12T17:08:10.200http://www.ioccc.org/1990/baruch.c ..................... http://www.ioccc.org/1990/baruch.hint – SeanC – 2013-04-15T19:28:38.610