-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from vikman90/docs/readme
Update README
- Loading branch information
Showing
10 changed files
with
346 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# N-Queens problem using backtracking and CS | ||
|
||
## C# implementation | ||
|
||
### Set up (Ubuntu 22.04) | ||
|
||
```shell | ||
apt install dotnet-sdk-8.0 | ||
``` | ||
|
||
### Build | ||
|
||
```shell | ||
dotnet build --configuration Release queens.csproj | ||
``` | ||
|
||
### Syntax | ||
|
||
``` | ||
queens.jar [-test] [SIZE] | ||
``` | ||
|
||
<dl> | ||
<dt>-test</dt> | ||
<dd>Enable test output.</dd> | ||
<dt>SIZE</dt> | ||
<dd>Length of the chess.</dd> | ||
</dl> | ||
|
||
### Example | ||
|
||
``` | ||
# bin/Release/net8.0/queens 1024 | ||
Queen 1: square 492 | ||
Queen 2: square 294 | ||
(...) | ||
Queen 1023: square 612 | ||
Queen 1024: square 498 | ||
Solved in 1024 steps. Time: 137 ms. | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# N-Queens problem using backtracking and CS | ||
|
||
## C++ implementation | ||
|
||
### Set up (Ubuntu 22.04) | ||
|
||
```shell | ||
apt install g++ make | ||
``` | ||
|
||
### Build | ||
|
||
```shell | ||
make | ||
``` | ||
|
||
### Syntax | ||
|
||
``` | ||
queens [-test] [SIZE] | ||
``` | ||
|
||
<dl> | ||
<dt>-test</dt> | ||
<dd>Enable test output.</dd> | ||
<dt>SIZE</dt> | ||
<dd>Length of the chess.</dd> | ||
</dl> | ||
|
||
### Example | ||
|
||
``` | ||
# ./queens 1024 | ||
Queen 1: square 492 | ||
Queen 2: square 294 | ||
(...) | ||
Queen 1023: square 873 | ||
Queen 1024: square 179 | ||
Steps: 19019 | ||
Discards: 906012 | ||
Time: 476.74 ms. | ||
Performance: 39 steps/ms. | ||
1900 discards/ms. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# N-Queens problem using backtracking and CS | ||
|
||
## Go implementation | ||
|
||
### Set up (Ubuntu 22.04) | ||
|
||
```shell | ||
apt install golang | ||
``` | ||
|
||
### Build | ||
|
||
```shell | ||
go build | ||
``` | ||
|
||
### Syntax | ||
|
||
``` | ||
queens [-test] [SIZE] | ||
``` | ||
|
||
<dl> | ||
<dt>-test</dt> | ||
<dd>Enable test output.</dd> | ||
<dt>SIZE</dt> | ||
<dd>Length of the chess.</dd> | ||
</dl> | ||
|
||
### Example | ||
|
||
``` | ||
# ./queens 1024 | ||
[0] 338 | ||
[1] 591 | ||
(...) | ||
[1022] 155 | ||
[1023] 790 | ||
Steps: 1051 | ||
Discards: 750108 | ||
Time: 43.254331ms | ||
Performance: 24 steps/ms | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# N-Queens problem using backtracking and CS | ||
|
||
## JavaScript implementation | ||
|
||
### Set up (Ubuntu 22.04) | ||
|
||
```shell | ||
apt install nodejs | ||
``` | ||
|
||
### Syntax | ||
|
||
``` | ||
queens.js [-h] [-test] [SIZE] | ||
``` | ||
|
||
<dl> | ||
<dt>-h</dt> | ||
<dd>Print help.</dd> | ||
<dt>-test</dt> | ||
<dd>Enable test output.</dd> | ||
<dt>SIZE</dt> | ||
<dd>Length of the chess.</dd> | ||
</dl> | ||
|
||
### Example | ||
|
||
``` | ||
# java -jar queens.jar 1024 | ||
Queen 1: square 172 | ||
Queen 2: square 1003 | ||
(...) | ||
Queen 1023: square 288 | ||
Queen 1024: square 347 | ||
Solved in 1020 steps. Time: 180.78 ms. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# N-Queens problem using backtracking and CS | ||
|
||
## Java implementation | ||
|
||
### Set up (Ubuntu 22.04) | ||
|
||
```shell | ||
apt install openjdk-19-jdk-headless | ||
``` | ||
|
||
### Build | ||
|
||
```shell | ||
make | ||
``` | ||
|
||
### Syntax | ||
|
||
``` | ||
queens.jar [-test] [SIZE] | ||
``` | ||
|
||
<dl> | ||
<dt>-test</dt> | ||
<dd>Enable test output.</dd> | ||
<dt>SIZE</dt> | ||
<dd>Length of the chess.</dd> | ||
</dl> | ||
|
||
### Example | ||
|
||
``` | ||
# java -jar queens.jar 1024 | ||
Queen 1: square 492 | ||
Queen 2: square 294 | ||
(...) | ||
Queen 1023: square 647 | ||
Queen 1024: square 955 | ||
Solved in 1142 steps. Time: 92 ms. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# N-Queens problem using backtracking and CS | ||
|
||
## PHP implementation | ||
|
||
### Set up (Ubuntu 22.04) | ||
|
||
```shell | ||
apt install php | ||
``` | ||
|
||
### Syntax | ||
|
||
``` | ||
queens.php [-test] [SIZE] | ||
``` | ||
|
||
<dl> | ||
<dt>-test</dt> | ||
<dd>Enable test output.</dd> | ||
<dt>SIZE</dt> | ||
<dd>Length of the chess.</dd> | ||
</dl> | ||
|
||
### Example | ||
|
||
``` | ||
# php queens.php 256 | ||
Queen 1: square 172 | ||
Queen 2: square 1003 | ||
(...) | ||
Queen 255: square 45 | ||
Queen 256: square 174 | ||
Solved in 5106 steps. Time: 445.57 ms. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# N-Queens problem using backtracking and CS | ||
|
||
## Python implementation | ||
|
||
### Set up (Ubuntu 22.04) | ||
|
||
```shell | ||
apt install python3 | ||
``` | ||
|
||
### Syntax | ||
|
||
``` | ||
queens.py [-test] [SIZE] | ||
``` | ||
|
||
<dl> | ||
<dt>-test</dt> | ||
<dd>Enable test output.</dd> | ||
<dt>SIZE</dt> | ||
<dd>Length of the chess.</dd> | ||
</dl> | ||
|
||
### Example | ||
|
||
``` | ||
# ./queens.py 512 | ||
Queen 1: square 172 | ||
Queen 2: square 1003 | ||
(...) | ||
Queen 511: square 1 | ||
Queen 512: square 1 | ||
Solved in 1591 steps. Time: 1241.388 ms. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# N Queens Problem Solver | ||
|
||
[![CI](https://github.com/vikman90/queens-psr/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/vikman90/queens-psr/actions/workflows/ci.yml) | ||
|
||
This is a set of implementations of the famous N Queens Problem solver in | ||
multiple programming languages. The N Queens Problem is a problem of placing N | ||
queens on an NxN chessboard without any queen being able to attack the others. | ||
|
||
## Features | ||
|
||
- Efficient implementations. | ||
- Utilize backtracking and constraint propagation to find a solution. | ||
- Provides the ability to specify the number of queens (size of the board). | ||
- Offers an alternative testing output of the found solutions. | ||
|
||
## Performance comparison | ||
|
||
|Implementation|Steps/ms (avg)|Discards/ms (avg)| | ||
|--|--:|--:| | ||
|C++|125,20|10.715,92| | ||
|Rust|93,10|5.793,85| | ||
|Go|72,91|1.282,14| | ||
|JavaScript|29,49|1.629,27| | ||
|C#|22,65|1.263,75| | ||
|Java|13,26|1.047,12| | ||
|Python|2,17|519,03| | ||
|
||
## Usage | ||
|
||
Instructions available at each implementation folder. | ||
|
||
## Contribution | ||
|
||
Contributions are welcome! If you have any ideas to improve this project, feel free to submit a pull request. | ||
|
||
## Credits | ||
|
||
This project was developed by [Vikman Fernandez-Castro](https://github.com/vikman90). | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters