WolfsWorld — Architektur & Design-System Dokumentation
Stand: 22. Februar 2026
Generiert aus:ENGINEERING_CONVENTIONS.md,UI_STYLE_PLAN.md, Codebase-Analyse
1. Architektur-Überblick
Verzeichnisstruktur
WolfsWorld/
├── css/ → Stylesheets (Design-System)
│ ├── tokens.css → Design Tokens (:root Custom Properties)
│ ├── style.css → Globale UI-Komponenten + Utilities
│ ├── responsive.css → Breakpoints, Orientation, Glass-UI
│ ├── layouts/
│ │ ├── viewport-split.css → Mode A: Sidebar + Canvas (Games, LP-Sidebar)
│ │ ├── viewport-full.css → Mode B: Toolbar + Vollbild (Playgrounds)
│ │ └── scroll-content.css → Mode C: Scroll-Seite (Lernpfade)
│ ├── flowchart.css → Flowchart-Nodes (arena + rules-lab)
│ ├── learning-path.css → LP-spezifische Content-Boxen
│ ├── game-menu.css → Menü-Layout
│ └── [feature].css → Feature-spezifisch (arena, tree-viz, quiz, ...)
│
├── js/
│ ├── config/
│ │ ├── constants.js → Fachliche Konstanten
│ │ └── debug-config.js → Zentrales Logging-System
│ ├── core/
│ │ ├── base-game-controller.js → Abstrakte Basis für alle Spiel-Controller
│ │ ├── game-state.js → Generisches Spielzustand-Interface
│ │ ├── game-adapter.js → Adapter für Core-Logik
│ │ ├── agent.js → Agent-Basis
│ │ └── iframe-bridge.js → IframeBridge (Host + Client)
│ ├── ai/
│ │ ├── minimax.js → Minimax mit Alpha-Beta-Pruning
│ │ ├── search-algorithms.js → BFS/DFS Suchalgorithmen
│ │ ├── algorithm-runner.js → Async Algorithm-Execution
│ │ ├── agents/ → Agent-Implementierungen
│ │ ├── heuristics/ → Bewertungsfunktionen
│ │ └── rules/ → Regelbasierte Entscheidungen
│ ├── games/
│ │ ├── tictactoe/ → TTT (logic, renderer, controller×3)
│ │ ├── connect4/ → Connect4 (logic, renderer, controller×2)
│ │ ├── rotatebox/ → RotateBox (logic, renderer, controller, solver)
│ │ ├── knights-tour/ → Springer (logic, renderer, controller)
│ │ └── nim/ → Nim (logic)
│ ├── viz/
│ │ ├── core/ → BaseVisualizer, visualization-utils
│ │ ├── tree-viz/ → Tree-Engine v2 mit Node-Rendering
│ │ ├── adapters/ → Tree-Adapter (BFS, DFS, Minimax, AlphaBeta)
│ │ ├── specializers/ → Flowchart, Rule-Visualizer
│ │ └── shared/ → Tree-Analysis Utilities
│ ├── utils/ → Canvas-Utils, Bottom-Sheet, Benchmark
│ └── learning-path.js → Lernpfad-Navigation + IframeBridge-Host
│
├── games/ → HTML-Seiten für Spiele
├── playground/ → HTML-Seiten für Visualisierungen
│ └── arena/ → KI-Arena (JS + HTML)
├── learning-paths/ → Lernpfad-Kurse
│ ├── minimax-ttt/ → Minimax-Kurs (9 Seiten)
│ ├── search-trees-rotatebox/ → Suchbaum-Kurs (10 Seiten)
│ └── templates/ → LP-Seitenvorlage
└── docs/ → Dokumentation (JSDoc + Conventions)
Architektur-Schichten
┌─────────────────────────────────────────────────┐
│ HTML-Seiten (games/, playground/, learning-paths/) │
├─────────────────────────────────────────────────┤
│ CSS Design-System (tokens → layouts → components) │
├─────────────────────────────────────────────────┤
│ Controller (base-game-controller → game controllers) │
├────────────────┬──────────────────┬─────────────┤
│ Game Logic │ AI / Agents │ Viz Engine │
│ (pure state) │ (Minimax, Rules)│ (TreeViz) │
├────────────────┴──────────────────┴─────────────┤
│ Core (GameState, Agent, IframeBridge) │
├─────────────────────────────────────────────────┤
│ Utils (canvas-utils, debug-config, constants) │
└─────────────────────────────────────────────────┘
2. Design-System
2.1 Design Tokens
Alle Farben, Abstände und Schriftgrößen sind in css/tokens.css als CSS Custom Properties definiert.
Farben: --color-bg, --color-surface, --color-text, --color-primary, --color-success, --color-warning, --color-danger
Spacing: --space-xs (4px) bis --space-2xl (48px)
Typografie: --font-size-xs (0.75rem) bis --font-size-2xl (2rem)
Layout: --sidebar-width (320px), --toolbar-height (50px), --border-radius (6px)
Legacy-Aliases (--bg-color, --accent-blue, --lp-accent-color etc.) verweisen auf die kanonischen Tokens.
2.2 Layout-Modes
| Mode | CSS-Datei | Body-Klasse | Verwendung |
|---|---|---|---|
| viewport-split | layouts/viewport-split.css |
.viewport-split |
Games (Sidebar + Canvas) |
| viewport-full | layouts/viewport-full.css |
.viewport-full |
Playgrounds (Toolbar + Viz) |
| scroll-content | layouts/scroll-content.css |
.scroll-content |
Lernpfade (Scroll-Seite) |
| scroll-menu | game-menu.css |
.scroll-menu |
Spielmenüs |
2.3 Breakpoints
| Name | Wert | Zielgeräte |
|---|---|---|
| sm | max-width: 480px |
Smartphones (Portrait) |
| md | max-width: 768px |
Smartphones (Landscape), kleine Tablets |
| lg | max-width: 1024px |
Tablets |
| xl | min-width: 1025px |
Desktop (Default) |
2.4 Z-Index Scale
| z-index | Verwendung |
|---|---|
| 2 | Step-Badge active (RotateBox) |
| 5 | Sticky Game-Wrapper (scroll-content) |
| 10 | Sidebar, Flowchart checking-Node |
| 20 | Toolbar (viewport-full) |
| 50 | Tuner-Info Tooltips (Arena) |
| 80 | FAB-Button (viewport-full mobile) |
| 100 | Bottom-Sheets / Overlays (mobile) |
| 200 | Modals (Knights-Tour) |
| 8000 | Mobile-Taskbar |
| 9000 | Orientation-Hint |
2.5 Komponenten
Buttons: .btn + Modifier (.btn--primary, .btn--success, .btn--danger, .btn--ghost, .btn--icon)
Forms: .form-control + .form-label
Content-Boxen: .lp-block + Typ-Klasse (.lp-info-box, .lp-task-box, .lp-definition-box, .lp-tip-box, .lp-math-box, .lp-prerequisite-box)
2.6 CSS-Einbindung (Standard)
<!-- Basis (immer) -->
<link rel="stylesheet" href="../css/tokens.css">
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="../css/responsive.css">
<!-- + Passendes Layout -->
<link rel="stylesheet" href="../css/layouts/viewport-split.css">
<!-- + Feature-CSS bei Bedarf -->
<link rel="stylesheet" href="../css/flowchart.css">
3. Konventionen
3.1 Logging
- Zentrales Logging über
DebugConfig.log(DEBUG_DOMAINS.*, level, message, payload) - Keine direkten
console.log/warn/errorAufrufe in Feature-Code - Domains sind in
js/config/debug-config.jsdefiniert
3.2 JSDoc
- Jede öffentliche Funktion/Klasse hat JSDoc mit
@param,@returnsund Zweckbeschreibung - Jedes JS-File enthält genau einmal
@author Alexander Wolf - Bei strategischen Entscheidungen:
@fileoverviewergänzen
3.3 Magic Numbers
- Fachliche Konstanten →
js/config/constants.js - Debug-Schalter →
js/config/debug-config.js - CSS-Werte →
css/tokens.css(Design Tokens)
3.4 IframeBridge
- Alle iframe-Kommunikation über
IframeBridgeHost/IframeBridgeClient - Message-Schema:
NAMESPACE:ACTION(z.B.GAME:WON,CONFIG:INIT) - Kein direktes
postMessage()oderwindow.addEventListener('message') - Dokumentation:
docs/conventions/IFRAME_BRIDGE_PROTOCOL.md
4. Spielkategorien
4.1 Games (8 Seiten)
Layout: viewport-split — Sidebar links (Controls, Stats), Canvas rechts
Mobile: Bottom-Sheet mit kompakten Controls, Canvas fullscreen
4.2 Playgrounds (5 Seiten)
Layout: viewport-full — Toolbar oben, Viz-Area maximal, Parameter-Panel seitlich
Mobile: FAB-Button öffnet Parameter-Sheet
4.3 Lernpfade (19 Seiten)
Zwei Sub-Modes:
- Sidebar+Iframe (
scroll-content lp-layout-game): Interaktiver Fokus - Scroll-Content (
scroll-content): Text-lastige Theorie-Seiten
5. Dokumentations-Generierung
# JSDoc generieren
npm run doc
# Dokumentation im Browser öffnen
npm run serve-doc
Konfiguration: jsdoc.json (Template: docdash)
Output: docs/ (HTML)