Start by familiarizing yourself well with the problem and getting a handle on the logic. If you can't explain it with language, you'll have a hard time explaining it to the compiler.
http://www.8puzzle.com/8_puzzle_algorithm.htm[
^]
That should get you started. If you have trouble with a specific piece of code, post a sample of what you're working through and we'll do our best.
Cheers.