Skip to content

A solution to the n-queens puzzle

License

Notifications You must be signed in to change notification settings

jeffseif/queens

Repository files navigation

queens

A solution to the n-queens puzzle.

Casting the puzzle as a set cover problem, it is solved using the DLX algorithm. This project is a stepping-stone to a better algorithm for my sudoku project.

Development

> git clone git@github.com:jeffseif/queens.git
> cd queens
> make test

Example invocation

> ./cli --help
usage: __main__.py [-h] [--version] [size]

N-queens solver

positional arguments:
  size        Number of queens (e.g., 8)

optional arguments:
  -h, --help  show this help message and exit
  --version   show program's version number and exit

Version 1.0.0 | Jeffrey Seifried 2016

> ./cli 4
0
+---------+
| . ♕ . . |
| . . . ♕ |
| ♕ . . . |
| . . ♕ . |
+---------+
1
+---------+
| . . ♕ . |
| ♕ . . . |
| . . . ♕ |
| . ♕ . . |
+---------+