Parent Epic
#22
Description
Implement the TryHit WebSocket handler that allows players to attempt hitting cells on opponent boards.
Requirements
- Handler receives: targetSessionID, x, y coordinates
- Validate it's the player's turn
- Validate target is a valid opponent
- Validate coordinates are within bounds (0-9)
- Validate cell hasn't been hit before
- Detect hit or miss based on opponent's ship positions
- Update opponent's board state (HIT or MISS)
- Broadcast result to all players in room
Events
- Inbound:
TRY_HIT (already defined)
- Outbound:
HIT_ATTEMPTED / BOARD_UPDATED
Files to Modify
internal/api/handlers/ - New handler
internal/api/events/ - Payload types if needed
internal/game/ - Hit detection logic
Unit Tests
Acceptance Criteria
Parent Epic
#22
Description
Implement the
TryHitWebSocket handler that allows players to attempt hitting cells on opponent boards.Requirements
Events
TRY_HIT(already defined)HIT_ATTEMPTED/BOARD_UPDATEDFiles to Modify
internal/api/handlers/- New handlerinternal/api/events/- Payload types if neededinternal/game/- Hit detection logicUnit Tests
Acceptance Criteria