A Heuristic for the 8-Puzzle Problem

The heuristic for each state is shown in red.