Skip to content

feat: Implement US-01 - Ship placement functionality

Ivan Esau requested to merge feature/issue-1-us-01-setting-ships-somewhere- into master

Implementation of US-01: Setting ships somewhere on the board

Requirements Implemented:

  • 10x10 game board for each player
  • Standard ship types: Carrier (5), Battleship (4), Cruiser (3), Submarine (3), Destroyer (2)
  • Ship placement validation (straight placement only, no diagonals)
  • Overlap prevention between ships
  • Board boundary validation
  • Hidden ship positions from opponent

Core Components:

  • Board: Manages 10x10 grid with ship placement and validation
  • Ship: Represents individual ships with type, position, and orientation
  • Player: Manages player's board and ship placement
  • Coordinate: Handles grid coordinates with validation
  • Cell: Represents individual board cells with ship and hit status

Validation & Error Handling:

  • Ships placed outside board boundaries are rejected
  • Overlapping ship placements are rejected
  • All ships must be placed before game can proceed
  • Ship positions remain hidden from opponent

Acceptance Criteria Verified:

  • Ship outside board → Placement fails with error
  • Overlapping ships → Second placement fails (no overwrite)
  • All ships placed validly → Board ready for gameplay

Testing:

  • Comprehensive unit tests for all validation scenarios
  • Acceptance criteria tests explicitly implemented
  • Test coverage for edge cases and boundary conditions

Closes #1

Merge request reports

Loading