Hi guys me again. I am wondering if I could disallow certain input to a textbox.
Context:
I am planning to make a creative writing tool to help students who struggle to get words down for short story writing. I’d like to make a kind of timer bar that depletes over x amount of time. In this time, the student will enter text into a textbox (based on a picture stimulus etc.) and they get points if they have over x words. Easy enough so far.
What I am worried about is that a student’s desire to beat a level may trump their desire to get better at writing, resulting in a desperate word spam (“asd asd bsdl sldj sdlkj dfkj”) just to beat the level.
So I am wanting a way to pick up on (and disincentivize) some of that kind of behavior.
In the absence of being able to check a player’s inputted spelling/grammar easily within a twine game itself, I wonder if I can just disallow really basic cheat attempts:
1. Repeated words in sequence
So if a player writes “bob ran up the hall hall hall” and clicks “submit” on a button it might return something like "hmm… looks you’re just spamming words here! You lose 5 xp. Try again.
2. Copied phrases of 2-4 words.
So the following examples would also return an error like above:
“bob ran bob ran” (2 words copy pasted)
“bob ran fast bob ran fast” (3 words copy pasted)
“bob ran fast to bob ran fast to” (4 words copy pasted)
3. Phrases that contain 2 or more words with no vowels
So “asd dlkj” wouldn’t be allowed but “Bob ran quikly towards th hall. the light was on” would be allowed because only 1 word (“th”) is without a vowel. (Basically, I’m allowing for one spelling error where the student misses a vowel in a word.)
4. Phrases that contain lots of a certain word (maybe 5?).
So the phrase “bob ran bob quickly bob down bob the hall bob” wouldn’t be allowed because it contains 5 “bobs” even though it doesn’t have repeated words!
5. A way to check all this stuff in lowercase regardless of what the student has written, but still keep the students original formatting to return to them later.
So this input “Bob bob Bob bob the The the The” would get checked in all lowercase and trigger some of the above alarms ^^ but could still be returned to the student with their capitalization
I’m open to other ideas too! Just trying to think of some basic hacks students might try. I know I can’t cover everything, but if students lose enough points they might just decide to try and write for real
Thanks so much for your help!
EDIT: Does anyone know of existing code that does something like the above?