This program implements a pure Brute Force algorithm to solve the LinkedIn Queens puzzle. The program reads a .txt file containing the initial board configuration with colored cells, validates whether the board is a valid square matrix (N x N), and then systematically generates and evaluates all possible queen placements without using any heuristics or optimization techniques. A solution is considered valid if no two queens are placed in the same column, no two queens share the same color, and no two queens are adjacent to each other, including diagonally adjacent cells.
During execution, the program can optionally display a live visualization of the brute force search process. After the search completes, it displays the final solution board, the total number of configurations examined, and the execution time in milliseconds (measured only for the brute force search process). The user is also given the option to save the resulting solution to an output file.
- Python 3.x
- Uses only built-in libraries:
time,os,sys - A
test/folder must exist for storing input files (or you can change it on the code)
Run the program from the terminal:
python queens-solver.pyor
python3 queens-solver.pySteps:
- Enter the name of the
.txtinput file. - Choose whether to enable live visualization (optional).
- The program will display the solution, execution time (ms), and number of iterations examined.
- Choose whether to save the solution to a file.
13524081/Alya Nur Rahmah