CSc 250 - Wheel of Fortune

In this assignment, you’ll be implementing a simple version of “wheel of fortune” (WOF). One component of the WOF game show involves three contestants competing to solve a hangman-like word puzzle. There are other components of the show as well, but we’ll be focussing on the word-puzzle component.

Rules of the game

In your implementation of WOF, there will be three players, each of whom can choose their own name. These three players will take turns guessing the letters of a phrase, until one of them can guess the entire thing.

At the beginning of the game, the game-host will choose the phrase. Then, the program will manage the turns and guesses amongst the three players.

A players turn starts by either choosing to guess an individual letter in the phrase, or by guessing the entire phrase. In the former case, if they guess a letter that is in the word (and has not already been guessed) their turn will continue. If they choose an incorrect letter, the turn will pass onto the next player. In the latter case, if they guess the phrase correctly, they win the game! Otherwise, the turn goes to the next player.

Implementation

The game will begin with a message, and a request for the game host to enter a phrase.

%%%%%%%%%%%%%%%%%%%%%%%%
%%% WHEEL OF FORTUNE %%%
%%%%%%%%%%%%%%%%%%%%%%%%

Host, enter a phrase: test input

Whatever phrase is entered is the phrase that the other three players will be guessing. For the purpose of this example, the phrase will be “test input”. After this, each player can select their name, via a user input. I used A, B, and C just for the purpose of this example.

Player 1, enter your name: A
Player 2, enter your name: B
Player 3, enter your name: C

At this point, the main game begins! The turns should begin with player A.

Every round of every turn will ask the user to enter a phrase or letter. If they choose to enter a letter and get it correct, it should like like so:

The phrase is: ____ _____
A, guess letter or phrase? letter
A, guess a letter: t
Correct!
The phrase is: t__t ____t

They would then be prompted again to guess a letter or number. Guess a letter wrong would show the following

The phrase is: t__t ____t
A, guess letter or phrase? letter
A, guess a letter: z
Nope!
The phrase is: t__t ____t
B, guess letter or phrase?

They can also guess a phrase, which allows them to (potentially) win the whole game. Below is an example of guessing the whole phrase right or wrong:

The phrase is: t__t ____t
A, guess letter or phrase? phrase
A, guess a letter: test input
Correct!
Player A wins!
The phrase is: t__t ____t
A, guess letter or phrase? phrase
A, guess a letter: tart ropet
Nope!
The phrase is: t__t ____t
B, guess letter or phrase? 

Ending

The only way in which the game can end is by one of the players guessing the phrase exactly on their turn. Once a player has won, you should print a summery of the game. The summary should include how many turns and guesses each player had. It should look like this, except with potentially different names and numbers:

Player A had 3 turns and guessed 5 times
Player B had 2 turns and guessed 7 times
Player C had 2 turns and guessed 2 times

Edge Cases and Other Details

When asking a player for a letter or phrase, a user might not type one of these two things. If this happens, just print Huh? and ask them again, until they enter one of those two inputs. We are not going to test the case where the same letter is guessed twice. You may handle this however you like, or not handle it at all. The program is case-sensitive, but this actually makes your job easier. You don’t need to do any case normalization. A user can only win by guessing the full phrase. If a user guesses the last letter, making the phrase complete, they still must state the phrase.

Submission

This program is due Monday, Feb 19th by 5:00pm. Turn it in on D2L before the due-date. Name the program wheel_of_fortune.py.

Full-run examples

Below are a few full program run outputs. You should make your program produce the same output, given the same inputs.

%%%%%%%%%%%%%%%%%%%%%%%%
%%% WHEEL OF FORTUNE %%%
%%%%%%%%%%%%%%%%%%%%%%%%
Host, enter a phrase: judah
Player 1, enter your name: A
Player 2, enter your name: B
Player 3, enter your name: C
The phrase is: _____
A, guess letter or phrase? letter
A, guess a letter: j
Correct!
The phrase is: j____
A, guess letter or phrase? letter
A, guess a letter: h
Correct!
The phrase is: j___h
A, guess letter or phrase? letter
A, guess a letter: g
Nope!
The phrase is: j___h
B, guess letter or phrase? letter
B, guess a letter: d
Correct!
The phrase is: j_d_h
B, guess letter or phrase? phrase
B, guess a phrase: judah
Player B wins!
Player A had 1 turns and guessed 3 times
Player B had 1 turns and guessed 2 times
Player C had 0 turns and guessed 0 times
%%%%%%%%%%%%%%%%%%%%%%%%
%%% WHEEL OF FORTUNE %%%
%%%%%%%%%%%%%%%%%%%%%%%%
Host, enter a phrase: the tart
Player 1, enter your name: Joe
Player 2, enter your name: Archie
Player 3, enter your name: Sally
The phrase is: ___ ____
Joe, guess letter or phrase? letter
Joe, guess a letter: k
Nope!
The phrase is: ___ ____
Archie, guess letter or phrase? letter
Archie, guess a letter: Q
Nope!
The phrase is: ___ ____
Sally, guess letter or phrase? letter
Sally, guess a letter: t
Correct!
The phrase is: t__ t__t
Sally, guess letter or phrase? letter
Sally, guess a letter: h
Correct!
The phrase is: th_ t__t
Sally, guess letter or phrase? phrase
Sally, guess a phrase: the tort
Nope!
The phrase is: th_ t__t
Joe, guess letter or phrase? letter
Joe, guess a letter: e
Correct!
The phrase is: the t__t
Joe, guess letter or phrase? letter
Joe, guess a letter: r
Correct!
The phrase is: the t_rt
Joe, guess letter or phrase? phrase
Joe, guess a phrase: the tert
Nope!
The phrase is: the t_rt
Archie, guess letter or phrase? phrase
Archie, guess a phrase: the tart
Player Archie wins!
Player Joe had 2 turns and guessed 4 times
Player Archie had 2 turns and guessed 2 times
Player Sally had 1 turns and guessed 3 times
%%%%%%%%%%%%%%%%%%%%%%%%
%%% WHEEL OF FORTUNE %%%
%%%%%%%%%%%%%%%%%%%%%%%%
Host, enter a phrase: ant
Player 1, enter your name: Joe
Player 2, enter your name: Sally
Player 3, enter your name: Jamie
The phrase is: ___
Joe, guess letter or phrase? let
Huh?
Joe, guess letter or phrase? something
Huh?
Joe, guess letter or phrase? let
Huh?
Joe, guess letter or phrase? letter
Joe, guess a letter: a
Correct!
The phrase is: a__
Joe, guess letter or phrase? phrase
Joe, guess a phrase: ant
Player Joe wins!
Player Joe had 1 turns and guessed 2 times
Player Sally had 0 turns and guessed 0 times
Player Jamie had 0 turns and guessed 0 times