Skip to content

[US-03] Ship damage, announcing sunk, and finishing

Ivan Esau requested to merge feature/issue-3-us-03-ship-damage-announcing-s into master

Description

Implements ship damage tracking, sunk ship detection, game end conditions, and restart functionality for the Battleship game.

Changes

  • Ship.java: Added comprehensive ship damage tracking with hit recording, sunk detection, and status reporting
  • Game.java: Implemented game state management, winner determination, and game restart functionality
  • AcceptanceCriteriaTest.java: Comprehensive test suite validating all acceptance criteria from issue #3
  • Additional model classes: Enhanced Board, Player, and related classes to support damage tracking

Requirements Implemented

Ship damage tracking: Counts how many parts of each ship are hit Sunk ship detection: Knows when a ship has all parts damaged and announces it as sunk Game end condition: When all ships of one participant are gone, declares the other player as winner Input blocking: Prevents further shooting after game is finished Restart functionality: Allows starting over with "New Game" option

Acceptance Criteria Validated

Criterion 1: When the last healthy square of a ship gets hit, that ship is indicated as sunk Criterion 2: When the final enemy ship is destroyed, the game ends, shows who won, and blocks further shooting Criterion 3: When a finished game is restarted, both boards become empty and hidden again

Technical Details

  • Uses layered architecture with MVC pattern as specified in ORCH_PLAN.json
  • Comprehensive test coverage with JUnit 5
  • Follows Java 21 best practices
  • Maintains separation of concerns between model, view, and game logic

Closes #3

Merge request reports

Loading