Skip to content

[US-04] Playing alone against the computer

Ivan Esau requested to merge feature/issue-4-us-04-playing-alone-against-th into master

Description

Implements single-player mode for Battleship game against computer opponent with two difficulty levels.

Changes

  • New CLI Interface: Complete command-line interface for single-player gameplay
  • Computer Opponent: ComputerOpponent service with Easy (random) and Normal (hunting) difficulty levels
  • Game Logic: GameService for managing turn-based gameplay
  • Model Classes: Coordinate, Ship, Board, Player for game state management
  • Automatic Ship Placement: Computer automatically places valid ships
  • Smart Targeting: Normal difficulty hunts around hits until ships are sunk

Features Implemented

  • Single-player mode against computer
  • Computer ship placement (valid, no overlaps, within bounds)
  • Computer shooting (never targets same coordinate twice)
  • Two difficulty levels: Easy (random) and Normal (hunting)
  • Normal mode strategy: shoots near previous hits until ship sunk
  • Complete game flow from ship placement to victory

Acceptance Criteria Verified

  • When single-player mode starts, the computer's fleet exists, is valid and hidden
  • When the computer makes a move, its shot is at a coordinate not previously targeted
  • In Normal mode, if a shot hits, following shots try neighboring cells until that ship is sunk

Technical Details

  • Follows ORCH_PLAN.json architecture (model/service packages)
  • Uses layered architecture pattern
  • All dependencies from issues 1-3 are satisfied
  • No breaking changes to existing functionality

Closes #4

Merge request reports

Loading