Compare commits

..

1 Commits

Author SHA1 Message Date
Alexander Whitestone
dacb2c2f0e chore: move dormant prototypes to reference/ directory (#192)
Some checks are pending
Accessibility Checks / a11y-audit (pull_request) Waiting to run
Smoke Test / smoke (pull_request) Waiting to run
game/npc-logic.js and scripts/guardrails.js are not loaded by the
browser runtime. Moving to reference/ with clear headers so the
active architecture is unambiguous.

- Added REFERENCE PROTOTYPE headers explaining dormant status
- Added reference/README.md with integration instructions
- Files use ES module syntax / have inline tests — not
  compatible with current <script> tag loading

Closes #192
2026-04-15 21:42:12 -04:00
5 changed files with 65 additions and 19 deletions

View File

@@ -8,32 +8,24 @@ The Beacon is a browser-based idle/incremental game inspired by Universal Paperc
Static HTML/JS — no build step, no dependencies, no framework. Open `index.html` in any browser.
**6,033 lines of JavaScript** across 11 files. **1 HTML file** with embedded CSS (~300 lines). **3 test files** (2 Node.js, 1 Python).
**5,128 lines of JavaScript** across 10 files. **1 HTML file** with embedded CSS (~300 lines). **1 Python test file** for reckoning projects.
## Architecture
```
index.html (UI + embedded CSS + inline JS ~5000L)
index.html (UI + embedded CSS)
|
+-- js/engine.js (1590L) Core game loop, tick, resources, buildings, projects, events
+-- js/data.js (944L) Building definitions, project trees, event tables, phase data
+-- js/render.js (390L) DOM rendering, UI updates, resource displays
+-- js/combat.js (359L) Canvas boid-flocking combat visualization
+-- js/combat.js (359L) Boss encounters, combat mechanics
+-- js/sound.js (401L) Web Audio API ambient drone, phase-aware sound
+-- js/dismantle.js (570L) The Dismantle sequence (late-game narrative)
+-- js/main.js (223L) Initialization, game loop start, auto-save, help overlay
+-- js/utils.js (314L) Formatting, save/load, export/import, DOM helpers
+-- js/tutorial.js (251L) New player tutorial, step-by-step guidance
+-- js/strategy.js (68L) NPC strategy logic for combat
+-- js/emergent-mechanics.js Emergent game mechanics from player behavior
CI scripts (not browser runtime):
+-- scripts/guardrails.sh Static analysis guardrails for game logic
+-- scripts/smoke.mjs Playwright smoke tests
Reference prototypes (NOT loaded by runtime):
+-- docs/reference/npc-logic-prototype.js NPC state machine prototype
+-- docs/reference/guardrails-prototype.js Stat validation prototype
+-- game/npc-logic.js (18L) NPC behavior stub
```
## Entry Points

View File

@@ -3,15 +3,20 @@ _2026-04-12, Perplexity QA_
## Findings
### Dead Code — Resolved (2026-04-15, Issue #192)
### Potentially Unimported Files
The following files were confirmed dead code — never imported by any runtime module.
They have been moved to `docs/reference/` as prototype reference code.
The following files were added by recent PRs but may not be imported
by the main game runtime (`js/main.js``js/engine.js`):
| File | Original | Resolution |
|------|----------|------------|
| `game/npc-logic.js` | PR #79 (GOFAI NPC State Machine) | **Moved to `docs/reference/npc-logic-prototype.js`** — ES module using `export default`, incompatible with the global-script loading pattern. Concept (NPC state machine) is sound but not wired into any game system. |
| `scripts/guardrails.js` | PR #80 (GOFAI Symbolic Guardrails) | **Moved to `docs/reference/guardrails-prototype.js`** — validates HP/MP/stats concepts that don't exist in The Beacon's resource system. The `scripts/guardrails.sh` (bash CI script) remains active. |
| File | Added By | Lines | Status |
|------|----------|-------|--------|
| `game/npc-logic.js` | PR #79 (GOFAI NPC State Machine) | ~150 | **Verify import** |
| `scripts/guardrails.js` | PR #80 (GOFAI Symbolic Guardrails) | ~120 | **Verify import** |
**Action:** Check if `js/main.js` or `js/engine.js` imports from `game/` or `scripts/`.
If not, these files are dead code and should either be:
1. Imported and wired into the game loop, or
2. Moved to `docs/` as reference implementations
### game.js Bloat (PR #76)

29
reference/README.md Normal file
View File

@@ -0,0 +1,29 @@
# Reference Prototypes
These files are **NOT loaded by the browser runtime**. They are preserved
reference code for future integration work.
## Why They're Here
The current `index.html` loads scripts from `js/` via `<script>` tags.
These files use incompatible patterns (ES modules, inline tests) or are
not yet wired into the game engine.
## Files
- **npc-logic.js** — NPC state machine prototype. Uses `export default`
(ES module syntax). Would need refactoring to work with the current
script loading approach.
- **guardrails.js** — Game logic consistency validator. Has inline test
code at the bottom. Would need cleanup before integration.
## To Integrate
1. Refactor to work without ES module exports (remove `export default`)
2. Remove inline test code
3. Add `<script src="reference/filename.js">` to `index.html`
4. Wire into the game engine lifecycle
5. Add tests
See: https://forge.alexanderwhitestone.com/Timmy_Foundation/the-beacon/issues/192

View File

@@ -1,3 +1,13 @@
/**
* REFERENCE PROTOTYPE Not loaded by the browser runtime.
*
* Symbolic guardrails for game logic consistency validation.
* Contains inline test code at bottom not production-ready.
*
* Status: DORMANT preserved for future integration work.
* See: https://forge.alexanderwhitestone.com/Timmy_Foundation/the-beacon/issues/192
*/
/**
* Symbolic Guardrails for The Beacon

View File

@@ -1,3 +1,13 @@
/**
* REFERENCE PROTOTYPE Not loaded by the browser runtime.
*
* NPC state machine prototype. Uses ES module syntax (export default)
* which is not compatible with the current <script> tag loading approach.
*
* Status: DORMANT preserved for future integration work.
* See: https://forge.alexanderwhitestone.com/Timmy_Foundation/the-beacon/issues/192
*/
class NPCStateMachine {
constructor(states) {