Description
15-Tile Puzzle - Part 2
The 15-Tile Puzzle is a game where a player moves tiles on a 4 x 4 board to try to arrange them into a predetermined order. You are to do a simulation of this game in lab 7-8.
+---+---+---+---+ | 1 | 2 | 3 | 4 | +---+---+---+---+ | 5 | 6 | 7 | 8 | +---+---+---+---+ | 9 |10 |11 |12 | +---+---+---+---+ |13 |14 |15 | | +---+---+---+---+
In lab 7, you have implemented the main game that supports the following commands:
'R': Moves a tile to the right
'L': Moves a tile to the left
'U': Moves a tile up
'D': Moves a tile down
'Q': Quit the program
'S': Save the current board
'O': Load the saved board
The save function will save the current board information into a text file. The file can be of any name in any location of your choice. You also need to decide the saved format (e.g., one number per line).
The load function will load the saved board information, which allows a user to continue to play the game from the saved one.
You also need to handle FileNotFoundException when saving and loading the game.
Grading
How to turn in the assignment
Let me know if you encounter any problems in this lab.