Skip to content

[US-02] Alternating shooting with feedback

Ivan Esau requested to merge feature/issue-2-us-02-alternating-shooting-wit into master

Description

Implements alternating shooting functionality with hit/miss feedback for the Battleship game.

Changes

  • Added Game class with turn-based shooting mechanics
  • Added ShotResult class to provide feedback on shot outcomes
  • Implemented validation to prevent shooting at already-targeted coordinates
  • Added comprehensive integration tests covering all acceptance criteria

Acceptance Criteria Verified

When firing at A1 for the first time, a message should appear showing hit or miss, and that field should become marked

  • Test: testAcceptanceCriteria_FirstShotAtA1_MessageAndFieldMarked

When the same field is targeted again, the shot should not go through, and the next player should then act

  • Test: testAcceptanceCriteria_SameFieldTargetedAgain_ShotRejectedAndTurnAdvances

After one shot cycle finishes, the control changes so that only the other player can continue

  • Test: testAcceptanceCriteria_AfterShotCycle_ControlChangesToOtherPlayer

Technical Implementation

  • Turn management handled by Game.fireShot() method
  • Coordinate validation prevents duplicate shots
  • Shot results provide clear hit/miss feedback
  • Game state transitions properly between players

Closes #2

Merge request reports

Loading