CMPS 144 Spring 2022
Prog. Assg. #4: Slider Puzzle Configuration
Due: 11:59pm, April 1

For this assignment, you are to complete the development of the Java class SliderPuzzleConfig, instances of which represent configurations of a slider puzzle, as discussed in lecture. Common versions of such puzzles are the 15-Puzzle, a particular configuration of which is shown to the right, and the 8-Puzzle. (Note that the shown configuration is one from which it is not possible to arrive at a solution, even though 13 out of the 15 tiles are in the right place.)

Sample Interaction with SliderPuzzlePlay

Welcome to the Slider Puzzle Program.
Enter # of rows in grid: 3
Enter # of columns in grid: 3
Enter # random moves to obtain initial configuration: 10
Enter seed for pseudorandom number generation: 1

 -  2  3 
 1  4  6 
 7  5  8 

Enter U for UP, D for DOWN, L for LEFT, R for RIGHT, Q for Quit
> U
Error: U is not a valid move

 -  2  3 
 1  4  6 
 7  5  8 

Enter U for UP, D for DOWN, L for LEFT, R for RIGHT, Q for Quit
> D

 1  2  3 
 -  4  6 
 7  5  8 

Enter U for UP, D for DOWN, L for LEFT, R for RIGHT, Q for Quit
> R

 1  2  3 
 4  -  6 
 7  5  8 

Enter U for UP, D for DOWN, L for LEFT, R for RIGHT, Q for Quit
> D

 1  2  3 
 4  5  6 
 7  -  8 

Enter U for UP, D for DOWN, L for LEFT, R for RIGHT, Q for Quit
> R

 1  2  3 
 4  5  6 
 7  8  - 

Enter U for UP, D for DOWN, L for LEFT, R for RIGHT, Q for Quit
> Q


Play ended after 4 moves
Goodbye.