Popular recipes tagged "eight"http://code.activestate.com/recipes/tags/eight/popular/2010-07-21T10:11:20-07:00ActiveState Code RecipesEight 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>