Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program in python 3 Problem The RWX game is a game where the idea is to guess the same random string that the program has

program in python 3

Problem

The RWX game is a game where the idea is to guess the same random string that the program has generated.

For each game, the program should generate a random three character target string (using the characters instring.digits, ensuring that each character in the target string is unique - e.g. "112" is not a valid target string because "1" is repeated). The user then tries to guess the target, and receives a hint after each incorrect guess indicating how close their guess is to the target string.

A "W" indicates that all of the characters in the guess are wrong.One or more "X"s indicates that they have a correct character, but in an incorrect positionOne or more "R"s indicates they have a correct character in the right position

The characters in the hint are presented in alphabetic order. The following table gives an example of the game's output for a user guess. Assume the target string is "123".

Scoring for the game depends on the number of guesses required for the user to guess the target string. If the user guesses the right answer on their first guess, they receive 10,000 points. Each subsequent guess reduces the possible score by 10% of its current value. For example, if the user guesses the right answer on their second guess, the user would receive 9,000 points (10% of 10,000). On their third guess, the user would receive 8,100 (10% of 9,000), and so on.

The game ends either when either:

the user guesses the target string, in which case they are told the number of guesses it took them to guess the target string and the number of points they were awarded (displayed to two decimal places);or when the possible number of points drops below 1,000, in which case they are told that the game is over, the number of guesses they have made, and the correct answer.

When the game completes, the user will be offered the opportunity to start a new game. If the user chooses to start a new game, the target string, the number of guesses, and the points must all be reset.

Notes

You must implement and use a function namedget_hint(guess, target)that takes the current guess and target string as parameters. It will return the hint that gets displayed to the user after an incorrect guess. The structure of the rest of your assignment is left to you, though it is suggested that other functions would be useful.

Your program should perform input validation. If the user enters anything other than three digits when asked to guess, they should be informed of the error and asked to input the guess again. You might findstr.is_digit()useful. When asked to play again, the user should be repeatedly asked until they enter "Y" or "y" (indicating they do want to play again) or "N" or "n" (indicating the program should exit).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

here) and other areas you consider relevant.

Answered: 1 week ago