Repository navigation
feat: death mode (-d) — end the test on the first mistake - #28
Merged
Merged
Conversation
Adds a `-d` / `--death-mode` flag. With it on, the test finishes the instant an incorrect character is typed, checked ahead of the usual length/timer rules so it beats even a running timer. Practicing with zero tolerance for errors is a well-known way to build accuracy (and, in turn, speed). This revives the idea from the long-open PR jrnxf#18 with a focused implementation and tests. - thok: `death_mode` flag on `Thok`; `has_finished` returns early on any incorrect input when it's set. - main: `-d` flag wired through `App::new`/`reset`. - docs: README example + `--help` entry. - tests: mistake ends it, off tolerates mistakes, and it overrides a running timer.
hindriix
force-pushed
the
upstream-pr/death-mode
branch
from
July 25, 2026 06:07
3f010bf to
828b0b0
Compare
A run that dies after a fraction of a second would otherwise be logged as an absurdly high wpm. Thok::died() is the one place that says a test ended on a mistake; has_finished uses it, and save_if_finished skips the history append for a died run. Clean runs in death mode still log.
Instead of the wpm results, a run that died shows a YOU DIED heading, the expected character against the key pressed, the prompt around the mistake with the word it was in underlined, and how far the run got in words, characters and time. A clean death-mode run and a mistake outside death mode keep the normal results screen. Retry and new-test keys are unchanged.
The block (heading, what went wrong, the prompt around it, how far the run got) is centred on the screen, every line on one axis, with the key hints bottom left where the results screen has them. The website's snapshot check skips the death screen, which the page has no death mode to draw.
Owner
|
Thanks @hindriix, this is a great addition and exactly the kind of small focused PR that is easy to land. I merged the current main into your branch and pushed these on top, with your commits left as they are:
Merged, thanks again! |
This was referenced Oct 29, 2026
Merged
Owner
|
Shipped in v0.7.0. The death screen evolved a bit after merge (#42): the skull is gone, and the prompt now freezes in place with the missed character highlighted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a death mode (
-d/--death-mode): the test ends the instant you mistype a character.This revives the idea from #18 (which has been open since early 2023) with a small, focused, tested implementation — happy to defer to the original author if they'd prefer to land theirs; just wanted to offer a ready-to-merge version.
Why
Practicing with zero tolerance for mistakes is a well-known way to build accuracy, which in turn builds real speed. It makes you slow down and commit to each keystroke.
How
death_modeflag onThok;has_finished()returns early as soon as any input isIncorrectwhen it's set — checked ahead of the length/timer rules so it beats even a running timer.-dflag wired throughApp::new/reset.--helpentry.Verification
cargo test/clippy/fmt --checkclean; unit tests cover: a mistake ends the test, death mode off tolerates mistakes, and death mode overrides a running timer. Also confirmed via a PTY run (one wrong key → straight to the results screen).