This is the solution for Eight Queens Puzzle written in Python.
Found in test_basic.py
Tests were written with pytest and contiuosly tested each commit by TravisCI.
Solutions for the queens puzzle with N = 8 queens to N = 17 can be tested. By default the only test is for 8 Queens but the others can be uncommented.
-
Clone this repository
-
Start containers Run the following command:
sudo docker-compose up -d --build
- Run containers Run the following command:
sudo docker-compose run web python main.py db postgres_queens
Running the code will solve for 8 Queens, it prints the number of solutions and each of them and stores them in a PostgreSQL Database.
To connect to the database and check for the solutions, run the following code:
sudo docker exec -it postgres_queens psql -U brime -d queensdb
This will enable you to type queries to the table solutions, for example:
SELECT * FROM solutions;