Compare commits
2 Commits
926c748eea
...
7c9d161719
Author | SHA1 | Date | |
---|---|---|---|
|
7c9d161719 | ||
|
c19c873b02 |
File diff suppressed because it is too large
Load Diff
@ -39,8 +39,6 @@ function stopNotePlaying() {
|
|||||||
$("#beepLamp").removeClass("lamp-on")
|
$("#beepLamp").removeClass("lamp-on")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function sleep(ms) {
|
function sleep(ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
@ -137,6 +135,11 @@ function getRandomWord() {
|
|||||||
return EASY_WORDS[randomIndex];
|
return EASY_WORDS[randomIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRandomMorseWord() {
|
||||||
|
const randomIndex = Math.floor(Math.random() * MORSE_WORDS.length);
|
||||||
|
return MORSE_WORDS[randomIndex];
|
||||||
|
}
|
||||||
|
|
||||||
function getRandomEasyWords() {
|
function getRandomEasyWords() {
|
||||||
const totalLength = Math.floor(Math.random() * 3) + 2;
|
const totalLength = Math.floor(Math.random() * 3) + 2;
|
||||||
let finalSentence = ''
|
let finalSentence = ''
|
||||||
@ -149,11 +152,11 @@ function getRandomEasyWords() {
|
|||||||
return finalSentence;
|
return finalSentence;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomWords() {
|
function getRandomMorseWords() {
|
||||||
const totalLength = Math.floor(Math.random() * 4) + 2;
|
const totalLength = Math.floor(Math.random() * 4) + 2;
|
||||||
let finalSentence = ''
|
let finalSentence = ''
|
||||||
for (let i = 0; i < totalLength; i++) {
|
for (let i = 0; i < totalLength; i++) {
|
||||||
finalSentence += ALL_WORDS[Math.floor(Math.random() * ALL_WORDS.length)];
|
finalSentence += MORSE_WORDS[Math.floor(Math.random() * MORSE_WORDS.length)];
|
||||||
if (i < totalLength - 1) {
|
if (i < totalLength - 1) {
|
||||||
finalSentence += ' ';
|
finalSentence += ' ';
|
||||||
}
|
}
|
||||||
@ -222,6 +225,12 @@ function getTarget() {
|
|||||||
case 'hard':
|
case 'hard':
|
||||||
target = getRandomEasyWords();
|
target = getRandomEasyWords();
|
||||||
break;
|
break;
|
||||||
|
case 'morse-easy':
|
||||||
|
target = getRandomMorseWord();
|
||||||
|
break;
|
||||||
|
case 'morse-hard':
|
||||||
|
target = getRandomMorseWords();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
target = getRandomWords();
|
target = getRandomWords();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user