Problem 56573. IQpuzzler Challenge #2: Find all possible solutions on an empty 4-by-5 board with 5 pieces, rotating and flipping pieces allowed
We are playing a simplified version of IQpuzzler, with a smaller board of 4-by-5 spaces and just 5 pieces, as shown in the picture:
You are provided a cell array with one cell per piece. Each cell contains an N-by-M matrix with zeros and one unique value (the piece number) representing the positions of the 3 to 5 elements that define each piece. In our case, the pieces are provided as
Please note that the orientation of each piece in your solutions might be different from the one provided as input. For example, the red piece (number 4) was flipped from left to right before being placed on the board. The pieces can be rotated in steps of 90 degrees, flipped vertically or horizontally.
Your solution set needs to be provided as a 3-D array with 4 rows, 5 columns and N layers, where N is the number of possible arrangements of the given pieces. The order of your solution set along the 3rd dimension does not matter, as long as it provides all valid solutions without repetitions and without symmetric solutions (180° rotations or flippings of other solutions).
For example, the solution above would be represented as
Please provide your entire search algorithm, not just hard coded solutions.
Hint: Maybe you can reuse some functions from the preparation phase. You can find a C++ implementation for the entire puzzle on https://github.com/deverw/IQpuzzler
Solution CommentsShow comments
Problem Recent Solvers3