Skip to content

Commit

Permalink
Add README files at each implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
vikman90 committed Feb 23, 2024
1 parent 58876fc commit 5b0d255
Show file tree
Hide file tree
Showing 7 changed files with 282 additions and 0 deletions.
42 changes: 42 additions & 0 deletions C#/README.md
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.
```
46 changes: 46 additions & 0 deletions C++/README.md
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.
```
44 changes: 44 additions & 0 deletions Go/README.md
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
```
38 changes: 38 additions & 0 deletions JS/README.md
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.
```
42 changes: 42 additions & 0 deletions Java/README.md
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.
```
35 changes: 35 additions & 0 deletions PHP/README.md
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.
```
35 changes: 35 additions & 0 deletions Python/README.md
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.
```

0 comments on commit 5b0d255

Please sign in to comment.