[US-05] Saving and restoring the game
Description
Implements game save and load functionality for the Battleship game.
Changes
- Added
GameServicewith save/load methods using Java serialization - Implemented
GameStateclass to store complete game state - Added comprehensive test coverage for save/load scenarios
- Handles file not found, corrupted files, and incompatible formats
- Preserves all game state including boards, ships, shots, current player, difficulty, and running time
Features
- Save Game: Serializes complete game state to file
- Load Game: Restores game state from file with validation
- Error Handling: Graceful handling of missing/corrupted files
- State Preservation: All visible and hidden parts remain consistent after loading
- File Selection: Player can choose file location and name
Acceptance Criteria Verified
Technical Details
- Uses Java Object Serialization for persistence
- Validates loaded game state integrity
- Maintains hidden ship positions after loading
- Preserves game timing and difficulty settings
Closes #5