Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: https://solutionzip.com/downloads/gibberish/
- We are going to create some simple rules for translating normal English into Gibberish. A common
- rule is to add sounds to each syllable, but since syllables are difficult to detect in a simple program,
- we’ll use a rule of thumb: every vowel denotes a new syllable. Since we are adding a Gibberish
- syllable to each syllable in the original words, we must look for the vowels.
- To make things more unique, we will have two different Gibberish syllables to add. The first Gibberish
- syllable will be added to the first syllable in every word, and a second Gibberish syllable will be added
- to each additional syllable. For example, if our two Gibberish syllables were “ib” and “ag”, the word
- “program” would translate to “pribogragam.”
- In some versions of Gibberish, the added syllable depends on the vowels in a word. For example, if we
- specify “*b” that means we use the vowel in the word as part of the syllable: e.g. “dog” would become
- “dobog” (inserting “ob” where the “*” is replaced by the vowel “o”) and “cat” would become “cabat”
- (inserting “ab” where “a” is used). Note that the “*” can only appear at the beginning of the syllable
- (to make your programming easier).
- After the Gibberish syllables are specified, prompt the user for the word to translate. As you process
- the word, make sure you keep track of two things. First, if the current letter is a vowel, add a Gibberish
- syllable only if the previous letter was not also a vowel. This rule allows us to approximate syllables:
- translating “weird” with the Gibberish syllable “ib” should become “wibeird”, not “wibeibird”.
- Second, if we’ve already added a Gibberish syllable to the current word, add the secondary syllable to
- the remaining vowels. How can you use Booleans to handle these rules?
- Finally, print the Gibberish word. Afterwards, ask the user if they want to play again, and make sure
- their response is an acceptable answer (“yes”/“no”, “y”/“n”). Make sure to check the validity for all of
- your user inputs throughout the program. Don’t let bad input create errors.
- Your program will:
- 1. Print a message explaining the game.
- 2. Prompt for two Gibberish syllables (indicate the allowed wildcard character “*”).
- 3. Prompt for a word to translate.
- 4. Process the word and add the syllables where appropriate.
- 5. Print the final word, and ask if the user wants to play again
- Download: https://solutionzip.com/downloads/gibberish/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement