Limit the words per minute allowed#194
Open
HotWheelzCodez wants to merge 2 commits intocodicocodes:mainfrom
Open
Limit the words per minute allowed#194HotWheelzCodez wants to merge 2 commits intocodicocodes:mainfrom
HotWheelzCodez wants to merge 2 commits intocodicocodes:mainfrom
Conversation
… minute is above a certain threshold, aka if the user is using a program to type for them
MickaelRiego
approved these changes
Jun 13, 2025
MickaelRiego
left a comment
There was a problem hiding this comment.
We should probably set the WPM limit to the world record, which I believe I saw was 216 WPM. Also, we need something better than just "0." Maybe we could add a message asking them to type manually?
But good idea !
codicocodes
reviewed
Jan 19, 2026
Comment on lines
24
to
29
| const totalWordLength = words.reduce((sum, word) => sum + word.length, 0); | ||
| const avgWordLength = totalWordLength / words.length; | ||
| const wpm = cpm / avgWordLength; | ||
| if (wpm > 300) { // Abitrary value, change as needed, if cpm is greater they are most likely using an automation program | ||
| return 0; // Simply give them no score | ||
| } |
Owner
There was a problem hiding this comment.
Sorry for the late review, but I'm happy to move forward with this, but could you just change the calculation to wpm=cpm/5 instead as this is the commonly used wpm/cpm conversion
…ict error handling / refactor
Author
|
Just went ahead and update that, also refactored the function slightly with a little bit better error handling. Let me know though if you want me to roll it back and just souly update the calculation to be 5. |
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.
I created a simple python script to type out a challenge for me and realized that I was able to type over 1000 words per minute with, I add a quick "half assed" fix for it. In the getCPM method in ResultCalulationService I made it so it just returns 0 if the words per minute is greater than 300, there may be a better implementation for this due to the fact I am still learning the codebase.