Clone this repository by opening up the command line and running the following:
mkdir 8queens
git clone https://github.com/mlabisi/8queens.git
cd 8queens
Make sure you have npm
installed on your laptop! You can install it by going to the official site.
Now that you've installed the package manager, you're ready to install dependencies! You can do so by simply typing npm install
in the 8queens directory.
Dependencies are the
npm
packages that our project depends on. Theproject.json
file contains a list of all of the dependencies for our project, but it doesn’t actually install them--we need to run thenpm install
command.
Now that the dependencies have been installed, you can run 8queens locally! To do so, go ahead and use this command: npm run start
.
The 8queens GUI is very simple. Use the radio buttons on the right-hand side of the screen to select the algorithm you'd like to run.
This optimization-based algorithm places the queens on the board randomly, one per column. The algorithm then works to reduce the number of pairs of attacking queens.
Using the concept of the global optimum, this algorithm starts with one queen per column, then moves queens one at a time, each one within its own column. If the algorithm gets stuck at the local optimum, a new random state will be generated and the process will repeat.
Based on the theory of evolution and natural selection, this algorithm introduces the concepts of populations, generations, and mutations in order to implement a "survival-of-the-fittest" strategy. The most optimal successor is chosen for each generation.