|
Download task_003/instruction.md from Lego-X/UXInteract: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_003/instruction.md
- Command line
-
hf download hf://datasets/Lego-X/UXInteract/task_003/instruction.md
-
curl -L -o instruction.md https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_003/instruction.md
1.99 kB
| # Browser tower-defense prototype | |
| Build a simple 2D tower-defense game that runs offline from the root `index.html`. Render a map with a path, enemies that travel along it, and a tower type the player can place. A tower damages enemies within range. An enemy that reaches the end without being defeated costs one life and does not count as a kill. | |
| ## Simulation interface | |
| Expose `window.gameTest` with `reset()`, `spawnEnemy(options?)`, `placeTower(x, y, options?)`, `step(milliseconds)`, and `state()`. Use the same movement, combat and rendering as the game. After `reset()`, only explicit steps advance the deterministic scenario, and the page reflects those updates. | |
| Return `{path, enemies, towers, lives, kills}`. The path contains at least two distinct `{x, y}` points in scene pixels. An enemy exposes `{seg, t, hp, speed, position}`; `t` is progress from 0 to 1 along segment `seg`, and `position` is `{x, y}` or `null`. A new enemy starts on segment 0 at progress 0 with 3 HP. `spawnEnemy({speed: 0})` keeps it at the start; no options uses normal speed. A tower exposes `{x, y, range}`. `placeTower(x, y, {range})` uses the supplied finite, nonnegative range; otherwise use the default. | |
| Advance movement and combat in 16 ms steps, carrying a remainder into the next call. `step(0)` does not advance the simulation. A newly placed tower damages an enemy that remains within range within 2,048 ms; it deals no damage outside range. | |
| ## Acceptance Checklist | |
| - The offline entry renders the map and spawned enemies. Enemy progress and position stay consistent with the path; an escaped enemy is removed, costs one life and does not award a kill. | |
| - Zero or sub-step time advances do not move an enemy. Accumulated time triggers the next fixed step, and the scene reflects simulation updates. | |
| - A zero-speed enemy stays in place. Towers honor range overrides and damage or defeat continuously in-range enemies within the specified time without damaging out-of-range enemies. | |