I'm attempting to create a program that will find the steps to solve a puzzle with the following rules:
- Given any set of colors in a 4x4 grid, attempt to match to an ending pattern with the same number of colors.
- Colors are not swapped, but rotated either horizontally or vertically, such that
{W, W, B, W}
can be rotated to
{W, W, W, B}
{B, W, W, W}
{W, B, W, W}
- The entire puzzle can be solved in less than 16 steps.
I've already figured out how to store the data of the puzzle itself, but I'm struggling on how to proceed about finding a solution that can display steps. Since the depth is limited to 16 steps, I'm ok with trying to brute force this, but don't really have an idea of how to establish a pattern.
This is similar to solving a Rubik's cube, and I've already looked at the following resources:
stackoverflow.com/questions/34656587/solving-rubiks-cubes-for-dummies/34656726#34656726
stackoverflow.com/questions/5563671/solving-rubiks-cube-programmatically
amzi.com/articles/rubik.htm
chessandpoker.com/rubiks-cube-solution.html
and the 15 numbers problem
- stackoverflow.com/questions/3621623/how-to-programatically-solve-the-15-moving-numbers-puzzle
To make this question as clear as possible: What is a good way to a) store/print the steps, and b) find the solution that takes the least steps?