Works for preliminary tests. Checkin before cleanup.
Cleaned version. Works for basic simple tests. I don't know what it will do with an unsolvable puzzle, or a really difficult one. Should work, I think.