โšก REACTION TEST in Python

The same test โ€” but the stopwatch is Python

โ† Back to Fun Time
๐Ÿ Starting Pythonโ€ฆ
Last go
โ€”
Average
โ€”
Goes
0
Best
โ€”

โŒจ๏ธ Controls

  • SPACE or ENTER โ€” that is the whole game
  • Clicking or tapping the panel works too
  • R clear the scores  โ€ข  P pause
  • The panel reacts the moment your finger goes DOWN, not when it comes up.
  • ๐ŸŽฎ Xbox controller? Just plug it in or pair it โ€” the stick and D-pad are the arrow keys, A is SPACE, Menu pauses and View starts again

๐ŸŽฏ How to play

  • Press once to arm it. The panel says WAITโ€ฆ
  • After a random pause the panel turns solid black. Press!
  • Press before it turns black and it does not count โ€” that is a false start.
  • The bar chart shows your last eight goes, with your best one filled in.

๐Ÿ† What is a good time?

  • The average grown-up is about 250 ms.
  • Under 200 ms is genuinely fast.
  • Under 150 ms usually means you guessed โ€” and got lucky.
  • Watch the panel, not your hand. And do not blink.

๐Ÿง‘โ€๐Ÿ’ป This whole game is Python

There is almost no JavaScript on this page. The browser downloaded Pyodide โ€” a complete Python interpreter compiled to WebAssembly โ€” and then ran the .py files in funtime/pylib/. Python does the rules, the maths and the drawing.

File What it does Good functions to try re-writing
pylib/reaction_rules.py The rules: the phases, the delay, the stopwatch random_delay, update_game, press, average_time
pylib/reaction_draw.py Painting the panel โ€” Python calling the canvas panel_words, draw_panel, draw_history
pylib/reaction_web.py The glue: the keyboard and the panel do_action, on_press, frame

๐Ÿ” Compare the two versions. Open lib/reaction-rules.js and pylib/reaction_rules.py side by side โ€” same ideas, two languages.

๐Ÿ› ๏ธ Build it yourself: Build Reaction Test in Python walks you through the functions one at a time.

โš ๏ธ If the game never starts: the page has to read its .py files, which a browser will not do for a page opened straight off your disk. Use the live site, or run python3 -m http.server in the project folder.