LockKeyReaction is a reflex-testing game that uses your keyboard’s lock LEDs (Caps Lock, Num Lock, Scroll Lock) as visual prompts! Hit the correct key in time, and the game speeds up — miss it, and you'll have to keep up!
Originally designed for GNU/Linux using xdotool and xset, this version also includes on-screen status lights so it should work on Windows (currently not supported) and non-LED setups too. ⌨️✨
A javascript version of this (does not support lock keys): js_lockkeyreaction Play it now: https://pemmyz.github.io/js_lockkeyreaction/
This game started as a fun way to test reflexes using actual keyboard LED lights. It evolved into a fully-featured Python + Pygame application with real-time stats and cross-platform (Windows currently not supported) support.
This idea is probably as old as the first keyboards that came with lock key lights — and the ability to programmatically toggle them. I wasn’t the first person to come up with this idea — and the person I originally heard it from probably wasn’t the first either. This is just my take on a fun concept that’s been floating around in different forms.
- LEDs will light up randomly (or status prompts will appear).
- You must press the correct key before the time runs out:
Num Lock→ ← Left arrowCaps Lock→ ↓ Down arrowScroll Lock→ → Right arrow
- The game gets faster the better you do!
- View real-time stats like:
- Accuracy, reaction times, streaks, median, percentiles, and more.
- Fastest / Slowest / Average reaction time
- Median, Standard Deviation
- 25th and 75th Percentiles
- Missed prompts
- Accuracy & Prompt ratio
- Current and longest streaks
- Total game time & unpaused time
- Python 3
- Pygame
xdotoolxset
Install requirements:
bash
sudo apt install xdotool
pip install pygame
python lockkeyreactionmain.pyAdjust the logic, make it so that the reactiontime balances around players ability to hit keys, too slow and game will slow down and too fast and game will pick up the pace. And depending on the players ability to hit correct key in time will give scores and game will have different durations games and highscore list. Adjust the game so it will work on other operating systems like Windows. Now there might be things coded that are not crossplatform.
- The game will adapt its reaction time dynamically based on the player's key press performance:
- If the player consistently presses keys too slowly, the game will slow down to stay challenging but fair.
- If the player hits keys very quickly and accurately, the game will speed up to increase the difficulty.
- Score will be based on:
- Hitting the correct key in time.
- Reaction accuracy (how fast you hit the key after prompt).
- Missed or incorrect keys will reduce the score or combo.
- Multiple game duration options (e.g., 30s, 60s, endless mode).
- The high score list will reflect top performances based on selected durations.
- Adjustments will be made to ensure full support on Windows, Linux, and macOS.
- Code will be refactored to remove or replace platform-specific functionality with cross-platform alternatives:
- Avoid hardcoded paths or OS-specific calls.
- Use standard Python libraries and OS-independent file handling where possible.
- Persistent highscore list stored in a simple JSON or text file.
- Optionally support per-duration leaderboards.
- Implement dynamic reaction time scaling.
- Add scoring and combo system.
- Build game duration options.
- Implement cross-platform input handling.
- Create and store highscore lists.
- Add multiple leds on at same time.
This game was created with the assistance of AI tools (e.g., ChatGPT) for various tasks such as:
- Code suggestions and debugging
- Design ideas and architectural guidance
- Problem-solving and refactoring help
- Occasional motivational pep talks
While AI provided helpful input during development, all decisions, edits, and final implementations were made by a human (yes, really).
Think of it as pair programming… with a very talkative robot.
Stay tuned for updates!
