subject

Part A: WOFPlayer We're going to start by defining a class to
represent a Wheel of Fortune player, called WOFPlayer. Every instance of WOFPlayer has three instance variables:
-.name: The name of the player (should be passed into the constructor)
-.prizeMoney: The amount of prize money for this player (an integer, initialized to 0)
-.prizes: The prizes this player has won so far (a list, initialized to [])Of these instance variables, only name should be passed into the constructor.
It should also have the following methods (note: we will exclude self in our descriptions):
-.addMoney(amt): Add amt to self. prizeMoney
-.goBankrupt(): Set self. prizeMoney to 0
-.addPrize(prize): Append prize to self. prizes
-.__str__(): Returns the player's name and prize money in the following format:
-Steve ($1800) (for a player with instance variables .name == 'Steve' and prizeMoney == 1800)
Part B: WOFHumanPlayer
Next, we're going to define a class named WOFHumanPlayer, which should inherit from WOFPlayer (part A). This class is going to represent a human player. In addition to having all of the instance variables and methods that WOFPlayer has, WOFHumanPlayer should have an additional method:
-.getMove(category, obscuredPhrase, guessed): Should ask the user to enter a move (using input()) and return whatever string they entered..getMove()'s prompt should be:
{name} has ${prizeMoney}
Category: {category}
Phrase: {obscured_phrase}
Guessed: {guessed}
Guess a letter, phrase, or type 'exit' or 'pass':
For example:
Steve has $200Category: Places
Phrase: _L___ER NN_L P_RK
Guessed: B, E, K, L, N, P, R, X, Z
Guess a letter, phrase, or type 'exit' or 'pass':
The user can then enter:
-'exit' to exit the game
-'pass' to skip their turn
-a single character to guess that letter
-a complete phrase (a multi-character phrase other than 'exit' or 'pass') to guess that phraseNote that .getMove() does not need to enforce anything about the user's input; that will be done via the game logic that we define in the next ActiveCode window.
Part C: WOFComputerPlayer
Finally, we're going to define a class named WOFComputerPlayer, which should inherit from WOFPlayer (part A) This class is going to represent a computer player.
Every computer player will have a difficulty instance variable. Players with a higher difficulty generally play "better". There are many ways to implement this. We'll do the following:
-If there aren't any possible letters to choose (for example: if the last character is a vowel but this player doesn't have enough to guess a vowel), we'll 'pass'
-Otherwise, semi-randomly decide whether to make a "good" move or a "bad" move on a given turn (a higher difficulty should make it more likely for the player to make a "good" move)
-To make a "bad" move, we'll randomly decide on a possible letter.
-To make a "good" move, we'll choose a letter according to their overall frequency in the English language. In addition to having all of the instance variables and methods that WOFPlayer has, WOFComputerPlayer should have:
Class variable
-.SORTED_FREQUENCIES: Should be set to '', which is a list of English characters sorted from least frequent ('Z') to most frequent ('E'). We'll use this when trying to make a "good" move. Additional Instance variable
-.difficulty: The level of difficulty for this computer (should be passed as the second argument into the constructor after .name)Methods
-.smartCoinFlip(): This method will help us decide semi-randomly whether to make a "good" or "bad" move. A higher difficulty should make us more likely to make a "good" move. Implement this by choosing a random number between 1 and 10 using random. randint(1, 10) (see above) and returning True if that random number is greater than self. difficulty. If the random number is less than or equal to self. difficulty, return False.
-.getPossibleLetters(guessed): This method should return a list of letters that can be guessed.
-These should be characters that are in LETTERS ('') but not in the guessed parameter.
-Additionally, if this player doesn't have enough prize money to guess a vowel (variable VOWEL_COST set to 250), then vowels (variable VOWELS set to 'AEIOU') should not be included
-.getMove(category, obscuredPhrase, guessed): Should return a valid move.
-Use the .getPossibleLetters(guessed) method described above.
-If there aren't any letters that can be guessed (this can happen if the only letters left to guess are vowels and the player doesn't have enough for vowels), return 'pass'
-Use the .smartCoinFlip() method to decide whether to make a "good" or a "bad" move
-If making a "good" move (.smartCoinFlip() returns True), then return the most frequent (highest index in SORTED_FREQUENCIES) possible character
-If making a "bad" move (.smartCoinFlip() returns False), then return a random character from the set of possible characters (use random. choice())

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
question
Computers and Technology, 23.06.2019 08:30
Based on your knowledge of a good network, describe what you think is a perfect network would be. what kind of information and resources could users share on this network. what would the network administrator do? what kind of communication would be used?
Answers: 1
question
Computers and Technology, 23.06.2019 10:50
The volume v and paper surface area a of a conical paper cup are given by where r is the radius of the base of the cone and h is the height of the cone. a. by eliminating h, obtain the expression for a as a function of r and v. b. create a user-de ned function that accepts r as the only argument and computes a for a given value of v. declare v to be global within the function. c. for v ! 10 in.3 , use the function with the fminbnd function to compute the value of r that minimizes the area a. what is the corresponding value of the height h? investigate the sensitivity of the solution by plotting v versus r. how much can r vary about its optimal value before the area increases 10 percent above its minimum value?
Answers: 1
You know the right answer?
Part A: WOFPlayer We're going to start by defining a class to
represent a Wheel of Fortune pl...
Questions
question
English, 12.04.2022 14:00
question
Biology, 12.04.2022 15:00
Questions on the website: 13722362