[US-04] Single-player mode vs. computer opponent
Implementation Summary
This merge request implements single-player mode with computer opponent functionality for the Battleship game.
Features Implemented
- Computer Player AI: Computer opponent with Easy and Standard difficulty levels
- Ship Placement: Computer automatically places legal fleet (no overlaps/out-of-bounds)
- Turn Management: Computer selects valid untargeted coordinates and avoids repeats
-
Difficulty Levels:
- Easy: Random shots
- Standard: Hunting strategy - after a hit, preferentially targets adjacent cells
Technical Implementation
- Created
ComputerPlayerclass extendingPlayerwith AI logic - Created
GameServicefor single-player game flow management - Created
GameandGameStateclasses for game state management - Updated existing classes (
Ship,Cell) for game logic integration
Acceptance Criteria Coverage
-
Criterion 1: Computer fleet exists and is legal but hidden -
Criterion 2: Computer shots are at previously untargeted coordinates -
Criterion 3: Standard difficulty hunting strategy targets adjacent cells after hits
Current Status
Pipeline Status: FAILED (#8751) Compilation: SUCCESS Tests: 79 tests run, 11 failures, 15 errors
Critical Issues Identified
- ComputerPlayer.placeShipsAutomatically() - Fails to place ships successfully
- Game.startGame() - Doesn't transition game state from SETUP to IN_PROGRESS
- Turn Management - "Not computer player's turn" errors in test execution
Next Steps Required
- Coding Agent needs to fix the identified implementation issues
- ComputerPlayer ship placement must be corrected
- Game state transitions must be fixed
- Turn management logic must be resolved
Closes #4