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