|
1 |
| -# Eight-Queens-Recursion |
2 |
| -A fully recursive algorithm to solve eight queens' problem |
| 1 | +# Eight Queens Recursive Solver |
3 | 2 |
|
| 3 | +A fully recursive implementation to solve the classic Eight Queens Puzzle in Java. |
4 | 4 |
|
| 5 | +[](https://opensource.org/licenses/MIT) |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +This project implements a recursive backtracking algorithm to solve the famous Eight Queens Puzzle. The challenge is to place eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal. |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +## Features |
| 15 | + |
| 16 | +- Pure recursive implementation without loops (created as a programming challenge) |
| 17 | +- Visualization of the solution on the console using a text-based chessboard |
| 18 | +- Option to find all possible solutions by uncommenting a section of the code |
| 19 | +- Clear documentation and explanations in comments |
| 20 | + |
| 21 | +## Example Output |
| 22 | + |
| 23 | +When you run the program, it will display a solution like this: |
| 24 | + |
| 25 | +``` |
| 26 | +Q . . . . . . . |
| 27 | +. . . . Q . . . |
| 28 | +. . . . . . . Q |
| 29 | +. . . . . Q . . |
| 30 | +. . Q . . . . . |
| 31 | +. . . . . . Q . |
| 32 | +. Q . . . . . . |
| 33 | +. . . Q . . . . |
| 34 | +``` |
| 35 | + |
| 36 | +## How to Use |
| 37 | + |
| 38 | +1. Clone this repository |
| 39 | +2. Compile the Java file: `javac EightQueensRECU.java` |
| 40 | +3. Run the program: `java EightQueensRECU` |
| 41 | + |
| 42 | +By default, the program will find and display one solution. If you want to find more solutions, uncomment the indicated section in the `main` method. |
| 43 | + |
| 44 | +## How It Works |
| 45 | + |
| 46 | +1. Initialize the chessboard |
| 47 | +2. Use recursive backtracking to place queens one by one |
| 48 | +3. Check if a queen can be placed safely in each position |
| 49 | +4. If a solution is found, print the chessboard |
| 50 | + |
| 51 | +## Note |
| 52 | + |
| 53 | +This implementation prioritizes recursive elegance over performance. It was created as a programming challenge to solve the Eight Queens Puzzle using maximum recursion. |
| 54 | + |
| 55 | +## License |
| 56 | + |
| 57 | +This project is licensed under the MIT License - see the LICENSE file for details. |
| 58 | + |
| 59 | +## Contributing |
| 60 | + |
| 61 | +If you found a problem in the code, please create an issue on GitHub. Contributions are welcome! |
| 62 | + |
| 63 | +## Keywords |
| 64 | + |
| 65 | +Eight Queens Puzzle, Recursive Algorithm, Backtracking, Java, Chess Programming, Algorithm Visualization |
0 commit comments