Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Problem code: SSLIDE
- ----------------------
- Given a initial position of a sliding puzzle determine the moves to arrange them back in order.(A number can be swapped only with x)
- Initial position
- 1 2 3
- 4 5 x
- 6 7 8
- Final position
- 1 2 3
- 4 5 6
- 7 8 x
- Input
- Intial position of the puzzle
- 1 2 3
- 4 5 x
- 6 7 8
- is described as 1 2 3 4 5 x 6 7 8
- Output
- If it has no solution print unsolvable.
- If it has a solution print a string describing the sequence of moves that has to be performed on the puzzle to solve it. (l-left,r-right,u-ip,d-down)
- Example
- Input:
- 1 2 3 4 5 x 6 7 8
- Output:
- dllurdrulldrr
- <<Solution development In progress>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement