Files
vim-maze/example
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
..
2025-10-14 13:33:51 +01:00
2025-10-14 13:33:51 +01:00
2025-10-14 13:33:51 +01:00
2025-10-14 13:33:51 +01:00
2025-10-14 13:33:51 +01:00
2025-10-14 13:33:51 +01:00
2025-10-14 13:33:51 +01:00
2025-10-14 13:33:51 +01:00

example

To install dependencies:

bun install

To run:

bun run index.ts

This project was created using bun init in bun v1.2.23. Bun is a fast all-in-one JavaScript runtime.