The completed practice starts one local attempt clock, accepts the original passage “We pack lunch.” and freezes the accepted text once on Finish. At thirty seconds, that exact 14-character passage gives 5.6 gross WPM and complete. Its seven-character partial gives 2.8 WPM and 100% positional word accuracy, but incomplete.

Make the three calculations visible
Berkeley's CS 61A Cats project defines positional word accuracy using exact case and punctuation, and WPM using five-character groups including spaces. Its shorter correct input can have full word accuracy. This new task adopts those definitions without copying its Python code, source passages, tests, autocorrect or multiplayer features. Berkeley CS 61A: Cats
Use an original ASCII passage: We pack lunch. It contains fourteen characters, including two spaces and the period, and three whitespace-separated tokens.
Gross WPM = (current typed characters ÷ 5) ÷ (elapsed seconds ÷ 60).
Positional word accuracy = matching typed tokens in the same reference positions ÷ all typed tokens × 100. Case and punctuation remain exact. Extra typed tokens have no matching reference position and count as incorrect. Empty input against this nonempty passage has 0% word accuracy.
Completion is exact equality between the entire current input and the passage. Do not trim, lowercase, remove punctuation or collapse whitespace before this comparison. Those changes could award completion for text the reader did not actually reproduce.
Use a partial response as the main test
All rows below are independent examples at thirty seconds, not consecutive states from one attempt.
| Current input | Characters | Gross WPM | Word accuracy | Complete? |
|---|---|---|---|---|
We pack lunch. |
14 | 5.6 | 3/3 = 100% | Yes |
We pack |
7 | 2.8 | 2/2 = 100% | No |
We Pack lunch. |
14 | 5.6 | 2/3 ≈ 66.67% | No |
We pack lunch. now |
18 | 7.2 | 3/4 = 75% | No |
The partial row has no error among its two typed words. It is still missing the third word. Displaying both 100% and Incomplete is informative, not contradictory.
The capitalized Pack row keeps the same character count and gross speed, but changes the word comparison. The extra now row raises gross WPM while reducing accuracy and failing exact completion. Gross WPM is not a penalty-adjusted score or proof of successful work.
An additional whitespace example makes the distinction clearer: We pack lunch. has fifteen characters and the same three tokens, so at thirty seconds it has 6.0 gross WPM and 100% word accuracy. It is not complete because the text contains an extra space. Token splitting and whole-text equality have deliberately different jobs.
Run one attempt
Select Start, type in the labeled field, then choose Finish. All active time since Start counts, including idle time. Finish freezes the clock and accepted buffer once; pressing it again does not create a faster result. An exact match does not stop the attempt automatically. Reset clears the attempt, input, paste label and metrics.
The local clock uses performance.now(). It measures elapsed time within this page, with no certified timing or cross-platform sleep guarantee. Before elapsed time becomes positive, gross WPM is N/A. Empty accepted text after positive time gives zero WPM and zero accuracy. MDN: performance.now.
Only printable ASCII from space through tilde is accepted here. Invalid completed edits are rejected as a whole and the prior accepted text is restored. Composition is checked after completion, and Finish asks you to resolve any active composition first. Corrections recalculate from the current accepted buffer, not a growing keystroke counter.
A detected paste marks the attempt as practice with pasted input, even after later edits. Autocomplete and spellcheck are requested off, not guaranteed prevented. Leaving the practice region or hiding the page ends the attempt as interrupted. There is no leaderboard or student record.
Use the case-change and extra-space examples during a code review. They keep speed, token matching and whole-text equality distinct. The native source and worked fixture table remain useful even when the classroom chooses untimed practice.
Copy a prompt for this example
Create a complete HTML typing practice game for the original passage "We pack lunch." It has 14 ASCII characters and three space-separated tokens. Start begins one performance.now clock and clears the previous text and results. Finish freezes the accepted text and elapsed time once; pressing it again changes nothing. Matching the passage does not finish automatically.
Calculate gross words per minute as current character count divided by five, divided by elapsed minutes. Show N/A at zero elapsed time. Calculate token accuracy from exact, case-sensitive positional matches divided by the number of typed tokens; extra tokens are wrong and empty input has zero accuracy. Completion requires exact whole-passage equality, including spacing and punctuation.
For a 30-second example, the exact passage gives 5.6 WPM, 100% accuracy and complete. "We pack" gives 2.8 WPM, 100% and incomplete. "We Pack lunch." gives 5.6 WPM and 66.67%. Adding " now" gives 7.2 WPM and 75%. Two spaces between We and pack give 6.0 WPM and 100% token accuracy but remain incomplete. Recompute from the current corrected text.
Accept printable ASCII; reject an unsupported completed edit without changing the accepted buffer. Wait for composition to end and prevent Finish during composition. Detected paste permanently labels that attempt as practice with pasted input. Hiding the page or leaving the practice region interrupts the attempt. Reset cancels old timers and returns to ready. Put the passage, labeled input, timer and three metrics together, with readable type and controls that fit a phone. Return one self-contained HTML file.
For a demonstration of the three definitions, NOS can display this prepared HTML practice. Finish a partial response, compare its accuracy with its incomplete status, and keep any actual learner observations in the teacher’s maintained record.