Files
soroban-abacus-flashcards/ARITHMETIC_CHALLENGES_PLAN.md
Thomas Hallock bda5bc6c0e fix: prevent database imports from being bundled into client code
**Problem:**
- player-ownership.ts imported drizzle-orm and @/db at top level
- When RoomMemoryPairsProvider imported client-safe utilities, Webpack bundled ALL imports including database code
- This caused hydration error: "The 'original' argument must be of type Function"
- Node.js util.promisify was being called in browser context

**Solution:**
1. Created player-ownership.client.ts with ONLY client-safe utilities
   - No database imports
   - Safe to import from 'use client' components
   - Contains: buildPlayerOwnershipFromRoomData(), buildPlayerMetadata(), helper functions

2. Updated player-ownership.ts to re-export client utilities and add server-only functions
   - Re-exports everything from .client.ts
   - Adds buildPlayerOwnershipMap() (async, database-backed)
   - Safe to import from server components/API routes

3. Updated RoomMemoryPairsProvider to import from .client.ts

**Result:**
- No more hydration errors on /arcade/room
- Client bundle doesn't include database code
- Server code can still use both client and server utilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 11:40:46 -05:00

3.0 KiB

Soroban Arithmetic Challenges - Development Plan

🎯 Goal: Lightning-Fast Complement Recall Training

Focus Challenges:

  1. Speed Complement Race - Flash numbers, kids type complements as fast as possible
  2. Complement Twins - Memory matching game for complement pairs (leverage existing matching infrastructure)

🏁 Task List

Phase 1: Speed Complement Race Foundation

  • Design Speed Complement Race challenge structure
    • Progressive levels: Friends of 5 → Friends of 10 → Mixed → Advanced
    • Scoring system: Speed bonus + accuracy + streak multipliers
    • Flash card style interface with large, clear numbers
  • Implement Speed Complement Race with progressive difficulty
    • Adaptive timing (starts slow, gets faster as kid improves)
    • Multiple game modes: Practice, Timed Sprint, Survival
    • Real-time abacus visualization of complements

Phase 2: Complement Twins Integration

  • Create Complement Twins mode for existing matching game
    • Leverage current matching game infrastructure
    • New card types: complement pairs (1♥4, 2♥8, 3♥7, etc.)
    • Special celebration for completing full complement sets

Phase 3: Polish & Engagement

  • Add generated audio cues using Web Audio API

    • Synthesized tones: High pitch for correct, low for wrong
    • Different note sequences for friends of 5 vs 10
    • Celebratory chord progressions for streaks
  • Implement visual particle effects with pure CSS/JS

    • Burst animations for correct answers
    • Smooth number transitions and highlights
    • Progress bars with satisfying fill animations

Phase 4: Learning Optimization

  • Create adaptive difficulty system for lightning recall

    • Track response times and accuracy per complement pair
    • Focus practice on weak spots (e.g., if 7+3 is slow)
    • Gradually increase speed requirements
  • Add achievement/progression system

    • "Lightning Fingers" badges for speed milestones
    • Complement mastery certificates
    • Daily streak tracking

Phase 5: Refinement

  • Test and refine complement recall training
    • Measure learning effectiveness
    • Adjust timing curves for optimal challenge
    • Add hints/training wheels for struggling learners

🎯 Success Metrics

  • Speed: Sub-2-second complement recall
  • Accuracy: 95%+ on practiced complements
  • Retention: Maintain speed after breaks
  • Engagement: Kids want to beat their personal bests

🎮 Implementation Constraints

  • Static page + JavaScript only
  • Generate sounds/effects programmatically (Web Audio API + CSS)
  • No external assets or fetching
  • Leverage existing game infrastructure where possible

💡 Key Design Principles

  • Aggressive guidance towards lightning recall of friends
  • Fun for any kid regardless of current skill level
  • Adaptive difficulty that grows with the learner
  • Immediate feedback with satisfying audio/visual cues

Generated for continuation across sessions - refer to this plan when restarting development