Commit Graph
6 Commits
Author SHA1 Message Date
pastilhas b59da4881d refactor(phase1.5): revert testing parameters to production values
- Reset initial snake size from 6 back to 3 segments
- Keep INITIAL_FPS at 5 (good starting speed)
- FOODS_PER_LEVEL = 2 (correct production value)
- Game now starts at normal difficulty
- Clean production-ready state
- Build and example app work correctly
2025-10-30 23:17:16 +00:00
pastilhas c5bd51d96b test: increase initial snake size to 6 for easier testing
- Change initial snake length from 3 to 6 segments
- Makes it easier to test turning mechanics and buffering
- Better visibility of snake movement patterns
- Can be reverted once testing is complete
2025-10-30 22:48:42 +00:00
pastilhas 4b0e386691 fix(phase1.2b): adjust key buffer logic to allow 180° reversals
- Change buffer validation from lastMovedDirection to currentDirection
- This allows 180° reversals across frames (they're safe if you have space)
- Only blocks immediate 180° within same frame (would cause self-collision)
- Removes overly restrictive direction blocking
- Player can now freely turn in any direction between moves
- Should fix the 'impossible to turn' and 'immediate death' issues
2025-10-30 22:41:52 +00:00
pastilhas 762bc86878 feat(phase1.2b): implement Nokia-style key buffering system
- Add nextDirectionRef to buffer player input
- Update changeDirection() to queue input instead of immediate execution
- Add applyBufferedDirection() to safely apply buffered input
- Buffer prevents 180° reversals for safe turns
- Call applyBufferedDirection() after each successful move in game loop
- Remove collision grace period - no longer needed with key buffering
- Remove collisionGracePeriodRef and related logic
- Clean up all console.log statements from useGameStatus
- Game now feels responsive at high speeds
- Allows pre-emptive turning on board edges (Nokia Snake style)
- Build and example app work correctly
2025-10-30 22:39:21 +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