<commit_before># N Queens on a chess
***
Java programs to count and/or print solutions of the [N Queens puzzle on a NxN chess](http://en.wikipedia.org/wiki/Eight_queens_puzzle)

## Keys

Contraint programming is very efficient with this algorithm because lots of possibilities don't have to best tested.

### One Queen per line

Only one queen can be placed on on line (or column) so if a queen is placed, the algorithm must go on to the next line:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| - | - | - | - | - | - | - | - |
| :red_circle: | :red_circle: | :red_circle: | :black_large_square: | :red_circle: | :red_circle: | :red_circle: | :red_circle: |
|  |  | :red_circle: | :red_circle: | :red_circle: |  |  |  |
|  | :red_circle: |  | :red_circle: |  | :red_circle: |  |  |
| :red_circle: |  |  | :red_circle: |  |  | :red_circle: |  |
|  |  |  | :red_circle: |  |  |  | :red_circle: |
|  |  |  | :red_circle: |  |  |  |  |
|  |  |  | :red_circle: |  |  |  |  |
|  |  |  | :red_circle: |  |  |  |  |

## with reccursive back-tracking algorithm
| Complexity::white_check_mark: | Efficiency::warning: |
| ---------- | ---------- |
**The best complexity/efficiency method**:
```java

```<commit_msg>Table fix and add constraint arrays<commit_after># N Queens on a chess
***
Java programs to count and/or print solutions of the [N Queens puzzle on a NxN chess](http://en.wikipedia.org/wiki/Eight_queens_puzzle)

## Keys

Contraint programming is very efficient with this algorithm because lots of possibilities don't have to be tested.

### One Queen per line

Only one queen can be placed on each line so if a queen is placed, the algorithm must go on to the next line:

| L\C | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| ------------- | ----------- | ------------- | ----------- | ------------- | ----------- | ------------- | ----------- | ----------- |
| 1 | :red_circle: | :red_circle: | :red_circle: | :black_large_square: | :red_circle: | :red_circle: | :red_circle: | :red_circle: |
| 2 |  |  | :red_circle: | :red_circle: | :red_circle: |  |  |  |
| 3 |  | :red_circle: |  | :red_circle: |  | :red_circle: |  |  |
| 4 | :red_circle: |  |  | :red_circle: |  |  | :red_circle: |  |
| 5 |  |  |  | :red_circle: |  |  |  | :red_circle: |
| 6 |  |  |  | :red_circle: |  |  |  |  |
| 7 |  |  |  | :red_circle: |  |  |  |  |
| 8 |  |  |  | :red_circle: |  |  |  |  |

### One Queen per column

With the previous placed Queen an array can be defined to mark already blocked column:

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| ------------- | ----------- | ------------- | ----------- | ------------- | ----------- | ------------- | ----------- |
| :white_circle: | :white_circle: | :white_circle: | :red_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: |

### One Queen per diagonals

With the previous placed Queen 2 arrays can be defined to mark already blocked diagonals:

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| ------------- | ----------- | ------------- | ----------- | ------------- | ----------- | ------------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- |
| :white_circle: | :white_circle: | :white_circle: | :red_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: |

With x and y going from 0 to 7, this code can be used:
```java
descendingDiagnonal = x + y;
```

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| ------------- | ----------- | ------------- | ----------- | ------------- | ----------- | ------------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- |
| :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: | :red_circle: | :white_circle: | :white_circle: | :white_circle: | :white_circle: |

With x and y going from 0 to 7, this code can be used:
```java
ascendingDiagnonal = x + 8 - 1 - y;
```

## with reccursive back-tracking algorithm
| Complexity::white_check_mark: | Efficiency::warning: |
| ---------- | ---------- |
**The best complexity/efficiency method**:
```java

```
{'fraction_non_alphanumeric': 0.28003675626005053, 'fraction_numerical': 0.018607856650585803, 'mean_word_length': 1.873927392739274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1214331', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1435, 'n_words': 386}