URL of experiment: https://run.pavlovia.org/kc71/fok/html/
Description of the problem: I need to search a string for all of 3 different characters that will not appear together. Basically, I want to determine whether or not a text entry is correct, but still allow for spelling errors.
For example, if I was expecting the word garden to be typed, I could be reasonably certain that the participant would get the g, d, and n. So, I want to check if the letters g, d, and n were typed, but not together and not in order. There are 40 trials so there are 40 different words with 40 sets of letters to search for. The letters are kept in a conditions file - each letter gets its own column (letter1, letter2, letter3).
This python code is working successfully in the desktop version:
if letter1 in recall.text and letter2 in recall.text and letter3 in recall.text:
recallTotal=recallTotal+1
recallCorrect = 1
else:
recallCorrect = 0
runFOK=1
I tried this in JS, and thought it was working, but after a closer look it is not accurate. I also cannot figure out what it is doing from the pattern of correct and incorrect responses:
if (recall.text.includes(letter1 && letter2 && letter3) == true) {
recallTotal=recallTotal+1;
recallCorrect = 1;
}
else {
recallCorrect = 0;
runFOK=1;
}
Does anyone have a fix or a better suggestion? Here are examples of what it has marked right and wrong:
Typed word/Letters/Right-1 or Wrong-0
garden/g, d, n/1
werck/t, o, n/0
lad/l, e, g/1
kylight/s, k, l/1
poppy/p, a, r/0
clone/i, r, l/1
I did try changing the column names to something nonsensical without numbers in case the column name was an issue, but the results were the same.
Any help is greatly appreciated, thanks!