Skip to content

[US-02] Take turns firing with hit/miss feedback

Ivan Esau requested to merge feature/issue-2-us-02-take-turns-firing-with-h into master

Implementation Summary

This merge request implements the turn-based firing mechanics for the Battleship game as specified in Issue #2.

Requirements Implemented

  1. Enforce alternating turns - Game logic ensures players take turns
  2. Target coordinate selection - Players can select coordinates on opponent's grid
  3. Hit/miss feedback - Immediate feedback with ShotResult class
  4. Prevent duplicate firing - Coordinate tracking prevents repeated shots

Key Features Added

  • ShotResult class to encapsulate shot outcomes (HIT, MISS, ALREADY_TARGETED)
  • Turn management in Game class
  • Coordinate validation and tracking
  • Comprehensive test coverage for all acceptance criteria

Acceptance Criteria Verified

  • Given A1 has not been targeted, when the player fires at A1, then the result is shown (hit/miss) and A1 becomes marked as used
  • Given A1 is already targeted, when the player attempts A1 again, then the system blocks the action and preserves turn order rules
  • Given a turn completes, when control passes, then only the next player can act

Pipeline Status

  • Previous successful pipeline: #6603
  • Current pipeline: #6616 (running)

Closes #2

Merge request reports

Loading