-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Overview
Implement performance analytics and player comparison functionality for RoundPlayer
. This issue covers performance summary generation and player ranking comparison logic.
Requirements
Functions to Implement
get_performance()
- Generate Performance Summary
fn get_performance(self: @RoundPlayer, total_cards: u64) -> RoundPlayerPerformance
- Create comprehensive performance summary for display
- Aggregate multiple performance metrics
- Calculate derived statistics
- Note:
is_leading
field set externally by comparison logic - Used for leaderboards and player dashboards
outperforms()
- Compare Player Performance
fn outperforms(self: @RoundPlayer, other: @RoundPlayer) -> bool
- Compare this player's performance against another player
- Multi-tier ranking system for fair comparison
- Determine who is performing better overall
- Used for leaderboard sorting and ranking
Business Logic
Performance Summary Components
- Accuracy Percentage: Player's correct answer rate (0-100)
- Wrong Answers: Total number of incorrect responses
- Completion Percentage: Progress through total cards (0-100)
- Cards Remaining: Number of cards left to answer
- Is Leading: External flag for leaderboard position (set by caller)
Player Comparison Hierarchy
- Primary: Total Score (higher wins)
- Secondary: Accuracy Percentage (higher wins)
- Tertiary: Best Time (lower wins, 0 = no best time)
- Quaternary: Average Time (lower wins)
Comparison Logic Rules
- Higher total score always wins
- If scores equal, higher accuracy wins
- If accuracy equal, faster best time wins
- If best times equal, faster average time wins
- Players with no best time (0) lose to those with times
- All factors considered for comprehensive ranking
Acceptance Criteria
- Performance summary generation working correctly
- All performance metrics included and accurate
- Player comparison logic implemented properly
- Multi-tier ranking system functioning correctly
- Score-based primary comparison working
- Accuracy-based secondary comparison working
- Time-based tertiary and quaternary comparisons working
- Edge cases handled properly (zero values, ties)
- Complete test coverage including complex scenarios
Dependencies
- Depends on performance metric functions from Issue Feat: Performance Metrics Implementation #138
Note
Target Branch
refac/modular-architecture
File Location
src/models/round/round_player.cairo
Target Trait
RoundPlayerTrait
Metadata
Metadata
Assignees
Labels
No labels