The Name Game: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 2: Line 2:
Write a program that accepts a name as input and outputs the lyrics to the Shirley Ellis song "The Name Game"
Write a program that accepts a name as input and outputs the lyrics to the Shirley Ellis song "The Name Game"


The regular verse
Using the name Katie as an example, the song follows this pattern:


Unless your name begins with a vowel (A, E, I, O, U), 'B', 'F' or 'M' you don't have to care about special rules.
Katie, Katie, bo-batie,
The verse for the name 'Gary' would be like this:
Bonana-fanna fo-fatie
Fee fi mo-matie
Katie!
A verse can be created for any name, with X as the name and Y as the name without the first consonant sound (if it begins with a consonant), as follows:


(X), (X), bo-b (Y)
Gary, Gary, bo-bary
Bonana-fanna fo-f (Y)
Banana-fana fo-fary
Fee fi mo-m (Y)
Fee-fi-mo-mary
(X)!
Gary!


At the end of every line, the name gets repeated without the first letter: Gary becomes ary
And if the name starts with a b, f, or m, that sound simply is not repeated. For example: Billy becomes "Billy Billy bo-illy"; Fred becomes "bonana fanna fo-red"; Marsha becomes "fee fi mo-arsha"
If we take (X) as the full name (Gary) and (Y) as the name without the first letter (ary) the verse would look like this:

(X), (X), bo-b(Y)
Banana-fana fo-f(Y)
Fee-fi-mo-m(Y)
(X)!

Vowel as first letter of the name

If you have a vowel as the first letter of your name (e.g. Earl) you do not truncate the name.
The verse looks like this:

Earl, Earl, bo-bearl
Banana-fana fo-fearl
Fee-fi-mo-mearl
Earl!

'B', 'F' or 'M' as first letter of the name

In case of a 'B', an 'F' or an 'M' (e.g. Billy, Felix, Mary) there is a special rule.
The line which would 'rebuild' the name (e.g. bo-billy) is sang without the first letter of the name.
The verse for the name Billy looks like this:

Billy, Billy, bo-illy
Banana-fana fo-filly
Fee-fi-mo-milly
Billy!

For the name 'Felix', this would be right:

Felix, Felix, bo-belix
Banana-fana fo-elix
Fee-fi-mo-melix
Felix!

Revision as of 03:00, 24 March 2018

The Name Game is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Write a program that accepts a name as input and outputs the lyrics to the Shirley Ellis song "The Name Game"

The regular verse

Unless your name begins with a vowel (A, E, I, O, U), 'B', 'F' or 'M' you don't have to care about special rules. The verse for the name 'Gary' would be like this:

   Gary, Gary, bo-bary
   Banana-fana fo-fary
   Fee-fi-mo-mary
   Gary! 

At the end of every line, the name gets repeated without the first letter: Gary becomes ary If we take (X) as the full name (Gary) and (Y) as the name without the first letter (ary) the verse would look like this:

   (X), (X), bo-b(Y)
   Banana-fana fo-f(Y)
   Fee-fi-mo-m(Y)
   (X)! 

Vowel as first letter of the name

If you have a vowel as the first letter of your name (e.g. Earl) you do not truncate the name. The verse looks like this:

   Earl, Earl, bo-bearl
   Banana-fana fo-fearl
   Fee-fi-mo-mearl
   Earl! 

'B', 'F' or 'M' as first letter of the name

In case of a 'B', an 'F' or an 'M' (e.g. Billy, Felix, Mary) there is a special rule. The line which would 'rebuild' the name (e.g. bo-billy) is sang without the first letter of the name. The verse for the name Billy looks like this:

   Billy, Billy, bo-illy
   Banana-fana fo-filly
   Fee-fi-mo-milly
   Billy! 

For the name 'Felix', this would be right:

   Felix, Felix, bo-belix
   Banana-fana fo-elix
   Fee-fi-mo-melix
   Felix!