Top-rated recipes tagged "queens"http://code.activestate.com/recipes/tags/queens/top/2013-03-20T19:03:44-07:00ActiveState Code RecipesEight queen problem (Javascript) (JavaScript)
2013-03-20T19:03:44-07:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/578497-eight-queen-problem-javascript/
<p style="color: grey">
JavaScript
recipe 578497
by <a href="/recipes/users/4174477/">Thomas Lehmann</a>
(<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/queen/">queen</a>, <a href="/recipes/tags/queens/">queens</a>).
</p>
<ul>
<li>Adding this for my old <a href="http://code.activestate.com/recipes/577438/">recipe 577438</a> (in Python).</li>
<li>Use node.js or HTML as execution (see comments in "log" function)</li>
</ul>
Eight Queens With out Permutations (Python)
2010-07-21T10:11:20-07:00Narayana Chikkamhttp://code.activestate.com/recipes/users/4174427/http://code.activestate.com/recipes/577325-eight-queens-with-out-permutations/
<p style="color: grey">
Python
recipe 577325
by <a href="/recipes/users/4174427/">Narayana Chikkam</a>
(<a href="/recipes/tags/eight/">eight</a>, <a href="/recipes/tags/queens/">queens</a>).
</p>
<p>Eight Queens is one of the popular algorithms in backtracking. The solution given below uses simple math to reduce the processing. The logic is keep placing the coins on the board with below rules:</p>
<ol>
<li>Don't place the coin if there is another coin present in the same row</li>
<li>Don't place the coin if there is another coin present in the same col</li>
<li>Don't place the coin if there is another coin present in any of the diagonal lines.</li>
</ol>
<p>Keep repeating the above 3 rules recursively until we keep all the coins.
Problem Definition:
<a href="http://en.wikipedia.org/wiki/Eight_queens_puzzle" rel="nofollow">http://en.wikipedia.org/wiki/Eight_queens_puzzle</a></p>