Add symbols category
This commit is contained in:
parent
3913dfa1fa
commit
03c4fb9ea9
|
@ -138,6 +138,9 @@ up a letter faster.
|
||||||
<br>
|
<br>
|
||||||
<input type="radio" id="difficultyVeryHard" name="difficulty" value="really-hard">
|
<input type="radio" id="difficultyVeryHard" name="difficulty" value="really-hard">
|
||||||
<label for="difficultyVeryHard">Very Hard (multiple words)</label>
|
<label for="difficultyVeryHard">Very Hard (multiple words)</label>
|
||||||
|
<br>
|
||||||
|
<input type="radio" id="difficultySymbols" name="difficulty" value="symbols">
|
||||||
|
<label for="difficultySymbols">(symbols)</label>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -51,6 +51,15 @@ const REVERSE_MORSE_MAP = function() {
|
||||||
return reversed;
|
return reversed;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
const SYMBOLS = [
|
||||||
|
'.',
|
||||||
|
'?',
|
||||||
|
'!',
|
||||||
|
'=',
|
||||||
|
'+',
|
||||||
|
'-'
|
||||||
|
];
|
||||||
|
|
||||||
const COMMON_WORDS = {
|
const COMMON_WORDS = {
|
||||||
"description": "Common English words.",
|
"description": "Common English words.",
|
||||||
"commonWords":
|
"commonWords":
|
||||||
|
|
|
@ -125,6 +125,11 @@ function convertAsciiSentenceToMorse(asciiSentence) {
|
||||||
return splitSentence.map(convertAsciiWordToMorse);
|
return splitSentence.map(convertAsciiWordToMorse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRandomSymbol() {
|
||||||
|
const randomIndex = Math.floor(Math.random() * SYMBOLS.length);
|
||||||
|
return SYMBOLS[randomIndex];
|
||||||
|
}
|
||||||
|
|
||||||
function getRandomLetter() {
|
function getRandomLetter() {
|
||||||
const randomIndex = Math.floor(Math.random() * 26);
|
const randomIndex = Math.floor(Math.random() * 26);
|
||||||
return Object.keys(MORSE_MAP)[randomIndex];
|
return Object.keys(MORSE_MAP)[randomIndex];
|
||||||
|
@ -231,6 +236,10 @@ function getTarget() {
|
||||||
case 'morse-hard':
|
case 'morse-hard':
|
||||||
target = getRandomMorseWords();
|
target = getRandomMorseWords();
|
||||||
break;
|
break;
|
||||||
|
case 'symbols':
|
||||||
|
target = getRandomSymbol();
|
||||||
|
console.log(target);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
target = getRandomWords();
|
target = getRandomWords();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user