LuisBrime / eightqueenspython

Cuenca's python coding challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eight_queens_python :shipit:

Build Status

This is the solution for Eight Queens Puzzle written in Python.

Tests

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.

Run the code

Prerequisites

Step by step

  1. Clone this repository

  2. Start containers Run the following command:

sudo docker-compose up -d --build
  1. 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;

About

Cuenca's python coding challenge

License:MIT License


Languages

Language:Python 92.5%Language:Dockerfile 7.5%