Skip to content

feat(minigame): Phase 2.2 - Adaptive Difficulty and Scoring Enhancements#116

Merged
bug-ops merged 6 commits intomainfrom
feature/phase-2.2-adaptive-difficulty
Jan 9, 2026
Merged

feat(minigame): Phase 2.2 - Adaptive Difficulty and Scoring Enhancements#116
bug-ops merged 6 commits intomainfrom
feature/phase-2.2-adaptive-difficulty

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Jan 9, 2026

Summary

Phase 2.2 enhances Arcade Mode with smarter difficulty adaptation, improved scoring mechanics, and better multiplier feedback.

Sub-Phase 2.2.1: Enhanced Adaptive Difficulty

  • Added PerformancePoint struct for weighted performance tracking
  • Performance score weights: success (60%), speed (25%), efficiency (15%)
  • Difficulty adjustments based on recent trend, not just success rate
  • LevelChange enum for UI notifications

Sub-Phase 2.2.2: Enhanced Scoring System

  • Added ScoreCalculator with combo tracking
  • ScoreBreakdown for detailed score display
  • Combo bonus: 10% per level, max 50%
  • Difficulty multipliers: Beginner 1.0x, Intermediate 1.25x, Advanced 1.5x
  • Time bonus up to 50%, efficiency bonus 25% for optimal

Sub-Phase 2.2.3: Multiplier Improvements

  • Added MultiplierState with grace period system
  • Grace granted at streak milestones (10, 25, 50)
  • Grace prevents multiplier reset on single failure
  • MultiplierChange enum for UI animations

Sub-Phase 2.2.4: UI Feedback

  • All accessor methods for UI display
  • take_level_change(), take_multiplier_change() for event consumption
  • level_progress(), streak_for_next_tier() for progress display

Test plan

  • All 1224 tests passing
  • Clippy clean (zero warnings)
  • Performance review passed
  • Security review passed
  • Code review passed

Changes

File Changes
src/minigame/difficulty.rs PerformancePoint, weighted scoring, LevelChange
src/minigame/scoring.rs NEW - ScoreCalculator, ScoreBreakdown, PerformanceTier
src/minigame/stats.rs MultiplierState, MultiplierChange, grace mechanics
src/minigame/session.rs Integration of all new systems
src/constants/difficulty.rs Performance scoring constants
src/constants/gameplay.rs Scoring bonus constants

- Add PerformancePoint struct with weighted scoring (success 60%, speed 25%, efficiency 15%)
- Add LevelChange enum for UI feedback events
- Replace simple bool tracking with detailed performance history
- Add recency weighting (recent results have higher impact)
- Add difficulty weighting (harder scenarios count more)
- Extract constants to src/constants/difficulty.rs
- Add #[must_use] attributes to key methods
- Add comprehensive tests for all new functionality

All 1176 tests passing.
- Add ScoreCalculator with combo tracking and performance tiers
- Add ScoreBreakdown for detailed score display in UI
- Integrate scoring into MiniGameSession
- Add constants: combo bonus (10%/level, max 50%), difficulty multipliers
- Time bonus up to 50%, efficiency bonus 25% for optimal
- Add MultiplierState struct with grace period system
- Add MultiplierChange enum for UI events
- Grant grace at streak milestones (10, 25, 50)
- Grace prevents multiplier reset on single failure
- Integrate with MiniGameSession
@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 95.71068% with 51 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/minigame/session.rs 69.62% 24 Missing ⚠️
src/minigame/difficulty.rs 97.16% 12 Missing ⚠️
src/ui/render/minigame.rs 80.43% 9 Missing ⚠️
src/minigame/scoring.rs 99.07% 3 Missing ⚠️
src/minigame/stats.rs 98.78% 3 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #116      +/-   ##
==========================================
+ Coverage   86.07%   86.56%   +0.48%     
==========================================
  Files          91       92       +1     
  Lines       19471    20586    +1115     
==========================================
+ Hits        16760    17820    +1060     
- Misses       2711     2766      +55     
Flag Coverage Δ
unittests 86.56% <95.71%> (+0.48%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/gamification/profile.rs 97.07% <100.00%> (+0.14%) ⬆️
src/ui/render/statistics.rs 96.87% <100.00%> (+0.57%) ⬆️
src/ui/state/handlers/minigame.rs 93.23% <100.00%> (+0.36%) ⬆️
src/minigame/scoring.rs 99.07% <99.07%> (ø)
src/minigame/stats.rs 99.31% <98.78%> (-0.69%) ⬇️
src/ui/render/minigame.rs 61.07% <80.43%> (+1.01%) ⬆️
src/minigame/difficulty.rs 95.65% <97.16%> (-0.18%) ⬇️
src/minigame/session.rs 76.29% <69.62%> (-2.09%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add enhanced stats display to arcade mode UI:
- Show combo count with highlight when >= 5
- Display grace indicator [G] when multiplier protection active
- Show difficulty level with tier name (Beginner/Intermediate/Advanced)
- Add best combo to game over screen

Improvements:
- Use difficulty constants from constants/difficulty.rs
- Extract COMBO_HIGHLIGHT_THRESHOLD constant for maintainability
- Use ASCII [G] instead of emoji for terminal compatibility
Add minigame_games_played field to UserProfile to track total arcade
games played. Display arcade mode statistics in the Statistics screen:
- High Score
- Best Streak
- Games Played

Implementation:
- Add minigame_games_played field with serde(default)
- Increment counter in handle_minigame_game_over using saturating_add
- Add render_arcade_statistics section to statistics.rs
- Add unit tests for field initialization and counter increment
@bug-ops bug-ops merged commit d189e19 into main Jan 9, 2026
14 checks passed
@bug-ops bug-ops deleted the feature/phase-2.2-adaptive-difficulty branch January 9, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments