Archive for date: May 4, 2016

Solving the N queens problem, again…

May 4, 2016 | My Projects | By: Mark VandeWettering

Backtracking is a better technique, obviously. The version from earlier today was actually not very clever, and took half an hour to find the 73,712 solutions to the 13×13 checkerboard. This version is less code (just 91 lines, compared to 107 for yesterdays) and finds all the 13×13 solutions in just 2.5 seconds (a speed […]

Solving the N Queens Problem…

May 4, 2016 | My Projects | By: Mark VandeWettering

A question on Quora set me thinking about solving the N Queens problem, which is to list all ways that N queens can be positioned on an NxN checkerboard such that no queen can attack the other. I seemed to have misplaced my implementation of this that I did in Python, so I decided to […]