[US-02] Take turns firing with hit/miss feedback
Implementation Summary
This merge request implements the turn-based firing system for the Battleship game as specified in issue #2.
Core Features Implemented:
Turn Management:
- Alternating turns between players enforced
- Current player tracking with automatic turn switching
- Validation to ensure only current player can act
Shot System:
- Target coordinate selection on opponent's grid
- Hit/miss detection and immediate feedback
- Prevention of firing at same coordinate twice
- Shot result tracking with ship sinking detection
Game Logic:
- Game state management (PLACEMENT, IN_PROGRESS, FINISHED)
- Winner detection when all ships are sunk
- Game over conditions and validation
Technical Implementation:
Model Layer:
-
Gameclass manages turn state and game flow -
Boardclass handles shot tracking and ship placement -
Playerclass represents individual players -
GameServiceorchestrates turn-based gameplay
Service Layer:
-
GameServicevalidates shots and processes results - Comprehensive error handling for invalid actions
- Shot result tracking with hit/miss/ship sunk status
Test Coverage:
- Unit tests for all core functionality
- Acceptance criteria tests for issue requirements
- Integration tests for game flow
Acceptance Criteria Validation:
Current Status:
-
Pipeline Status:
❌ FAILED - Test failures need resolution -
Implementation:
✅ Complete - Core functionality implemented -
Tests:
❌ Failing - Issues with ship placement validation
Note: Pipeline is currently failing due to test issues that need to be resolved before merge.
Closes #2