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 system with hit/miss feedback for the Battleship game.

Changes

  • Added turn-based shooting mechanics with proper player switching
  • Implemented hit/miss detection and feedback system
  • Added duplicate shot prevention
  • Created comprehensive coordinate validation
  • Added shooting service with extensive test coverage

Features

  • Players take turns shooting at opponent's board
  • Valid coordinate input (A1-J10 format)
  • Hit/miss detection with appropriate messages
  • Duplicate shot prevention with error messages
  • Game state tracking (current player, game over conditions)

Acceptance Criteria Verified

When firing at A1 for the first time, a message appears showing hit or miss, and that field becomes marked When the same field is targeted again, the shot does not go through, and the next player acts After one shot cycle finishes, the control changes so that only the other player can continue

Technical Implementation

  • Game.java: Main game controller with turn management
  • Board.java: Board management with shot tracking
  • ShootingService.java: Coordinate validation and shooting logic
  • Comprehensive test coverage with 20+ test cases

Closes #2

Merge request reports

Loading