Commit Graph
15 Commits
Author SHA1 Message Date
pastilhas b82bef56e5 feat: add maxLevel to GameOptions with default of 25
- New option: maxLevel (defaults to 25)
- Once a player reaches maxLevel, levels no longer progress
- Prevents unlimited level scaling and FPS increases
- Example: useGame({ maxLevel: 10 })
2025-10-31 00:28:29 +00:00
pastilhas 520a640ea0 feat: add foodsPerLevel to GameOptions with default of 10
- New option: foodsPerLevel (defaults to 10)
- Controls how many foods must be eaten to level up
- Example: useGame({ foodsPerLevel: 5 })
2025-10-31 00:21:20 +00:00
pastilhas 5cbb2ee94c refactor: make all GameOptions optional with sensible defaults
- cols defaults to 30 (was required)
- rows defaults to 20 (was required)
- timeLimit and startingLevel remain optional
- Can now call useGame() with no arguments
- Example: useGame(), useGame({}), useGame({ startingLevel: 5 })
2025-10-31 00:19:43 +00:00
pastilhas ad82eaff7c refactor: enforce new GameOptions signature for useGame
- Remove old signature support (cols, rows, platformHook)
- useGame now requires GameOptions object only
- Update example app to use new signature
- Signature: useGame(options, platformHook?)
2025-10-31 00:17:36 +00:00
pastilhas 477bcdd9f3 feat: implement startingLevel option and remove INITIAL_FPS constant
- Remove INITIAL_FPS constant entirely - no longer exists
- Add startingLevel to GameOptions (defaults to 1)
- FPS now equals currentLevel (1:1 ratio)
- Points per food always equals currentLevel
- Game can start at any level with appropriate speed/scoring
2025-10-31 00:14:39 +00:00
pastilhas 52cdbd81d5 feat(phase2.2): implement finalScore calculation
- finalScore equals current game score when gameStatus is 'game-over' or 'game-won'
- finalScore is null during active gameplay ('waiting' and 'started')
- Passed currentScore from gameManager to useScore hook
2025-10-30 23:57:23 +00:00
pastilhas 2a7162abf3 feat(phase2.1): track total keystrokes via keyLog length
- Expose keyLog.length as totalKeystrokes in ScoreManager
- Pass keyLog from useKeyBindings to useScore hook
- All game inputs (hjkl and platform keys) automatically counted
- Keystroke counter resets when keyLog is cleared (game restart)
2025-10-30 23:55:15 +00:00
pastilhas 5c398b556f feat(phase1.2): fix GameManager interface to match Unified API
- Create comprehensive types.ts with all required manager interfaces
- Define GameManager with proper Unified API compliance
- Implement CursorManager interface in useCursor with VIM motions
- Add SnakeCursorManager type with snake-specific extensions
- Update useGame to return proper GameManager interface
- Support both old (cols, rows) and new (options) signatures
- Add quitGame alias for stopGame in useGameStatus
- Wrap renderBoard to match Unified API signature (no parameters)
- Add placeholder for totalKeystrokes and finalScore in ScoreManager
- All TypeScript builds successfully
- Example app builds without errors
2025-10-30 22:22:03 +00:00
pastilhas dcaa93ea08 feat(phase1.1): create hook module structure with proper exports
- Create new hook modules: useBoard, useCursor, useGameStatus
- Move/copy hook implementations to their own directories
- Create index.ts files for clean module exports
- Update all imports to use new module locations
- Rename useSnake -> useCursor for Unified API alignment
- Rename useRenderer -> useBoard for clarity
- Update main src/index.ts to export from all hook modules
- All TypeScript builds successfully
- Example app remains functional
2025-10-30 22:16:13 +00:00
pastilhas 2b3a55df37 before Unified API 2025-10-30 22:14:04 +00:00
pastilhas d02a8e9618 working on levels 2025-10-16 17:18:31 +01:00
pastilhas e4f5be1a56 food! 2025-10-16 16:22:09 +01:00
pastilhas 20ac6b9349 proper keybindings 2025-10-16 13:21:22 +01:00
pastilhas 6a3cfad409 game start/stop, snake rendered on board 2025-10-16 12:56:15 +01:00
pastilhas 892e85ecf5 board consumed in example 2025-10-16 12:25:52 +01:00