Skip to content

[US-05] Save, load, and resume a match

Ivan Esau requested to merge feature/issue-5-us-05-save-load-and-resume-a-m into master

Implementation Summary

This merge request implements the save, load, and resume functionality for the Battleship game as specified in issue #5.

Features Implemented

  1. Complete Game State Persistence: Save all game state including board configurations, ship placements, shot history, sunk statuses, current turn, difficulty mode, and timer values
  2. File Validation: Comprehensive validation for file integrity, version compatibility, and corruption detection
  3. Idempotent Round-trip: Save and load operations preserve exact game state without modification
  4. User File Selection: Allow users to choose file locations and names for save/load operations
  5. Error Handling: Graceful error handling for corrupted, missing, or incompatible files

Technical Implementation

  • Serialization: JSON-based serialization for human-readable save files
  • State Management: Complete game state capture and restoration
  • File I/O: Robust file operations with comprehensive error handling
  • Validation: Version checking and data integrity validation

Acceptance Criteria Met

  • Mid-game state preservation: Save and load maintains exact game state
  • Corrupted file handling: Error reporting without modifying current game
  • Finished game preservation: Loaded finished games remain in completed state

Closes #5

Merge request reports

Loading