By Athian Nugraha Muarajuang (13523106)
This program implements a brute force algorithm to solve the IQ Puzzler Pro game.
The IQ Puzzler Pro Solver finds a solution for placing all puzzle pieces on a board according to the game rules. It supports:
- Default rectangular board configuration
- Custom board configurations
The program uses a backtracking brute force approach to try all possible piece placements, orientations, and reflections until a solution is found or all possibilities are exhausted.
- Java JDK 17 or higher
- Terminal or Command Prompt
First, to clone this repository, do:
git clone https://github.com/Starath/Tucil1_13523106.git
cd Tucil1_13523106
To compile the program, do:
javac -d bin src/*.java
After compilation, do:
java -cp bin Main
- When prompted, enter the test case file name (.txt). Make sure your test case is in the test folder
- The program will solve the puzzle and display the solution if one exists
- You can choose to save the solution to a text file and/or png file when prompted
The input file should follow this format:
N M P
S
puzzle_1_shape
puzzle_2_shape
...
puzzle_P_shape
Where:
- N, M: Board dimensions
- P: Number of puzzle pieces
- S: Case type (DEFAULT/CUSTOM)
- For CUSTOM case, the next N lines contain the board configuration
Example:
...X...
.XXXXX.
XXXXXXX
.XXXXX.
...X...
- Each puzzle piece is represented by its shape using a distinct upper-case character
Example:
AA
A
BB
BB
B
...
And so on