Jump to a problem, path or page
Jump to a problem, path or page
01 · Develop the design
Use an explicit placement/play/finished state machine, validated fleet geometry and unique shot records. A scoped view layer exposes public results without returning the opponent’s hidden board.
Stage 1
Declare the variant rules
Choose board dimensions, required ship lengths and whether ships may touch. This exercise allows touching but rejects overlap and diagonal/bent placement.
Stage 2
Validate before committing a shot
Check PLAYING phase, current player, bounds and prior shots first. Only a valid shot updates hit state and advances the turn.
Stage 3
Separate internal and player state
The engine knows both fleets. A ViewPolicy returns a filtered immutable snapshot for one player or spectator.
02 · Work through the method
03 · Justify the choices
What should an opponent view reveal?
Only information allowed by the view policy, such as observed shots/results
Domain snapshots must enforce hidden-information boundaries rather than rely on UI concealment.
What does a repeated shot do?
Return an invalid-move result without mutating state
Shot identity and validation prevent duplicated hits or accidental turn changes.
When may play begin?
After both complete fleets pass placement rules
The game phase transition must enforce fleet completeness independently of the UI.
04 · Plan the evidence