Context
Battleship is one of the most important examples for hidden information in the repository. It should clearly teach phase-based logic and commit-reveal structure, not only basic board handling.
If those ideas are not made explicit in the example architecture, the repository misses an opportunity to demonstrate a high-value Cougr pattern.
Goal
Refactor examples/battleship/ to use explicit commit-reveal and phase-system patterns while preserving the current gameplay model.
Refactor Direction
The example should make these concerns explicit:
- setup phase versus action phase
- hidden board commitment
- reveal validation
- hit or miss resolution
- end-of-game detection
Suggested Components
| Component |
Purpose |
BoardCommitmentComponent |
Stores commitment data for hidden board state |
PhaseComponent |
Tracks setup, attack, reveal, and finished phases |
AttackStateComponent |
Tracks pending or resolved attack information |
PlayerBoardComponent |
Tracks visible board information as appropriate |
Suggested Systems
SetupSystem
CommitValidationSystem
AttackResolutionSystem
RevealSystem
PhaseTransitionSystem
EndConditionSystem
Acceptance Criteria
- game phases are modeled explicitly and enforced clearly
- commit-reveal concerns are separated from general board handling
- the architecture teaches hidden-information patterns effectively
- tests cover the core phase flow and still pass
- documentation and commands use
wasm32v1-none
Validation Commands
cd examples/battleship
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test
stellar contract build
Context
Battleship is one of the most important examples for hidden information in the repository. It should clearly teach phase-based logic and commit-reveal structure, not only basic board handling.
If those ideas are not made explicit in the example architecture, the repository misses an opportunity to demonstrate a high-value Cougr pattern.
Goal
Refactor
examples/battleship/to use explicit commit-reveal and phase-system patterns while preserving the current gameplay model.Refactor Direction
The example should make these concerns explicit:
Suggested Components
BoardCommitmentComponentPhaseComponentAttackStateComponentPlayerBoardComponentSuggested Systems
SetupSystemCommitValidationSystemAttackResolutionSystemRevealSystemPhaseTransitionSystemEndConditionSystemAcceptance Criteria
wasm32v1-noneValidation Commands