diff --git a/.planning/REQUIREMENTS.md b/.planning/REQUIREMENTS.md index ec04af6..6257c11 100644 --- a/.planning/REQUIREMENTS.md +++ b/.planning/REQUIREMENTS.md @@ -32,10 +32,10 @@ Requirements for initial release (MVP). Each maps to roadmap phases. ### Typing -- [ ] **TYPE-01**: Phase "Üben": Buchstaben erscheinen einzeln (CSS-Animation fallend), 8–12 pro Übung -- [ ] **TYPE-02**: Richtiger Tastendruck löst Buchstaben auf (Sternenstaub-Animation) -- [ ] **TYPE-03**: Falscher Tastendruck: Nichts passiert, richtige Taste blinkt sanft auf Tastatur -- [ ] **TYPE-04**: Adaptives Tempo: Start 3s, nach 2× richtig -200ms (min 1.5s), nach Fehler +500ms (max 4s) +- [x] **TYPE-01**: Phase "Üben": Buchstaben erscheinen einzeln (CSS-Animation fallend), 8–12 pro Übung +- [x] **TYPE-02**: Richtiger Tastendruck löst Buchstaben auf (Sternenstaub-Animation) +- [x] **TYPE-03**: Falscher Tastendruck: Nichts passiert, richtige Taste blinkt sanft auf Tastatur +- [x] **TYPE-04**: Adaptives Tempo: Start 3s, nach 2× richtig -200ms (min 1.5s), nach Fehler +500ms (max 4s) - [ ] **TYPE-05**: Phase "Entdecken": Begleitfigur stellt neuen Buchstaben vor, Taste leuchtet auf - [ ] **TYPE-06**: Phase "Wörter bauen": 3–4 Wörter aus gelernten Buchstaben, Buchstabe für Buchstabe tippen - [ ] **TYPE-07**: Alle 3 Phasen fliessend verbunden: Entdecken → Üben → Wörter → Belohnung @@ -43,8 +43,8 @@ Requirements for initial release (MVP). Each maps to roadmap phases. ### Levels - [x] **LEVL-01**: Stufen 1–6 definiert gemäss Progressionstabelle (F/J bis E/I) -- [ ] **LEVL-02**: Stufe gilt als abgeschlossen nach einmaligem Durchspielen (nicht perfekt) -- [ ] **LEVL-03**: Nächste Stufe sofort freigeschaltet, alle gespielten Stufen wiederholbar +- [x] **LEVL-02**: Stufe gilt als abgeschlossen nach einmaligem Durchspielen (nicht perfekt) +- [x] **LEVL-03**: Nächste Stufe sofort freigeschaltet, alle gespielten Stufen wiederholbar - [ ] **LEVL-04**: Wortlisten pro Stufe (nur mit bereits gelernten Buchstaben, max 5 Buchstaben) - [ ] **LEVL-05**: Review-Mechanik: Jede 3. Einheit mischt Buchstaben der letzten 2–3 Stufen - [ ] **LEVL-06**: Wiederholungs-Schutz: Nach 2× gleicher Stufe Ermutigung + Neugier-Trigger @@ -163,13 +163,13 @@ Which phases cover which requirements. Updated during roadmap creation. | KYBD-03 | Phase 1 | Complete | | KYBD-04 | Phase 1 | Complete | | KYBD-05 | Phase 1 | Complete | -| TYPE-01 | Phase 1 | Pending | -| TYPE-02 | Phase 1 | Pending | -| TYPE-03 | Phase 1 | Pending | -| TYPE-04 | Phase 1 | Pending | +| TYPE-01 | Phase 1 | Complete | +| TYPE-02 | Phase 1 | Complete | +| TYPE-03 | Phase 1 | Complete | +| TYPE-04 | Phase 1 | Complete | | LEVL-01 | Phase 1 | Complete | -| LEVL-02 | Phase 1 | Pending | -| LEVL-03 | Phase 1 | Pending | +| LEVL-02 | Phase 1 | Complete | +| LEVL-03 | Phase 1 | Complete | | FRST-04 | Phase 1 | Pending | | FRST-05 | Phase 1 | Pending | | PLSH-06 | Phase 1 | Complete | diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index 524245e..ba19a1b 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -35,7 +35,7 @@ Plans: - [x] 01-01-PLAN.md — Vite scaffold, project structure, CSS palette, TypeScript interfaces, IndexedDB wrapper - [x] 01-02-PLAN.md — Screen management, welcome screen, companion/layout selection, onboarding persistence - [x] 01-03-PLAN.md — QWERTZ keyboard component with finger colors, level definitions 1-6 -- [ ] 01-04-PLAN.md — Typing exercise engine (TDD), adaptive tempo, lesson screen UI +- [x] 01-04-PLAN.md — Typing exercise engine (TDD), adaptive tempo, lesson screen UI - [ ] 01-05-PLAN.md — Forest overview with level map, full app flow integration, human verification **UI hint**: yes diff --git a/.planning/STATE.md b/.planning/STATE.md index 795ab30..6ace613 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -3,14 +3,14 @@ gsd_state_version: 1.0 milestone: v1.0 milestone_name: milestone status: executing -stopped_at: Completed 01-03-PLAN.md -last_updated: "2026-03-29T09:08:47.424Z" +stopped_at: Completed 01-04-PLAN.md +last_updated: "2026-03-29T09:13:14.395Z" last_activity: 2026-03-29 progress: total_phases: 4 completed_phases: 0 total_plans: 5 - completed_plans: 3 + completed_plans: 4 percent: 0 --- @@ -26,7 +26,7 @@ See: .planning/PROJECT.md (updated 2026-03-29) ## Current Position Phase: 01 (grundger-st-tippmechanik) — EXECUTING -Plan: 4 of 5 +Plan: 5 of 5 Status: Ready to execute Last activity: 2026-03-29 @@ -55,6 +55,7 @@ Progress: [░░░░░░░░░░] 0% | Phase 01 P01 | 4min | 2 tasks | 22 files | | Phase 01 P02 | 2min | 2 tasks | 6 files | | Phase 01 P03 | 3min | 2 tasks | 4 files | +| Phase 01 P04 | 2min | 2 tasks | 6 files | ## Accumulated Context @@ -70,6 +71,7 @@ Recent decisions affecting current work: - [Phase 01]: Screen transitions use CSS opacity+display toggle, no router library - [Phase 01]: Companion cards rendered dynamically from data array, not hardcoded HTML - [Phase 01]: Finger color map duplicated in keyboard.ts for module independence +- [Phase 01]: Exercise state uses direct mutation pattern for game loop simplicity ### Pending Todos @@ -81,6 +83,6 @@ None yet. ## Session Continuity -Last session: 2026-03-29T09:08:47.417Z -Stopped at: Completed 01-03-PLAN.md +Last session: 2026-03-29T09:13:14.388Z +Stopped at: Completed 01-04-PLAN.md Resume file: None diff --git a/.planning/phases/01-grundger-st-tippmechanik/01-04-SUMMARY.md b/.planning/phases/01-grundger-st-tippmechanik/01-04-SUMMARY.md new file mode 100644 index 0000000..9708e10 --- /dev/null +++ b/.planning/phases/01-grundger-st-tippmechanik/01-04-SUMMARY.md @@ -0,0 +1,117 @@ +--- +phase: 01-grundger-st-tippmechanik +plan: 04 +subsystem: game +tags: [typing, tdd, adaptive-tempo, keyboard, vitest] + +requires: + - phase: 01-02 + provides: "QWERTZ keyboard rendering with finger colors and highlight/press animations" + - phase: 01-03 + provides: "Level definitions with key sets and getKeysUpToLevel function" + +provides: + - "Typing exercise engine: generateLetters, createExerciseState, handleKeyPress" + - "Adaptive tempo logic: 3s start, -200ms/+500ms, bounds 1.5-4s" + - "Lesson screen UI with falling letters and keyboard integration" + - "Lesson completion flow: progress update, next level unlock" + +affects: [01-05, phase-02, phase-03] + +tech-stack: + added: [] + patterns: ["TDD RED-GREEN for game logic", "State mutation pattern for exercise state", "Cleanup function pattern for screen lifecycle"] + +key-files: + created: + - src/game/typing.ts + - src/game/typing.test.ts + modified: + - src/ui/screens.ts + - src/app.ts + - index.html + - src/styles/main.css + +key-decisions: + - "Exercise state uses direct mutation pattern (not immutable) for simplicity in game loop" + - "Streak resets to 0 after speed adjustment to prevent rapid acceleration" + +patterns-established: + - "TDD RED-GREEN: write failing tests first, then implement to pass" + - "Screen init returns cleanup function for teardown" + - "onComplete callback pattern for screen-to-app communication" + +requirements-completed: [TYPE-01, TYPE-02, TYPE-03, TYPE-04, LEVL-02, LEVL-03] + +duration: 2min +completed: 2026-03-29 +--- + +# Phase 01 Plan 04: Typing Exercise Engine Summary + +**TDD-tested typing engine with adaptive tempo (3s start, 1.5-4s bounds), lesson screen UI with falling letters and keyboard integration, lesson completion unlocking next level** + +## Performance + +- **Duration:** 2 min +- **Started:** 2026-03-29T09:09:33Z +- **Completed:** 2026-03-29T09:12:30Z +- **Tasks:** 2 +- **Files modified:** 6 + +## Accomplishments +- Typing exercise engine with 18 passing tests covering letter generation, key press handling, adaptive tempo, and completion detection +- Lesson screen renders falling letter with float animation, keyboard highlights target key, correct press dissolves letter +- Lesson completion updates progress in IndexedDB: adds to completedLevels, advances currentLevel, increments sessions + +## Task Commits + +Each task was committed atomically: + +1. **Task 1: Typing exercise logic (RED-GREEN-REFACTOR)** - `5fe66cb` (feat) +2. **Task 2: Lesson screen UI wiring** - `ba4525d` (feat) + +## Files Created/Modified +- `src/game/typing.ts` - Core typing engine: generateLetters, createExerciseState, handleKeyPress, getCurrentLetter, isExerciseComplete +- `src/game/typing.test.ts` - 18 TDD tests covering all exercise behavior +- `src/ui/screens.ts` - Added initLessonScreen with keyboard rendering and keydown handling +- `src/app.ts` - Added startLesson function with progress update on completion +- `index.html` - Lesson screen HTML with letter-area and lesson-keyboard containers +- `src/styles/main.css` - Falling letter styles, float animation, dissolve effect + +## Decisions Made +- Exercise state uses direct mutation (not immutable copies) for simplicity in the game loop +- Streak counter resets to 0 after triggering a speed adjustment, preventing rapid acceleration +- db parameter kept in initLessonScreen signature (prefixed with underscore) for future use when lesson analytics are added + +## Deviations from Plan + +### Auto-fixed Issues + +**1. [Rule 1 - Bug] Fixed unused import and parameter TypeScript errors** +- **Found during:** Task 2 +- **Issue:** `isExerciseComplete` imported but unused in screens.ts; `db` parameter unused in initLessonScreen +- **Fix:** Removed unused import, prefixed unused param with underscore +- **Files modified:** src/ui/screens.ts +- **Verification:** `npx tsc --noEmit` passes +- **Committed in:** ba4525d (Task 2 commit) + +--- + +**Total deviations:** 1 auto-fixed (1 bug) +**Impact on plan:** Minor TypeScript strictness fix. No scope creep. + +## Issues Encountered +None + +## User Setup Required +None - no external service configuration required. + +## Next Phase Readiness +- Typing engine ready for forest screen integration (Plan 05) +- startLesson exported from app.ts, ready to be called from forest/level map +- All 37 tests passing (levels + db + typing) + +--- +*Phase: 01-grundger-st-tippmechanik* +*Completed: 2026-03-29*