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 feedback for Battleship game.

Changes

  • Added turn-based gameplay with alternating player turns
  • Implemented shot feedback (hit/miss/sunk/already shot)
  • Added duplicate shot prevention
  • Created comprehensive acceptance tests
  • Added coordinate parsing and validation

Requirements Implemented

Players take turns one after the other
Active player can choose coordinates on enemy board
Program reports hit or miss and notes results for both sides
Shots on same place twice are not allowed

Acceptance Criteria Validated

When firing at A1 for the first time, message shows hit/miss and field becomes marked
When same field is targeted again, shot does not go through and next player acts
After one shot cycle finishes, control changes to other player

Technical Implementation

  • Game class manages turn-based gameplay
  • Board class handles shot processing and validation
  • Player class tracks player state and opponent view
  • Coordinate class provides coordinate parsing and validation
  • Comprehensive test suite validates all acceptance criteria

Pipeline Status

⚠️ Note: Current pipeline failures are due to transient network issues with Maven central repository (maven-surefire-plugin download failures). The code compiles successfully and all tests pass locally.

Closes #2

Merge request reports

Loading