mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-02 21:44:06 +08:00
fixed infinite loop when practising missed words. closes #1558
This commit is contained in:
parent
ca4730abae
commit
f53ed4f5b4
1 changed files with 7 additions and 7 deletions
|
|
@ -468,24 +468,24 @@ export async function init() {
|
|||
const previousWord = words.get(i - 1);
|
||||
const previousWord2 = words.get(i - 2);
|
||||
if (
|
||||
Config.mode == "custom" &&
|
||||
(CustomText.isWordRandom || CustomText.isTimeRandom) &&
|
||||
wordset.length < 3
|
||||
) {
|
||||
randomWord = wordset[Math.floor(Math.random() * wordset.length)];
|
||||
} else if (
|
||||
Config.mode == "custom" &&
|
||||
!CustomText.isWordRandom &&
|
||||
!CustomText.isTimeRandom
|
||||
) {
|
||||
randomWord = CustomText.text[i];
|
||||
} else {
|
||||
} else if (
|
||||
Config.mode == "custom" &&
|
||||
(wordset.length < 3 || PractiseMissed.before.mode !== null)
|
||||
) {
|
||||
randomWord = wordset[Math.floor(Math.random() * wordset.length)];
|
||||
} else {
|
||||
while (
|
||||
randomWord == previousWord ||
|
||||
randomWord == previousWord2 ||
|
||||
(!Config.punctuation && randomWord == "I") ||
|
||||
randomWord.indexOf(" ") > -1
|
||||
) {
|
||||
console.log('rerandomising');
|
||||
randomWord = wordset[Math.floor(Math.random() * wordset.length)];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue