For the computationally inclined, a brief decription of how it works:
- User's English input is stored as a string.
- Then, our function loops through the array and provides a few analyses:
- If the last character of a word is a punctuation mark, we remove it from the string and store it as a temporary variable.
- If the first two letters are in the array of English acceptable onsets ("sh","th" as an example) we move the first two chars to the end of the word.
- If the first character is a vowel, nothing is done.
- Then add the word with the characters at the end with "ay" and finally the punctuation mark if there was one present.
- Having a space in the last character of a string results in undefined.
- Example: Try typing "translator "
- Multiple punctuation marks on a single word results in obvious errors.
- woohoo!! ==> oohoo!way! (instead of oohooway!!)
And in the next year...
- An english language game archive
- Complete with translators and description of the game: