An A* search might work for the automatic solver. The nodes in the graph are board states, and states one move apart are connected by an edge. One heuristic would be the number of moves required to get to a solution if tiles can move over each other.
https://en.m.wikipedia.org/wiki/A*_search_algorithm