add paths-tasks

This commit is contained in:
2026-04-20 14:18:04 +07:00
parent b6579f29a8
commit 9621d0ca63
35 changed files with 1016 additions and 2 deletions
+16 -1
View File
@@ -134,9 +134,10 @@ The base template defines the visual design for all space-themed worksheets. The
When generating HTML worksheets:
- **OUTPUT MUST BE STATIC HTML.** Generated HTML files in `output/html/` must contain only static markup — no embedded `<script>` that computes, generates, or modifies content at runtime. If you need algorithms or calculations (graph generation, random placement, etc.), run them in a separate Node.js script in `src/scripts/`, then write the computed results as static HTML to `output/html/`. The user works with the final HTML directly and expects it to be stable across page reloads.
- **Always read** `src/templates/space-base.html` (structure) and `src/examples/space-worksheet.html` (finished output) before generating
- **Page size:** A4 = 210mm × 297mm
- **CSS:** Uses Tailwind CDN in the HTML `<script>` tag (not the compiled CSS file)
- **CSS:** Uses Tailwind CDN in the HTML `<script>` tag (not the compiled CSS file) — this is the only allowed script
- **Page breaks:** Use `break-after: page` between pages
- **Icons:** 58×58px inline images from `assets/icons/` next to each problem (outside the pill card)
- **Fonts:** Nunito from Google Fonts via `<link>`
@@ -179,6 +180,20 @@ Puppeteer settings for A4 worksheets:
- Margins: zero (CSS handles margins)
- `preferCSSPageSize: true`
## Space Route Task Type
Generator script: `src/scripts/generate-space-route.mjs`
Output: `output/html/space-route-{N}.html`
### Generation rules
- **Grid:** 7×9 hex grid with jitter, nodes evenly distributed across map area
- **Start nodes:** Enemy = top-left corner, Player = bottom-left corner. Start nodes trimmed to exactly 2 edges
- **No asteroids on route nodes** — decorative objects must not be placed on any node belonging to enemy or player routes, nor on neighbors of start nodes
- **Routes use waypoints** — route goes toward an offset waypoint for ~40% of steps, then changes direction toward the final target. This prevents obvious straight-line paths
- **Route length:** 7-9 steps for enemy, player gets 10 empty cells
- **Ship orientation:** check each ship image and set `flipEnemy`/`flipPlayer` flags so all ships face right
- **Difficulty via diffRange:** `[minNodeValue, maxSpread]` — first number = minimum node value, second = max |difference| between connected neighbors
## Visual Position Editor
`output/html/editor.html` — a standalone drag-and-drop editor for repositioning elements (asteroids, icons, etc.) in generated worksheets.