Learning path · Worked project
Three stars, one door: complete one game step by step
This site-authored browser game asks you to collect three stars and reach E. Explore its loop, pause, saves, touch controls, resizing and publication. Code checks concern this example only, not engines or AI products.
The six stages
The six sections below are the full teaching text, written into the HTML at build time — they read fine with scripting off. Use the workbench’s stage selector to try each one.
The game itself: a 7×5 board, three stars, one door
Arrows or WASD move. Step on ★ to collect a star; reaching E only completes the round after all three. The stage selector below decides which controls appear — those controls are the six lessons.
Position 1,1 · Stars 0/3 · Moves 0. Collect three stars, then reach E.
No project save yet. Saving stays in this browser and origin; it is not uploaded.
Stage 6 · tick these before you ship
The board is drawn by ./three-stars/game.js, copied at build time; its styles are the sibling game.css. Neither is hand-written into the page.
Stage 1 · Establish the core loop
What changes here: Keep level, position, collected stars and moves separate. Arrows/WASD update state before repainting. Walls do not add moves; reaching the exit completes the game only after collecting all stars.
Where the code sits
state = { x: 1, y: 1, moves: 0, collected: [] };
// Input -> legal move -> update state -> render
// Completion is derived from position and collected stars.
How to check it actually holds
- Move left into a wall: position and moves stay unchanged. Count each star once. Reaching E before collecting all stars does not complete the game.
Where to look when it does not
- For out-of-bounds moves, duplicate stars or wall moves being counted, inspect coordinates, legal moves and update order. Do not treat UI text as the state store.
Stage 2 · Pause and restart
What changes here: Pause is independent of level/progress. A hidden page pauses; returning requires explicit resume. Restart resets the board without deleting a browser save.
Where the code sits
if (paused) return;
// On visibilitychange: if document.hidden, pause.
// Restart creates a fresh state; it does not call localStorage.clear().
How to check it actually holds
- Moves stay unchanged while paused and work after resume. A hidden/returned page remains paused. Restart restores the initial position and zero stars.
Where to look when it does not
- If movement bypasses pause, route every input through one guard. If restart deletes saves, separate current-board reset from deleting this project’s saved data.
Stage 3 · Versioned saves and fallback
What changes here: Save only level ID, schema version, coordinates, moves and collected items. Validate fields, position and level; derive completion rather than trusting a flag. Storage-blocked play still works with JSON download/import. Saves are not uploaded.
Where the code sits
{ schema: 1, level: 'three-stars-1', x, y, moves, collected }
// Parse -> validate -> replace state. Invalid saves keep the current board.
// Browser save and file import are separate explicit actions.
How to check it actually holds
- Save after moving, reload the page and load to restore position/stars. Export/import should agree. Reject wrong versions, wall positions, duplicate stars and oversized files while preserving the board.
Where to look when it does not
- localStorage depends on origin and browser policy; file:// behavior is not guaranteed. Retain an unreadable file rather than clearing all browser storage. This example accepts version 1 only and does not pretend to migrate it.
Stage 4 · Share movement between touch and keyboard
What changes here: Directional buttons call the same move function as keyboard input. Keep usable targets/focus. Capture arrows only while the board has focus; do not block page scrolling or zooming.
Where the code sits
button.addEventListener('click', () => move(dx, dy));
// Direction buttons: touch-action: manipulation.
// Keyboard handling belongs to the focusable board, not the whole document.
How to check it actually holds
- The same route through buttons/arrows yields the same state. Both honor pause. Tab enters/exits the board and controls without a focus trap.
Where to look when it does not
- For touch-only wall/pause bypasses, inspect the shared move path. For lost zooming, check whole-page touch-action:none or unconditional event prevention.
Stage 5 · Resize the view without resetting state
What changes here: Use seven flexible columns within the container. Store coordinates in state, not screen pixels. The narrow-board option is a display exercise; every stage retains basic narrow-screen usability.
Where the code sits
grid-template-columns: repeat(7, minmax(0, 1fr));
// Layout changes do not recreate initial game state.
// Saved coordinates remain grid coordinates.
How to check it actually holds
- After moving, switch board width or resize/orient the window without losing position, stars or moves. Check 320px widths, long English text and controls, not only the presence of a scrollbar.
Where to look when it does not
- If resize restarts play, inspect state resets in layout handlers. If loads shift cells, distinguish pixel and grid coordinates.
Stage 6 · Package, replay and check publication
What changes here: The download includes HTML, scripts, styles, brand assets, an asset ledger and hashes. The game itself has no network calls/backend; site/document links need connectivity. For your own publication, check code/asset rights, paths/case, HTTPS and target browsers.
Where the code sits
index.html + game.js + game.css + brand.js + brand.css
asset-ledger.json + manifest.json + README.txt + NOTICE.txt
// Extract, serve on localhost, then test the actual packaged files.
How to check it actually holds
- Play the extracted package, then check pause, saves, blocked storage, keyboard and touch. Inspect the ledger and every published file; one successful page load is not a complete release check.
Where to look when it does not
- For missing files, check case and relative paths. For lost saves, check origin/protocol and browser policy. The sample download grants no separate redistribution licence; check site terms before republishing copied content.
This is the last stage. Tick the release list in the workbench above, then check the package files against the next section.
Asset and licensing ledger
Each row states origin, purpose and redistribution rights. AI drafting does not change the site's licensing: code is MIT, original teaching copy and diagrams are CC BY 4.0; rows carrying a third-party licence or brand assets follow that row's licence column.
The licence wording follows section 1 of the legal page: original code is MIT; text, tables and site-made diagrams are CC BY 4.0 with credit to specul.com and a link to the licence. Brand names and marks are not licensed. section 1 of the legal page · section 8 on privacy and local storage
| Item | Origin | Role | Licence | Redistribution |
|---|---|---|---|---|
| game.js (game logic and board rendering) | Source file projects/three-stars/game.js in this repository; drafted by AI and checked file-by-file against its actual behaviour before inclusion | Board rendering, keyboard and touch input, pause, versioned saves and file import/export; no network calls | MIT (legal page, section 1) | Copying, adaptation, redistribution and commercial use allowed; keep the copyright and licence text |
| game.css (workbench styles) | Source file projects/three-stars/game.css in this repository; it uses only brand.css tokens and declares no raw colour values | Board grid, direction buttons, stage toolbar and print rules | MIT (legal page, section 1) | Copying, adaptation, redistribution and commercial use allowed; keep the copyright and licence text |
| project.json (the six-stage teaching copy) | Teaching copy authored for this site (the Chinese and English fields are revised in the same pass) | The six stages' what / code / check / failure text, inlined into the page at build time | CC BY 4.0 (legal page, section 1) | Copying, adaptation, redistribution and commercial use allowed; credit specul.com, link to the licence and note changes |
| three-stars.html (page copy and ledger) | Authored for this site; each ledger row points at a source path in this repository or at a shared brand asset | Carries the stage explanations, the playable game, the download notes and the asset ledger | Copy CC BY 4.0; page code MIT | Copy and code may be copied, adapted, redistributed and used commercially; credit under CC BY 4.0 and keep the MIT notice respectively |
| brand.css · brand.js (shared site-brand assets) | Truth sources are www.specul/brand.css and www.specul/brand.js; this repository keeps a vendored copy and the build ships that same content | Site shell, theme and language switching, the type and colour tokens | Code and styles MIT; names, marks and logos are outside the trademark licence | Code and styles may be redistributed; brand names, marks and logos are not licensed |
| site.css (content-layer typography) | Assembled at build time from _sites/_template/site.css plus _data/game/css/vg.css | Panels, tables and body rhythm for the vg site | MIT (legal page, section 1) | Copying, adaptation, redistribution and commercial use allowed; keep the copyright and licence text |
| Fonts · none embedded | No font file is packaged; the page uses fonts already on the reader's system, and ★ ● · E are text characters | Text and symbol rendering | No redistribution involved | No font redistribution duty; if your own project embeds a font, check that font's licence separately (see the font licensing term) |
| Images · audio · 3D · none of these | The project contains no images, audio, 3D models or generated media | - | Not applicable | No third-party asset obligations; and do not treat 'no assets here' as a precedent for using assets freely |
| Third-party runtime code · none | No npm dependencies, no CDN, no framework; game.js is the only page script | - | Not applicable | No third-party notice obligations |
| zip.mjs (build-time packer, not shipped inside the archive) | Source file projects/three-stars/zip.mjs: a hand-written stored-ZIP and CRC32 writer used at build time | Generates three-stars.zip and the hash manifest | MIT (legal page, section 1) | A build tool; copying, adaptation and redistribution allowed with the copyright and licence text retained |
| Save JSON · local data; every sample value is fictional | Exported locally by the player (three-stars-save.json); every example value shown by this site is fictional | Level id, schema version, position, move count and collected stars | The data stays on the machine that exported it | Nothing is uploaded and it carries no account or identifier; privacy terms are in section 8 of the legal page |
Nature: checked row by row against the files and their behaviour on 2026-11-06. This is not legal advice and does not replace reading the upstream terms.
The downloadable package
→ Download the package three-stars.zip · 201,666 B · archive SHA-256 b8bc716a9f6d68378cbcde9efff88e9bffa10cb1b94be19bd2e68668d5eff92d
Per-file bytes and hashes inside the package (the same list ships inside the archive, so you can compare entry by entry after extracting):
| File | Bytes | SHA-256 |
|---|---|---|
index.html | 62,982 | 49cc1fc517a9a1e9611dfce9f3653658c1e8c8c247c24d233e265b306ca0bb28 |
game.js | 8,926 | 12e55c061f4be11baf9082b32d0cae5ee0b077a05debd8afe8b918414c25edc2 |
game.css | 2,814 | 246c64c0a83fa9173e47837d8c02aa09a02d6bbb46c7438d78aea29d1fc14587 |
brand.css | 71,554 | 73313a50d39d3809e3192230cbfd2e3e7d213705408a59d845e616958a483ad3 |
brand.js | 11,114 | 7d2eae5991c4bae72eb687f8372aa77d228475324cada2fe3a34d1f3eba60579 |
site.css | 20,508 | 47da36b5b9377085f68f85be297e7a233f65fda526ca3520ffbd1eb8e246fbeb |
asset-ledger.json | 11,195 | fdc791368e40cc890f858f2c45637b180c8c59345aca958c377d653902d72088 |
README.txt | 4,954 | 616e842e23c65116838a665f1c9469c2cb9774482989f67affe708522655fc53 |
NOTICE.txt | 4,404 | 644e725541642b9f153a4335cba648f9d35bea63c35a75280e348d911431f8c4 |
How to open: extract and double-click index.html and it plays — styles, scripts and brand assets are inside and nothing is requested. For a full check, also serve the folder over a local static server: localStorage under file:// is not governed like a site origin, so that item has to be re-tested under the protocol you actually ship on.
Independent checks: this site extracted and verified the archive with separate tooling (CRC, byte-for-byte file comparison, opening it offline). The conclusions and their limits are in the next section.
Machine-readable ledger: asset-ledger.json · hash manifest: manifest.json · package notes: README.txt · licence text: NOTICE.txt
What this site checked · and did not
Verified on 2026-11-06, scoped to this sample and this package only; every line below was run in a browser, not merely read off the code.
- Collected all three stars from the start and reached the exit with matching position, star count, moves and completion; a wall move adds none.
- Invalid imports rejected: a wrong schema version, a wall coordinate, duplicate stars and an oversized file each leave the board unchanged.
- Play stays complete when browser storage is denied, with the download/import route offered instead.
- Keyboard and on-screen buttons share one move path; neither moves while paused; Tab enters and leaves the board and the controls.
- A 320px narrow screen, taps, both themes and both languages pass; resizing the window or switching board width keeps the state.
- With scripting off the six stages stay fully readable — the teaching text is static HTML inlined at build time, not injected by JS.
- The package: extracted with an independent tool, compared byte-for-byte against its sources, CRC-checked, and opened offline without a server.
Not covered: other browsers and real devices, storage policy on other origins or protocols, how the feel holds up over a long session, and any judgement of an engine or an AI product. This site runs no benchmarks and publishes no pass rate or accuracy figure.
What this sample does not claim
- It proves nothing about an engine or an AI product; it describes this 7×5 sample’s own code behaviour
- No pass rate, accuracy or first-try figure
- The download is licensed under CC BY 4.0 for copy and MIT for code and styles; brand names and marks are excluded (see the ledger above and section 1 of the legal page)
← Back to the learning path · the showcase · the build order · Home