Build a Reaction Time Tester Game with False-Start Detection in One HTML File

Get a polished reaction time test with random delays, false-start penalties, a five-attempt average and an SVG results chart, all in one HTML file.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
Act as a senior front-end developer and game designer who ships polished browser mini-games.

Build Signal Snap, a reaction time tester themed like a night-time railway signal lamp. Each round has five valid attempts. A large panel turns red, waits a random delay, then turns green, and the player reacts as fast as possible. The final score is the average of the five attempts plus penalties.

Rules:
1. Controls: pointerdown on the panel (mouse or touch), plus Space or Enter anywhere. Ignore key auto-repeat. Measure time with performance.now() from the moment green appears.
2. Random delay between 1.5 and 4.5 seconds. Tapping during red is a false start: show an amber warning, add a 50 ms penalty to the final score, and replay that attempt without counting it.
3. States: idle, waiting, go, result shown, false start, and finished with a final score and a short rating label. Include a New round button.
4. Show stat cards for attempts done, last, best, average and false starts, plus an inline SVG bar chart of all five attempts with dashed placeholders for missing ones, the best bar highlighted, and a dashed average line.
5. Dark navy palette with red, green and amber signal colors; white text with strong contrast; fits 360 to 1280 px; an aria-live status line; disable the pop animation under prefers-reduced-motion.
6. Web Audio tones only, created on the first press, quiet, with a visible mute toggle. No external files, storage or alerts.

Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Signal Snap, a five-attempt reaction tester styled like a railway signal lamp.

Click, tap or press Space to arm the panel. It turns red, waits a random 1.5 to 4.5 seconds, then flashes green. React as fast as you can. Tap too early and you get an amber false start, a 50 ms penalty and a replay. After five hits you get a final score and rating, and the bar chart shows every attempt, your best in green and your average as a dashed line. Try deliberately jumping the gun to see the penalty, or mute the beeps with the sound toggle.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Naming every state (idle, waiting, go, false start, finished) stops the model from merging them into buggy logic with double-counted taps.
  • Requiring pointerdown and performance.now() gives accurate timings and avoids the slower click event on touch screens.
  • Asking for an inline SVG chart with placeholders makes the results view look finished from the very first load.

Paste into ChatGPT, Claude or Gemini. Save the returned code as signal-snap.html and open it in any browser, or run it in the chat's preview or canvas panel. No setup or internet needed.

Common edits

  • Change the attempt count, the delay range or the 50 ms penalty to make the test harder or friendlier.
  • Retheme it as a starting pistol, traffic light or space launch by swapping the colors, wording and tones.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Simple HTML Games