• The Florin Ministry of Foreign Information has asked us to add GIBBERISH to the translation program.
  • Gibberish
    • Is a language game, just like Pig-Latin.
    • It is normally played based on syllables.
      • It is not easy to detect syllables in English.
      • So we will simplify the game, and only look at vowels.
    • There are three versions of the game we will support.
    • All three involve placing a letter combination into words before vowels.
    • The three combinations we will support are
      • itheg
      • idig
      • uddag
    • Look at all of the vowels in a word (a,e,i,o,u)
      • If the vowel starts the word, or is proceeded by a consent insert the combination into the word.
        • ask becomes ithegask
        • frog become frithegog
        • racecar becomes rithegacithegecithegar
      • If the vowel is proceeded by a vowel, nothing is changed.
        • street only the first e is modified to produce strithigeet
  • It seems to me that I will need two high level routines
    • FileToGibberish - this will convert a message in a file into Gibbersih
    • FileFromGibberish - this will convert a message in a file from Gibberish.
  • The Commands to convert to and from Gibberish will have the code letter G (to convert to), and g (to convert from).
    • There will be an axillary argument to specify which version of Gibberish
      • 1 - ithig
      • 2 - idig
      • 3 - uddag
    • Some examples
      File1 G File2 1   will convert the message in File1 to Gibberish using ithig
      File2 g File3 1  will convert the message in File2 from Gibberish using ithig
      	
  • FileToGibberish
    • This routine will probably need the following input:
      • The input file name, this is the source of the data for the routine
      • The output file name, this is the destination of the data for the routine.
      • The version of Gibberish to use (an int)
    • This routine will probably not return any values.
    • Basic Algorithm:
      FileToGibberish(inputFileName, outputFileName, comboCode)
          open the files
      
          combo  = GetCombo(comboCode)
      
          read inputWord from the input file
          while the input file operation is successful
             outputWord = WordToGibberish(inputWord, combo) 
             write outputWord to the output file
             read inputWord from the input file
          close the files
          return
      	
  • FileFromGibberish will work the same way.
  • It looks like I need another routine, WordToGibberish (and probably WordFromGibberish)
  • WordToGibberish
    • Input:
      • The word to convert to Gibberish
      • The combination to use before vowels
    • Output:
      • The new word in Gibberish
    • Basic Algorithm:
      • I need to be able to identify vowels. IsVowel(char letter)
      • I need to keep track of the position of the last vowel.
      • string WordToGibberish(word, code)
            lastVowelPos = -10
            returnWord = ""
        
            for pos = 0 to length of word
               if IsVowel(word[pos]) 
                  if pos != lastVowelPos -1
        	      add code to returnWord
                add word[pos] to returnWord
            return returnWord
        	    
  • WordFromGibberish is a bit different
    • Input:
      • The word in Gibberish
      • The code we are removing
    • Output:
      • The word with the Gibberish removed
    • Basic Algorihtm
      string  WordFromGibberish(word, code)
          startpos = 0
          while startpos < word.size()
             find the position (pos)  of the  occurence
                    of code in word at or past startpos
             if the find was successful
                 extract all letters from startpos to pos 
      	          and append them to returnWord
                 startPos = pos+length of the code 
          add all the letters from startPos to the end of the word to returnWord
          return returnWord
             
  • A structure chart