FocusForge: Single-file attention training game, Master prompt and operator guide

TLDR

FocusForge is a self-contained browser game that builds sustained attention through rotating mini-challenges and adaptive difficulty. Paste the full master prompt below into your AI tool. It returns one HTML file that runs offline, persists progress, logs attention metrics, and enforces anti-distraction rules. Use the step-by-step to launch in minutes. References use clean HTML links only.

Introduction

Most attention apps waste time with passive timers. FocusForge replaces idle time with continuous, skill-focused play. The prompt below instructs an AI to generate a single HTML file that includes UI, logic, accessibility, analytics, local persistence, export and import, and a Dev Pane for QA. You can run it locally, share it internally, and iterate quickly without external assets.

The custom prompt. Full text

ROLE AND SCOPE
- Act as product designer, UX lead, and JavaScript engineer.
- Deliver one HTML file that inlines CSS and JavaScript. No external libraries or assets.
- The game must run offline, be responsive for phone and desktop, and persist progress locally.

GOAL
Create a browser game that increases a player’s attention span by keeping them in continuous, interactive focus blocks that grow from about 90 seconds to 12 or more minutes. There is no passive waiting at any point.

DELIVERABLES
- One standards-compliant HTML file that includes all CSS and JS inline.
- Fully responsive layout for mobile and desktop with clean, modern UI and smooth animations under 300 ms.
- localStorage persistence with export and import of profile and history as JSON.
- A brief README comment block at the top explaining controls, modes, progression, and how to test.

CORE LOOP
1) Player selects a target session length: 2, 4, 6, 8, 10, or 12 minutes.
2) The session runs a sequence of mini-challenges without gaps.
3) Streaks, combo bonuses, and small penalties maintain engagement.
4) End screen shows attention metrics and unlocks longer targets when criteria are met.

TRAINING MODES
Include at least four, and rotate them during a session. Provide short on-screen instructions and a 10 second guided warm-up the first time each mode appears.
- Memory Matrix: flash a grid, hide it, then tap lit cells in order.
- N-Back Lite: stream of symbols; respond when current equals the one N steps back.
- Go or No-Go: react to target symbols and inhibit on distractors.
- Mental Math Sprint: rapid single digit operations under a time limit.
- Pattern Scout: pick the next item in a visual or numeric sequence.

PERSONALIZATION AND CALIBRATION
- First run calibration: three short trials per mode using a 2-down 1-up staircase to estimate thresholds. Persist per-mode baselines.
- Seeded random generator: rng(seed=sessionId) for reproducibility across sessions.
- Player profile structure stored under localStorage key focusforge.profile:
  {
    "name": "Player1",
    "unlocked": [2,4,6],
    "elo": {"memory":1200,"nback":1200,"gng":1200,"math":1200,"pattern":1200},
    "baselines": {"rt_ms":650,"acc":0.88},
    "history": []
  }

ADAPTIVE ENGINE WITH EXPLICIT FORMULAS
- Maintain a per-mode ELO-style rating. After each micro-block:
  Δ = K * (result - expected)
  expected = 1 / (1 + 10^((opp - elo)/400))
  Use opp = 1200 and K that yields visible change within two minutes. Map result from accuracy and response time.
- Define a challenge index CI in [0,1]:
  CI = 0.5 * clamp(1 - RT/targetRT, 0, 1) + 0.5 * Accuracy
- Map CI to parameters per mode:
  Memory: grid = 2 + round(3*CI), reveal_ms = 1200 - 600*CI
  N-Back: N = 1 + (CI > 0.65 ? 1 : 0) + (CI > 0.85 ? 1 : 0)
  Go or No-Go: distractor_ratio = 0.5 + 0.4*CI, response_window = 900 - 350*CI
  Math: ops_per_min = 40 + 50*CI, allow carry when CI > 0.7
- Lapse definition: no valid input for more than 2500 ms while a stimulus is active. Record timestamps of lapses.

CURRICULUM PLANNER
- Compose sessions from 45 to 90 second micro-blocks. No idle time between blocks. Do not repeat the same mode twice in a row.
- Bias selection toward the lowest ELO mode to balance cognitive load.
- Progression gates to unlock the next session length:
  Accuracy at least 85 percent
  90th percentile response time at most 900 ms
  Lapses at most floor(targetMinutes/2)

SCORING
- Score = base points multiplied by streak multiplier.
- Miss or idle longer than 2 seconds resets streak and subtracts a small amount.
- Live badges for milestones: 3 minutes uninterrupted, 200 correct, Distraction resisted.

ATTENTION METRICS AND ANALYTICS
- After each session compute and display:
  Accuracy, average and 90th percentile response time
  Longest uninterrupted focus run
  Number of lapses with timestamps
  Session length achieved and suggested next target
- Include inline SVG charts: sparkline for response time, bar chart for lapses, line chart for score across sessions.
- Session summary schema appended to history:
  {
    "sessionId":"ISO-8601",
    "targetMin":6,
    "modes":[{"name":"memory","acc":0.91,"rtAvg":612,"rtP90":840,"streakMax":34,"lapses":1}],
    "totals":{"acc":0.89,"rtAvg":640,"rtP90":880,"lapses":3,"score":18420,"focusLongestSec":114}
  }
- Provide Download Data and Import Data buttons that write and merge JSON by sessionId.

MOTIVATION, COACHING, AND FLOW
- Micro-coach messages that trigger on key events:
  After a lapse: "Breathe once, lock on the next cue."
  After 30 correct: "You are in flow. Keep pace, not haste."
- Power-ups that do not break flow:
  Streak Shield: prevent one miss from breaking the streak once per session.
  Focus Surge: temporary ten percent increase to the score multiplier after 60 uninterrupted seconds.

ANTI-DISTRACTION AND INTEGRITY
- Enforce continuous engagement using visibilitychange, pointer and key activity, and requestIdleCallback.
- When a distraction is detected, apply a soft penalty: lose streak, add one lapse, and continue without blocking popups.
- Cheat guards: seeded sequences, bounded input rate, ignore programmatic dispatch events, detect throttled background timers.

UX AND ACCESSIBILITY
- Clean, modern interface. Clear instructions for each mode. Immediate performance feedback.
- Keyboard-first controls with visible focus states. Provide ARIA live regions for feedback.
- Color-blind safe palette. Sound cues optional and muted by default.
- Reduced Motion toggle and respect prefers-reduced-motion.
- Haptics on mobile with navigator.vibrate. Short vibrate for correct. Longer pattern for miss.
- Pause and resume with a single key. Pausing freezes timers and streaks.
- Light and dark themes with minimum 4.5:1 contrast ratio.

TECHNICAL ARCHITECTURE INSIDE ONE FILE
- Organize code as in-file modules: Timer, RNG, State, Modes, Adaptation, Coach, Storage, UI, Charts.
- Use requestAnimationFrame for visuals and a precise Timer for deadlines. Verify drift under five ms per 60 seconds in tests.
- Persist a player profile with unlocked lengths, per-mode skill ratings, and last ten sessions.
- Register an offline service worker generated from a Blob at runtime so the single file works offline without external assets.
- Include a Dev Pane that can be toggled. It shows demo data seeding, unit tests, and reliability stats.

A/B AND RESEARCHER MODE
- Optional A/B toggles for hypotheses like streak multiplier curve A vs B. Assign group by a hash of sessionId.
- Compute split-half reliability of accuracy within a session and surface the coefficient in the Dev Pane.
- Privacy: local only. Do not make network requests. Display a one-screen privacy notice.

ANTI-TAB SWITCH AND IDLE QA
- Switching tabs or idling should create at least one penalty event during QA when simulated. Do not block the flow.

USER EXPERIENCE AND REWARDS
- Clean results screen with session summary, badges, and a suggestion for the next target and weakest two modes based on ELO gaps.
- Session completion rewards and progression tracking. Ability to pause or resume sessions.

ACCEPTANCE CRITERIA
- The file runs by opening it in a modern browser. No external dependencies.
- Zero dead time between micro-blocks.
- Adaptive difficulty is observable within the first two minutes.
- Progress persists across reloads. Export and import reproduce identical charts after reload.
- Lighthouse performance score at least 90 on mobile and desktop.
- All controls accessible by keyboard.

QA CHECKLIST IMPLEMENTED IN DEV PANE
- Timer drift check, adaptation monotonicity test, storage round trip, tab visibility penalty trigger, seeded RNG reproducibility.

NICE TO HAVE STRETCH
- Optional 20 second box-breathing primer before sessions. It does not count toward score.
- Daily plan suggestion for tomorrow’s target length and focus areas using ELO gaps.

IMPLEMENTATION NOTES
- Keep all strings centralized for easy edits.
- Use semantic HTML. Keep animations subtle, under 300 ms.
- Do not use blocking alert or confirm dialogs during gameplay.
- Include comments where formulas are used and cite parameter meanings.

FINAL OUTPUT
- Return a single self-contained HTML document with inline CSS and JavaScript that implements everything above. Name the game FocusForge in the UI and include a concise Help overlay.

What this prompt does

  • Generates one offline HTML game that trains attention with Memory Matrix, N-Back Lite, Go or No-Go, Math Sprint, and Pattern Scout.
  • Calibrates difficulty, adapts every block, and tracks accuracy, response time, lapses, streaks, and ELO per mode.
  • Enforces flow with zero idle time, anti-distraction penalties, seeded RNG, and basic cheat guards.
  • Persists progress, exports and imports JSON, and shows inline SVG charts.
  • Implements accessibility with keyboard controls, ARIA live updates, reduced motion respect, and color-safe themes.

Step by step usage

  1. Paste the full prompt into your AI tool. Model: ChatGPT or similar.
  2. Save the returned code as focusforge.html.
  3. Open the file in a modern browser.
  4. Enter a player name. Select a target length. Press Start.
  5. Use Space to pause or resume. Esc stops.
  6. After a session, check Accuracy, RT average and P90, lapses, score, and suggested next target.
  7. Export data for backups. Import later to merge by sessionId.

Applied example

  • Team focus warmup: run 6 minutes before a planning meeting. Goal is accuracy at or above 85 percent and P90 under 900 ms.
  • Coaching: if lapses exceed 3, suggest 2 or 4 minute targets next time and bias sessions toward the two lowest ELO modes.
  • QA: open the Dev Pane and run the drift and RNG tests before sharing the file with a group.

References and links

Conclusion

FocusForge turns attention training into an adaptive, fully offline game you can run anywhere. The master prompt above consistently produces a clean single-file app with strong defaults, accessible controls, and measurable outcomes. Start with 2 or 4 minutes. Review the results screen. Unlock longer targets as accuracy and response time improve. Export your data to compare sessions over time.

Leave a Reply

Discover more from Digital Thought Disruption

Subscribe now to keep reading and get access to the full archive.

Continue reading