Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mericluc/ecv-queens
ECV Application : N Queens
https://github.com/mericluc/ecv-queens
cpp cpp17 dlx-algorithm n-queens qt qt5
Last synced: 19 days ago
JSON representation
ECV Application : N Queens
- Host: GitHub
- URL: https://github.com/mericluc/ecv-queens
- Owner: MericLuc
- Created: 2022-11-10T17:15:29.000Z (about 2 years ago)
- Default Branch: dev
- Last Pushed: 2022-11-12T19:58:22.000Z (about 2 years ago)
- Last Synced: 2023-03-28T00:45:32.986Z (almost 2 years ago)
- Topics: cpp, cpp17, dlx-algorithm, n-queens, qt, qt5
- Language: C++
- Homepage:
- Size: 1.28 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ECV - Sudoku
**:star2: Exact cover problem - N Queens application :star2:**
Graphic toy written in C++/Qt to solve the [**N Queens problem**](https://en.wikipedia.org/wiki/Eight_queens_puzzle).
Under the hood, it uses the [**ECV library**](https://github.com/MericLuc/ecv) that implements [Donald Knuth's Algorithm X](https://arxiv.org/pdf/cs/0011047v1.pdf).
![example](imgs/example.gif)
## How to build/install
_Dependencies_ :
- Qt5 (Qt5::Widgets Qt5::Svg packages)
- ecv (as a submodule)Start by getting the sources :
```
[~/git] git clone https://github.com/MericLuc/ecv-queens.git
[~/git] git submodule update --init --recursive
```Then, the easiest way to build is to use it as a QtCreator project.
Otherwise, you can build from command-line using cmake and defining a bunch of Qt related variables.
It should be something like that (not garanteed) :
```
[~/builds] cmake -S ${PATH_TO_PROJECT} -B ${PATH_TO_BUILD} -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${PATH_TO_QT_INSTALL}
[~/builds] make
```## Example usage
[**Play**](https://mericluc.github.io/ecv/queens/app.html) in your browser using a [webassembly](https://webassembly.org/) compiled version.
_Rules_ :
- Hover a cell to select it.
- Left-click to add/remove a queen to a cell.
- For the rest, I think the UI buttons are self-explanatory 😁## Acknowledgements
[This article](https://www.nohuddleoffense.de/2019/01/20/dancing-links-algorithm-x-and-the-n-queens-puzzle/) was pretty useful, especially to realize the concept of "primary/secondary" constraints in exact-cover problems.