Commit Graph
15 Commits
Author SHA1 Message Date
pastilhas a6c4c5302f feat: implement Phase 20 - puzzle generation and rendering
Port sudoku generation algorithm and integrate with game flow:

Core Changes:
- src/useBoard/SudokuGenerator.ts: Ported from src_old/lib/Sudoku.ts
  - Full puzzle generation algorithm (robatron/sudoku.js)
  - Supports all difficulty levels (easy through inhuman)
  - Returns 81-character string representation

- src/useBoard/useBoard.ts: Enhanced with puzzle state
  - Added boardRef and initialBoardRef for state management
  - Added generateBoard(difficulty) method
  - Updated renderBoard() to display givens from board string
  - Cells show digits for givens, empty for '.' characters

- src/useGame.ts: Integrated game flow
  - Reads difficulty from GameOptions (defaults to 'easy')
  - Generates puzzle on startGame (gameStatus → 'started')
  - Re-renders board on status changes
  - quitGame returns to empty grid

Game Flow:
- Waiting: Empty 9x9 grid
- Press Space → startGame() → puzzle generated (~62 givens on easy)
- Press Q → quitGame() → empty grid

Testing platformHook integration:
- startGame trigger working via useKeyBindings
- quitGame trigger working via useKeyBindings
- Board state properly cleared/populated on status changes

Phase 20 complete. Next: Phase 30 (useGameStatus hook).
2025-10-22 18:24:08 +01:00
pastilhas b7d740386e feat: implement Phase 10 - minimal skeleton with empty grid
Create clean src/ structure with minimal viable implementation:

Core Files:
- src/types.ts: Basic type definitions (Difficulty, GameStatus, GameManager)
- src/index.ts: Main package exports
- src/game.css: Copied from src_old for styling
- src/useGame.ts: Orchestrator with mocked GameManager API
- src/useBoard/useBoard.ts: Renders empty 9x9 sudoku grid

Implementation Details:
- useBoard renders 81 cells with sudoku-grid/sudoku-cell classes
- Each cell has data-r and data-c attributes for identification
- useGame provides full GameManager interface to satisfy example app
- Real implementations: gameStatus, keyLog tracking, game controls
- Mocked implementations: cursor ({}), scoreManager (zeros/null)
- Supports optional platformHook parameter

Build Status:
- TypeScript compiles cleanly with no errors
- Example app builds successfully
- Ready for browser testing with empty grid display

Phase 10 complete. Next: Phase 20 (full useBoard with puzzle generation).
2025-10-22 18:18:06 +01:00
pastilhas 9292b83dd0 feat: prepare vim-sudoku for unified API implementation
- Archive previous implementation attempt (src -> src_failed)
- Create comprehensive IMPLEMENTATION_PLAN.md with phased approach
- Create IMPLEMENTATION.md to track implementation progress
- Update example app to match vim-maze patterns:
  - Simplify UI to desktop-only (no mobile support)
  - Add score metrics display (time, keystrokes, final score)
  - Update instructions for sudoku-specific keys (hjkl, i for edit)
  - Remove unnecessary mobile hooks

Phase 5 complete. Ready to begin Phase 10 (Setup & Core Types).
2025-10-22 18:08:33 +01:00
pastilhas d0a51d7079 starting new structure 2025-10-19 17:59:12 +01:00
pastilhas 4c6bd0d4d4 ready for publish 2025-10-15 23:10:12 +01:00
pastilhas 7e305e027f 0.10.0 2025-10-15 23:06:29 +01:00
pastilhas f4b781b2de ready for publish 2025-10-15 23:06:24 +01:00
pastilhas 2e51b11a59 ready for publish 2025-10-15 23:06:01 +01:00
pastilhas 73ce666f53 GameOverlays 2025-10-15 21:21:45 +01:00
pastilhas 800d9d083f working on useScore 2025-10-15 19:02:22 +01:00
pastilhas 2dd317e0dc working on useScore 2025-10-15 18:28:55 +01:00
pastilhas 5f3e3706fa working on useScore 2025-10-15 18:03:18 +01:00
pastilhas 5b9b44aef6 working on useGame 2025-10-15 17:56:41 +01:00
pastilhas da8ca2c289 working on useGame 2025-10-15 17:47:41 +01:00
pastilhas 8acc16fc1c working on useGame 2025-10-15 17:29:53 +01:00