Wheel of Fortune is a television game show created by Merv Griffin. The show features a competition in which three contestants solve word puzzles — similar to hangman — to win cash and prizes determined by spinning a giant carnival wheel. Each round has a category and a blank word puzzle, with each blank representing a letter in a hidden sentence. The contestants spin the wheel in turn to determine a dollar value and guess a consonant. Calling a correct letter earns the value before the corresponding flipper, multiplied by the number of times the letter appears in the puzzle. Based on the given category and the letters that appear on the puzzle board, the contestant taking turn may then attempt to guess the hidden sentence.

new baby buggy
In the television game show Wheel of Fortune, the contestant have to guess a hidden sentence based on the letters that appear of the puzzle board.

Wheel of Fortune ranks as the longest-running syndicated game show in the United States, with over 6000 episodes aired. TV Guide named it the top-rated syndicated series in a 2008 article, and in 2013 the magazine ranked it at No. 2 in its list of the 60 greatest game shows ever. The program has also come to gain a worldwide following with sixty international adaptations.

The game has been made legendary by the stupidity of some of its candidates. Some blunders forever sit in our collective memory. Did you know the Italian football team AC Melon, president Jill Clinton, the character Wander Women, the style of humor called slipstack, or the characters Batmen and Reban?

For every miraculous New Baby Buggy1 guess on the show, there are dozens more Mythological Hero Achilles2 incidents. Many of these bloopers3 have started to live their own life, which sometimes makes it hard to figure out which ones have really occurred in Wheel of Fortune, and which ones are urban legends that have been fabricates by some funny guys.

Assignment

Example

The following interactive session assumes that the text file wheeloffortune.txt4 is located in the current directory.

>>> pattern('AC Melon')
'_C M_l_n'
>>> pattern('slipstack')
'sl_pst_ck'
>>> pattern('Wander Women')
'W_nd_r W_m_n'

>>> candidates = bloopers('wheeloffortune.txt')
>>> candidates['_C M_l_n']
{'AC Melon', 'AC Milan'}
>>> candidates['sl_pst_ck']
{'slapstick', 'slipstack'}
>>> candidates['W_nd_r W_m_n']
{'Winder Woman', 'Wander Women', 'Wonder Woman'}

>>> bloopers('wheeloffortune.txt', length=13)
{'B_tm_n _nd R_b_n': {'Batman and Robin', 'Batmen and Reban'}}
>>> bloopers('wheeloffortune.txt', occurrences=3)
{'W_nd_r W_m_n': {'Wander Women', 'Winder Woman', 'Wonder Woman'}}
>>> bloopers('wheeloffortune.txt', occurrences=2, length=12)
{'W_nd_r W_m_n': {'Wander Women', 'Winder Woman', 'Wonder Woman'}, 'B_tm_n _nd R_b_n': {'Batman and Robin', 'Batmen and Reban'}}