Link to a web app: https://voice-rock-paper-scissors.glitch.me/
As the title indicates, Voice Rock Paper Scissors is a voice-controlled version of the classic rock paper scissors game.
One of the problems I encountered was that the word "scissors" out of my mouth was recognized as "Ceasars" for more than half of the time. It might be because of my limitations as a non-native speaker, not being able to fully convey a subtle difference in pronunciation between scissors(si·zrz) and Caesars(see·zr).
The simple solution I took was adding Caesars as a value in the dictionary. And used the statement, Object.values(games)[2].includes(phrase) == true), to allow both words "scissors" and "Caesars" to be recognized as scissors in the game.
//Before
let games = {
"✊": "Rock",
"✋": "paper",
"✌": "scissors"
};
//After
let games = {
"✊": "Rock",
"✋": "paper",
"✌": ["scissors", "Caesars"]
};
Demo
Comments