This program implements a binary, symmetry aware, backtracking solution to the N Queens problem. The algorithm is based primarily on the work in the paper, "Backtracking Algorithms in MCPL using Bit Patterns and Recursion," by Martin Richards. Code was added to detect mirror image solutions. The paper discussions a recursive algorithm, but this program implements the solution as an iterative state machine to limit call stack depth.
In addition, the solver checks for any three queens which are collinear. The visualizer marks collinear paths as red, and all other paths as green. This part of the algorithm was based on the, "No-three-in-line problem," which is discussed here.
The visualizer allows the user to filter the results based on detection of collinear queens.
I use IntelliJ as my IDE, but the code should work in Eclipse. Gradle is the build system.
The code is built against and requires Java 13 to run. I make use of preview features in the Java language,
so the --enable-preview
is required for compiling and running.