A while back, I worked on an online Flash version of the game show Don’t Forget the Lyrics. It’s a game show where contestants get up and sing along to some music until the music stops dead and they have to fill in the rest of the line. They have three lifelines (a la Who Wants to be a Millionaire) they can use: show the first three words, turn the question into a multiple-choice question, or get their pre-appointed friend to answer for them. The first two are easy to code up, the third not so much. We didn’t have the budget to record people singing the missing lyrics, so it had to be text-based. We thought of randomly selecting one of the multiple choice answers, but realized that people would probably feel cheated at being given a wrong answer. And it would be too easy to just always give them the right answer.
At some point, I came up with the idea of showing the player a scrambled version of the correct answer. That would leave it up to the player’s skill to get the correct answer from it, so it wasn’t a guaranteed success but would still seem fair. Then I had to come up with an algorithm for scrambling words that wasn’t too easy, but wasn’t too hard for anyone to solve in the time limit.
Try 1: Scramble the whole string, including spaces.
Sample: UM LOYDE L AYEYO HHIAS LSRT MNP OTIM NOPKATSFOHA EEFEN
This was dead easy to code and incredibly hard to solve. Scrambling the spaces in with the rest of the letters made it especially hard, since people automatically read them as word boundaries.
Try 2: Split the string into words, then scramble each word
Sample: I DEAM ITSH AHFL YPNO LAFH MENYKO MTOENSR TO SEAEPL UOY
This was much better, but still pretty hard. The time limit on answering meant that people often ran out of time while trying to unscramble the string. But then I remembered an e-mail forward I’d seen which claimed that if you leave the first and last letters of a word intact but scramble the rest, people can still pretty much read it.
Try 3: Split the string into words, freeze the first and last letters, and scramble the middle ones. (For 2-letter words, give a 50% chance of swapping the order.)
Sample: I MDAE THIS HALF PONY HLAF MEKONY MSOETNR TO PAESLE YOU
This was too easy. 3-letter words were always in order, since freezing the first and last letters left a 1-letter string to scramble. 4-letter words would stay in order half the time since their inner length-2 string got scrambled.
Try 4: This had a lot of special cases.
- Split the string into words. For each word longer than 1 letter:
- If the word is 2 letters long, 50% chance of swapping the letters
- If the word is 3 letters long, scramble it
- If the word is 4 letters long, freeze the first letter and scramble the rest
- If the word is 5 or more letters, freeze the first and last letter and scramble the inner letters
Sample: I MEAD THSI HFLA PYON HLFA MEONKY MOESNTR OT PAESLE OUY
The results were really good! Easy enough to solve within the time limit most of the time, and just hard enough to feel good about solving. The computer science geek in me wishes there were some way to do it with fewer special cases and a continuous difficulty scale, but short words really need to be treated differently because of their length. Still, it was a pretty interesting problem. Who knew an e-mail forward would come in so handy?
(Incidentally, the phrase is “I made this half-pony half-monkey monster to please you”, which is from the song Skullcrusher Mountain by Jonathan Coulton. Check it out!)