Commit Graph
14 Commits
Author SHA1 Message Date
pastilhas 0749aba648 refactor: separate score calculation from score management
BREAKING CHANGES:
- Remove timeLimit from GameOptions (use gameOver function instead)
- Remove finalScore from ScoreManager (pure data collection only)
- Remove rows/cols parameters from useScore
- Remove finalScore calculation logic from useScore hook

ADDITIONS:
- Create calculateMazeScore() utility function
- ScoreManager now only returns raw metrics: timeValue, keystrokes, optimalSteps, efficiency, distToKey, distToExit
- Score calculation moved to consumer (calculateMazeScore takes scoreManager + mazeSize)
- Example app now uses calculateMazeScore to compute final score on game-won

BENEFITS:
- ScoreManager is now a pure data collector with no side effects
- Scoring algorithm is reusable and testable in isolation
- Game-over conditions fully controlled via gameOver option
- Clear separation of concerns: collection vs calculation
2025-11-02 17:04:21 +00:00
pastilhas 156c6db9d2 feat: display optimalSteps and efficiency metrics on scoreboard
- Show optimal steps required for the maze
- Display player efficiency percentage (100% = perfect play)
- Metrics appear after maze loads (when optimalSteps > 0)
- Separated from final score with visual divider
- Helps players understand their navigation performance
2025-11-02 16:55:46 +00:00
pastilhas 8bbc6aac9b exporting version 2025-11-02 16:40:24 +00:00
pastilhas a69b7bbb5f organized types 2025-10-19 16:11:38 +01:00
pastilhas 252027dab2 no more ReturnType<typeof> 2025-10-19 15:55:52 +01:00
pastilhas a6f066d738 scoreManager implemented flawlessly 2025-10-19 15:29:01 +01:00
pastilhas 7c36f9dc14 refactor: integrate key management into cursor module
- Move useKeyBindings functionality into useCursor as useGameKeys
- Flatten GameManager interface using intersection types
- Rename clearLog/getLog to clearKeyLog/getKeyLog for clarity
- Remove separate useKeyBindings module and exports
- Update all documentation to reflect new architecture
- Maintain backward compatibility for platform hooks
2025-10-19 12:56:35 +01:00
pastilhas 6108640267 useGame=>useCursor=>useHero=>useHeroRender 2025-10-19 03:01:22 +01:00
pastilhas 7e9058b2c9 proper hero death / respawn 2025-10-19 02:43:32 +01:00
pastilhas f302c67778 e to ev 2025-10-19 02:06:59 +01:00
pastilhas e253a6b51d start and quit game working 2025-10-19 02:00:22 +01:00
pastilhas 4db86e1cfe working on unified API and major refactoring 2025-10-19 01:48:20 +01:00
pastilhas 8f62c6c2b5 working on unified API and major refactoring 2025-10-19 01:14:59 +01:00
pastilhas c8eb84ce7e first 2025-10-14 13:33:51 +01:00