Commit Graph
10 Commits
Author SHA1 Message Date
pastilhas cfdf8100fb refactor: simplify scoring to remove efficiency metrics
- Remove efficiency calculation (not applicable to sudoku gameplay)
- Simplify to time + keystrokes only scoring
- New formula: score = min(1000, (1000 - time_penalty - keystroke_penalty) * difficulty_multiplier)
  - time_penalty = seconds / 10
  - keystroke_penalty = totalKeys / 2
  - difficulty multipliers: easy 1.0x, medium 1.5x, hard 2.0x
- Update difficulty levels to realistic values:
  - Easy: 25 cells removed (was 5)
  - Medium: 40 cells removed (was 50)
  - Hard: 50 cells removed (was 60)
- Update scoreboard to show only Time, Keystrokes, and Final Score (X / 1000)
- Remove editKeystrokes, optimalKeystrokes, efficiency from ScoreManager type
2025-10-22 21:03:56 +01:00
pastilhas 8db4455dc5 feat: implement scoring system and win condition (Phase 50)
- Add useTimer hook for elapsed time tracking
- Add useScore hook with comprehensive metrics:
  - Total keystrokes (all keys)
  - Edit keystrokes (only editing keys)
  - Optimal keystrokes (empty cells × 3)
  - Efficiency percentage (optimal/edit × 100)
  - Final score (70% efficiency + 30% time-based)
- Win condition detects board completion only in normal mode
- Track all keystrokes with timestamps in useGame
- Update example app with full scoreboard display
- Expose boardRef in BoardManager for state checking
- Adjust easy mode to 5 removed cells for testing
2025-10-22 20:42:50 +01:00
pastilhas 6f4a1accc4 feat: add difficulty selector to example app
Add interactive difficulty selection when game is idle:

Example App Changes:
- example/src/App.tsx: Add difficulty state and radio group
  - Import useState and Difficulty type
  - Radio buttons for Easy/Medium/Hard
  - Only visible when gameStatus === 'waiting'
  - Updates difficulty state on selection
  - Passes selected difficulty to useGame

Core Changes:
- src/useGame.ts: Respect difficulty changes
  - Add difficulty to useEffect dependencies
  - Regenerates board when difficulty changes

UX Flow:
1. User sees difficulty selector on idle screen
2. Selects difficulty (easy/medium/hard)
3. Presses Space to start
4. Puzzle generated with selected difficulty
5. On quit, returns to selector with last selection

Cell Counts:
- Easy: 40 empty cells (~41 givens)
- Medium: 50 empty cells (~31 givens)
- Hard: 60 empty cells (~21 givens)
2025-10-22 18:42:35 +01:00
pastilhas 9292b83dd0 feat: prepare vim-sudoku for unified API implementation
- Archive previous implementation attempt (src -> src_failed)
- Create comprehensive IMPLEMENTATION_PLAN.md with phased approach
- Create IMPLEMENTATION.md to track implementation progress
- Update example app to match vim-maze patterns:
  - Simplify UI to desktop-only (no mobile support)
  - Add score metrics display (time, keystrokes, final score)
  - Update instructions for sudoku-specific keys (hjkl, i for edit)
  - Remove unnecessary mobile hooks

Phase 5 complete. Ready to begin Phase 10 (Setup & Core Types).
2025-10-22 18:08:33 +01:00
pastilhas d0a51d7079 starting new structure 2025-10-19 17:59:12 +01:00
pastilhas 2e51b11a59 ready for publish 2025-10-15 23:06:01 +01:00
pastilhas 73ce666f53 GameOverlays 2025-10-15 21:21:45 +01:00
pastilhas 800d9d083f working on useScore 2025-10-15 19:02:22 +01:00
pastilhas 2dd317e0dc working on useScore 2025-10-15 18:28:55 +01:00
pastilhas 8acc16fc1c working on useGame 2025-10-15 17:29:53 +01:00