Sliding Puzzle (Prolog)