This program is a brute-force algorithm to solve a 10x6 puzzle that contains numerous available_pieces. Each piece is a different shape, but is limited to a dimension no bigger than 5x5.
The puzzle is solved once all holes or gaps on the board are filled with available_pieces. A piece cannot go over the boundary of the board, and no two available_pieces can overlap.
All you need to build the program is to run make
and the binary will be placed under the bin
folder.
If you choose to build the program with debugging symbols, run DEBUG=1 make
instead.
The program has four available options:
-h
: Displays the help menu-c
: Continuously runs the algorithm until SIGTERM or SIGINT is received.-w
: Writes solutions to a file. The file name issolutions.txt
and is placed in the current directory.-p
: Prints each step of the algorithm to the console.-t
: Enables multi threading mode.-s
: The starting piece to use. The default isUtah
(0).-n
: The number of threads to use. The default is 1. The executable is located under thebin
folder, titledwooden_puzzle
.
Col1 | Col2 |
---|---|
U | |
U | U |
U | U |
Col1 | Col2 | Col3 |
---|---|---|
P | ||
P | P | P |
P |
Col1 | Col2 | Col3 |
---|---|---|
T | T | T |
T | ||
T |
Col1 | Col2 | Col3 |
---|---|---|
2 | 2 | 2 |
2 | ||
2 |
Col1 | Col2 | Col3 |
---|---|---|
M | M | |
M | M | |
M |
Col1 | Col2 | Col3 | Col4 | Col5 |
---|---|---|---|---|
z | z | |||
z | z | z | z |
Col1 | Col2 | Col3 | Col4 | Col5 |
---|---|---|---|---|
t | t | t | t | t |
t |
Col1 | Col2 | Col3 |
---|---|---|
Z | Z | |
Z | ||
Z | Z |
Col1 | Col2 | Col3 |
---|---|---|
a | ||
a | a | a |
a |
Col1 | Col2 |
---|---|
L | |
L | |
L | |
L | L |
Col1 | Col2 | Col3 |
---|---|---|
B | ||
B | ||
B | ||
B | B | B |
Col1 |
---|
I |
I |
I |
I |
I |
Col1 | Col2 | Col3 |
---|---|---|
u | u | |
u | u | u |
Below is a solution generated by the program.
t | I | I | I | I | I | Z | a | u | u |
---|---|---|---|---|---|---|---|---|---|
t | t | U | U | Z | Z | Z | a | a | u |
t | z | U | U | Z | M | a | a | u | u |
t | z | T | U | P | M | M | B | B | B |
z | z | T | P | P | P | M | M | L | B |
z | T | T | T | P | L | L | L | L | B |