Commit Graph
25 Commits
Author SHA1 Message Date
pastilhas b671c7452c refactor(phase1.3): remove old duplicate hook files
- Delete src/useGame/useSnake.ts (replaced by src/useCursor/useCursor.ts)
- Delete src/useGame/useRenderer.ts (replaced by src/useBoard/useBoard.ts)
- Delete src/useGame/useGameStatus.ts (replaced by src/useGameStatus/useGameStatus.ts)
- Update useFood.ts to import from useBoard instead of useRenderer
- Fix TypeScript type annotations in useFood.ts
- Cleaner codebase with no duplicate implementations
- Build and example app still work correctly
2025-10-30 22:52:40 +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 a3c9f201be test: increase initial game speed to 12 FPS for easier testing
- Change INITIAL_FPS from 5 to 12 for faster gameplay
- Makes it easier to test key buffering at higher speeds
- Can be reverted once testing is complete
2025-10-30 22:47:49 +00:00
pastilhas c803df242a fix(phase1.2b): apply buffered direction BEFORE movement, not after
- Move applyBufferedDirection() to execute before moveSnake()
- This ensures buffered input is used for the current frame's movement
- Allows multi-frame 180° turns (down then left, for example)
- Snake can turn in any valid direction across frames
- Fixes the 180° reversal restriction issue
2025-10-30 22:46:20 +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 f9cd9c60e7 fix(example): update useKeyBindings to work with new GameManager interface
- Import GameManager type directly from main package
- Use new Unified API methods: renderBoard, quitGame, clearKeyLog
- Remove pause functionality for now (simplified like vim-maze)
- Match vim-maze's key binding pattern
- Game now starts and plays correctly
2025-10-30 22:30:00 +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 444eb5c6f4 docs: add UNIFIED_API v2.0 to vim-snake 2025-10-22 22:31:35 +01:00
pastilhas d2f3403e86 0.4.0 2025-10-16 17:56:09 +01:00
pastilhas 4a416ade41 32px cells 2025-10-16 17:56:01 +01:00
pastilhas c710c7883c 0.3.1 2025-10-16 17:51:02 +01:00
pastilhas 835f68de72 food score 2025-10-16 17:50:53 +01: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 ab78c6a881 0.2.0 2025-10-16 13:49:34 +01:00
pastilhas fede770c61 snake personality... 2025-10-16 13:49:22 +01:00
pastilhas cbb8cce833 snake personality... 2025-10-16 13:39:35 +01:00
pastilhas f37605d8d2 snake moving, changing directions, wall collision working 2025-10-16 13:30:26 +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 39dde6e5e6 prepared for publish 0.1.0 2025-10-16 12:32:35 +01:00
pastilhas 892e85ecf5 board consumed in example 2025-10-16 12:25:52 +01:00