-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Overview
Implement utility helper methods for RoundPlayer
. This issue covers simple access methods and utility functions that support other functionality and provide convenient data access.
Requirements
Functions to Implement
get_player()
- Extract Player Address
fn get_player(self: @RoundPlayer) -> ContractAddress
- Extract player address from composite key
- Simple tuple destructuring operation
- Used for player identification and lookups
- No validation or side effects
get_round_id()
- Extract Round ID
fn get_round_id(self: @RoundPlayer) -> RoundId
- Extract round ID from composite key
- Simple tuple destructuring operation
- Used for round association and lookups
- No validation or side effects
reset()
- Reset Player State
fn reset(self: @RoundPlayer) -> RoundPlayer
- Reset player to initial state for same round
- Preserve player address, round ID, and card timeout
- Clear all progress, scores, and timing data
- Used for testing, admin functions, or round restart
Business Logic
Access Methods
- Read-Only Operations: No side effects or state changes
- Simple Extraction: Direct access to composite key components
- Performance Optimized: Lightweight operations for frequent use
- No Validation: Assume valid player instance
Reset Functionality
- Preserve Identity: Keep player, round ID, and timeout
- Clear Progress: Reset all counters and scores to zero
- Initialize State: Return to fresh player state
- Maintain Structure: Keep same data structure format
Acceptance Criteria
- All 3 utility methods implemented correctly
- Player address extraction working accurately
- Round ID extraction working accurately
- Reset functionality preserving identity correctly
- Reset functionality clearing progress completely
- No side effects in accessor methods
- Complete test coverage for all utility functions
Dependencies
- Depends on
new()
method for reset functionality (Feat: Player Lifecycle Management Implementation #134)
Note
Target Branch
refac/modular-architecture
File Location
src/models/round/round_player.cairo
Target Trait
RoundPlayerTrait
Metadata
Metadata
Assignees
Labels
No labels