My code will only guess fixed words ( less < 1000 )
I want to store all words/array/list/object - content in separate file (any better option except .txt)
I actually making a bot which reacts to fixed words only
I tried...
var word = '';
function guess(obj, arry) {
var keys = Object.keys(obj);
keys.forEach((key) => {
var inKey = key.split(/,\s?/);
inKey.forEach((l) => {
l == arry[0] && (word += inKey[0]) && guess(obj[key], arry.slice(1));
});
});
}
var guessLetters = {
"s, $, &, ʂ, ₰, ₷": {
"l, |, ł, ʟ": {
"e, ∃, ∊, £, €, ė, ɛ, ɘ , ə": {
"e, ∃, ∊, £, €, ė, ɛ, ɘ , ə": {
"p, ℗, ‽, ⁋, ₽, ₱, Þ, þ, ₽": "p"
}
}
}
},
"a, @": {
"s, $, &, ʂ, ₰, ₷": "s"
}
};
var guessThis = "₰ʟ£ɛ‽";
guess(guessLetters, guessThis.split(''));
console.log(word);
This solution I got after checking google and some related questions
problems...
repetition of same type of key like 's' for 'sleep' and 's' for 'as'
can't guess if 1 letter is missing in word
there is one more way I thought...
var translate = {
"@, ª, ₳":"a",
"₿, ฿":"b",
"₵, ₡, ¢":"c",
"£, €, ɛ":"e",
"₣":"f",
respetive to all 27 letters
};
but...
ex. if I have CAT in my collection and user enter CAR then...
1st method will stop at R != T and ignore user
2nd method will translate whole CAR and also check (CAR in Collection) then ignore user